I have an image of my home (
/dev/sda3) partition, which I've created using the "dd" command.
dd if=/dev/sda3 of=/path/to/disk.img
I've deleted the home partition via gparted in order to enlarge my
/dev/root partition. Then I've recreated the
/dev/sda3 partition which is smaller in size then the one I've backed up to the image.
I was wondering since I have a 2TB external HDD, could it be possible to mount my backed up image on the external HDD and then copy the files into the
/home directory. Since the external HDD would be already in a "mounted state", I'm unsure whether this is a good idea, mounting on a mounted device.
- I'm running Slackware 13.37 (64bit).
- used ext4 on all the partitions.
- resized the root partition with gparted live cd.
mount -t ext4 /path/to/disk.img /mng/image -o loop
It gave me an fs error (wrong fs type, bad option, bad superblock on dev/loop/0)
Then I did
dmesg | tail
EXT4-fs (loop0) : bad geometry: block count 29009610 exceeds size of defice (1679229 blocks)
I have no idea what to do, I want to restore my
/home data from the image I've backed up.
[Update]: * The disk.image is on my USB 16GB flash drive. The image size is around 6GB. The image was created from a deleted partition which was around 100GB and now it's reduced to around 80GB.
[Update]: I've tried this today: LQWiki: Some dd examples says:
You don't want to tell a drive it is bigger than it really is by writing a partition table from a larger drive to a smaller drive. The first 63 sectors of a drive are empty, except sector 1, the MBR.
dd if=/dev/sda skip=2 of=/dev/sdb seek=2 bs=4k conv=noerror
I tried then to mount
dmesg | tail outputs an error "group descriptors corrupted!"
Then I tried:
fsck.ext4 -y -f /dev/sda3
It outputs a large amount of fixed issues and million of numbers going down at the speed of light.
After that I successfully mounted
/home, but there was no data present in the home directory. Only some directory named "lost+found" which is also empty.