Mounting a full-disk image read-only to recover old projects
losetuploop-devicedisk-imagerecoveryext4data-recovery
A raw image of a whole disk (dd-style, with a partition table) can be browsed like the original machine by attaching it to a loop device with partition scanning, then mounting the root partition read-only. This is how two old DCTI products (Phone Manager and EdgeLink) were recovered years later from a 2023 image of an old Ubuntu dev machine.
Procedure
sudo mkdir -p /mnt/img
LOOP=$(sudo losetup -f --show -r -P "/media/$USER/DRIVE/Disk Image of sda.img")
lsblk "$LOOP" # shows ${LOOP}p1, p2, p3 ...
sudo mount -o ro "${LOOP}p3" /mnt/img # pick the rootfs partition (here p1=EFI, p2=swap, p3=rootfs)
# done:
sudo umount /mnt/img && sudo losetup -d "$LOOP"
-rattaches read-only,-Pscans partitions,--showprints the device.- Not persistent: redo after reboot.
- Files owned by UID 1000 inside are readable by your own UID 1000 without sudo.
Gotchas
- An external ext4 drive formatted on another system may be owned by a different UID (here 999) and unreadable;
sudo chown -R $USER:on the drive fixes it permanently (survives replug). - Old home directories contain credentials (git hosting logins, DB passwords, keystores). Treat anything recovered as needing a secret scrub before it is published; see Open-sourcing old proprietary code (scrub, rewrite history, modernize, publish).
- When several sibling projects share branding and infrastructure, do not infer lineage ("X was renamed to Y") from shared logos or DB files. Find direct evidence (here an
opensource/CallAccountingfolder showed EdgeLink's real rename) or ask.
See also
- Open-sourcing old proprietary code (scrub, rewrite history, modernize, publish)
- Repairing a Windows 11 boot hang from Linux and WinRE (and when to stop)