I had made a complete image (at least I think I have) using dd if=/dev/sda of=/mnt/sda.img bs=32M
where mnt is an external HD I use.
I came to restore that image this morning, so I booted up on a live USB and mounted the external HD and ran dd if=/mnt/sda.img of=/dev/sda bs=32M
, I rebooted and it transpires that drive is missing it's MBR and partition table. I tried writing to the disk again with a much smaller blocksize, I think about 64k, however that made no difference.
Have I somehow failed to backup the whole disk? (i.e. have a lost the MBR?)
I ran file on sda.img
and it identifies it as ext4 data.
EDIT: (in response to mpy)
It was in my understanding that the commands I ran should have imaged the whole disk, from the very first sector to the last.
sfdisk -l /mnt/sda.img
yields
sfdisk: Disk sda.img: cannot get geometry
Disk sda.img: 7294 cylinders, 255 heads, 63 sectors/track
I have two images on this hard drive, one with linux installed, the other with win 7. The linux image isn't the same size, it's smaller, presumably dd
didn't copy everything.
ls -l
..... 60003385344 May 29 14:19 sda.img
..... 64023257088 May 31 13:08 sda-win.img
I appreciate the fact I should have checked the image size before wiping my HD now... Would it be possible to try and restore this image (say, just assume the missing 4GB was just empty space)? Interestingly I can loop mount the image and have access to what looks like most of the data (I can't see anything missing)
sfdisk -l /mnt/sda.img
? And, can you tell from the size of the image vs. whole hdd if some partitions are missing?/mnt
only read-only, so a typo in a command won't modify your backup.mount -o ro,remount /mnt