Hi,
I've been using DD to backup and restore my partitions for years now and it's absolutely amazing.
I have backed up my MBR and MBR+Partition Table into a .img file each. In case I need to restore the MBR or Part Table. Actually for the part table sfdisk can make a backup in a txt file and you can reload it with "-d > [file.name]", that's awesome too.
So I use 2 IDENTICAL hard drives, only the serial number differs. The 2nd HDD is my backup and test HDD. I can image any partition and restore at any time.
Since I currently have GRUB2 in my backup/test HDD and GRUB LEGACY in my main, the 2 MBRs don't contain the same data, obviously. Now I want to bring back my test HDD to its original state which is an exact copy of my main HDD (my main HDD is failing! Hardware, it's dying). Due to the way I have partitioned my HDDs, I can simply restore my / partition and my MBR and I should be good.
Great cuz I have an image of both!
Wrong. I follow what I have found on internet and for some reason my MBR doesn't restore properly. I need to fire up the kernel using on sdb using sda's GRUB (sda=main HDD, the one failing).
Yes my sdb1 (root) partition is marked bootable. Don't get me wrong, both part tables of both HDDs are identical.
So restoring my sda1 to sdb1 partition works ALL the time. Then I have my distro restored.
I then can boot sdb1 from the GRUB menu of sda1, since I have a direct boot of the kernel on sdb1 (hd1,0) as menu entry on sda1 (within GRUB).
However, when I boot from my 2nd HDD only (sda disconnected) or if I chainload GRUB LEGACY on hd1 through GRUB LEGACY on hd0 it just says:
Code:
Starting up disk...
GRUB
And freezes there.
If I regenerate GRUB LEGACY using "setup grub" function, it copies GRUB to sdb and all works fine! My grub menu is back on sdb.
But I want to be able to use dd to restore MBR, I don't want to be dependent from setting up grub all the time... I'm missing something or doing something wrong but I can't figure it out.
Here's what I do to (try to) restore the MBR from sda or from image to sdb:
Option #1
Code:
dd if=/dev/sda of=/dev/sdb bs=446 count=1 conv=notrunc,noerror
Option #2
Code:
dd if=/dev/sda of=/dev/sdb bs=446 count=1
Option #3
Code:
After imaging the working MBR with dd,
dd if=/img/MBR.img of=/dev/sdb bs=446 count=1 conv=notrunc,noerror
Option #4
Code:
After imagine the working MBR with dd,
dd if=/img/MBR.img of=/dev/sdb bs=446 count=1
Option #5
Code:
dd if=/img/MBR.img of=/dev/sdb
All 5 options do the same result and it's still unbootable (GRUB doesn't load menu).
What am I missing?
tnx!