1

My current HDD is failing and I've backed it up using dd. After restoring the images onto a new HDD, also using dd, the new system will not boot. It goes through the BIOS initialization, then screen goes black, and restarts and back through BIOS.

This is the old HDD setup:

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048   103426047    51200000   83  Linux
/dev/sda3       103426048   113666047     5120000   82  Linux swap / Solaris
/dev/sda4       113666048  1250263039   568298496    5  Extended
/dev/sda5       113668096   523268095   204800000   83  Linux
/dev/sda6       523270144   625670143    51200000   83  Linux
/dev/sda7       625672192  1250263039   312295424   83  Linux

/dev/sda1 is /boot

/dev/sda2 is /

I have dd'ed all these 2 partitions.

/dev/sda7 is /home Backed it up using rdiff-backup.

What am I missing and how could I correct this?

EDIT 1:

fstab

UUID=80c4cde7-b697-46d5-a376-24a6d6a725af /                       ext4    defaults        1 1
UUID=c1967ecb-839c-45d1-bf5b-bba046af3892 /boot                   ext4    defaults        1 2
UUID=c18998dd-0e60-4945-999f-1296b6e69307 /home                   ext4    defaults        1 2
UUID=78d39426-74d4-4299-b3ba-c9ab27a60e17 /mnt/m                  ext4    defaults        1 2
UUID=53574e4d-8af4-4aeb-bcf5-c74c7bbe4d7c /mnt/p                  ext4    defaults        1 2
UUID=3902f59a-f7a8-4ab8-896d-93642a09f083 swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0

EDIT 2:

I ended up dd'ing the MBR as DrGlitch mentioned in his answer. And also I had to manually modify the fstab to match the new partitions' UUID as shown by blkid.

6
  • Could you be losing the device UUID? Can we be shown a decaffeinated view of your fstab?
    – 41754
    Jul 4 '13 at 5:50
  • Have you done anything to install or re-init a bootloader on the new HD? Jul 4 '13 at 5:53
  • @UlrichSchwarz I've also tried to install the system then replace the partitions with my images.
    – slybloty
    Jul 4 '13 at 5:58
  • @uprego I've not done anything related to UUID. I've posted an edit including the fstab.
    – slybloty
    Jul 4 '13 at 6:06
  • tinyurl.com/nhncb4m hints a getter for the UUID, am not sure UUID would depend only on disk user contents.
    – 41754
    Jul 4 '13 at 6:14
2

As I see it, your new HDD lacks its Master Boot Record (MBR). That is why there's no GRUB coming up, and your system will simply report "OS not found!" or similar.

In order to transfer the old MBR to your new drive, you may want to take a look at this howto: http://www.cyberciti.biz/faq/howto-copy-mbr/

In short, it boils down to the following steps which I have shamelessly stolen from the above source:

  • root@machine:~# dd if=/dev/sda of=/tmp/mbrsda.bak bs=446 count=1

Assuming your old HDD is named "sda", this will effectively backup its bootsector to the file /tmp/mbrsda.bak.

  • root@machine:~# dd if=/tmp/mbrsda.bak of=/dev/sdb bs=446 count=1

In the above, all I altered from the original source was the value used for "bs", as I assume your new HDDs partition table to differ from the old HDD's, so I saw no need to back it up as well.

I hope this could help solving your issue.

0

You need to copy the boot loader, too (unless you boot from e.g. CD and reinstall it). This can probably be reached by copying all sectors before the first partition. But you may have to restore the partition table afterwards (or you leave it out when copying).

0

For UEFI+GPT partition, I tried checking BIOS setup, applying MBR backup from the other disk (if you backup/restored from/to the disk device (/dev/sda etc), but all these this turns out to be unnecessary. I replicated source system into 14 similar physical boxes, Restoring MBR alone after 'dd'ing the whole disk makes no difference. Now I understand the GRUB2 code in MBR must have embeded sth. specific to the old disk), I only need to reinstall grub:

  • Find any UEFI mode grub boot CD/USB dongle, boot into grub console (no need to boot into the live system, just press c on grub2 boot menu screen. Note: with grub1/grub4dos console, you can't see your GPT partition.)
  • Probe the disks by ls (hd<press tab>, find your original grub.cfg file. e.g. mine is located in (hd0,gpt1)/boot/efi/grub.cfg, then type configfile (hd0,gpt1)/boot/efi/grub.cfg. Now you just started your original system.
  • After your original system on new disk is booted, reinstall grub into the new disk's MBR, by issuing sudo grub-install /dev/sda0. (Usually /dev/sda0, but the disk code could differ. So if not sure, check which disk your system is on).
  • Remove the external boot device, reboot, and your system should boot now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.