I was tasked with recovering some photos from a dying drive. I finally resorted to magicrescue, which is nice and to the point. And command line and packaged in Ubuntu, so very dandy.
Before finding it, however, I backed up the whole partition with dd. I'm used to mount .iso images, so I guessed that a dd dump can be likewise easily mounted. Indeed, it would be as simple as:
sudo mount -o loop <dumpfile> <mount point>
This triggered an interest into creating any arbitrary filesystem within a file (saving the need for toying with real partitions or virtual machines). It turned to be damn easy:
- Create the file (e.g. $ dd if=/dev/zero of=disk count=1024 ibs=1024
This will dump 1024 blocks of 1024 bytes of zeros into a file named 'disk' - Associate the file with a device (e.g. $ losetup -f disk).
This was actually the only piece of info I was missing. - Find out the loop device ($ losetup -a)
- Create the filesystem (e.g. $ mkfs.ext4 /dev/loop0)
- Mount your file! (e.g. $ mkdir mnt ; mount disk mnt)
That's it. Or, you could insert a partition table (between steps 3 and 4) with fdisk, and create several partitions inside. At that point you can use nicer graphical tools like gparted.
Alex out.
| < Prev | Next > |
|---|


