Mailinglist Archive: opensuse (882 mails)

< Previous Next >
Re: [opensuse] booting from a duplicated hard disk
  • From: "David C. Rankin" <drankinatty@xxxxxxxxxxxxxxxxxx>
  • Date: Thu, 30 Dec 2010 14:51:37 -0600
  • Message-id: <4D1CF0D9.6000300@xxxxxxxxxxxxxxxxxx>
On 12/30/2010 12:11 PM, Per Jessen wrote:
Sampsa Riikonen wrote:

Dear List,

I have duplicated my hard disk using "dd", including the boot
partition to another hard disk (a sata drive in a usb box). Now I am
trying to boot from this duplicated disk, but nothing happens.. grub
does not start at all.

Hi Sampsa

using dd for copying a harddisk assumes source and target are the same,
which I am guessing yours are not. You might fare better by copying
across the contents of the filesystem(s), e.g. using rsync, and
(re-)preparing the target drive for booting.

Well that depends...

Using dd will copy the filesystems/partitions from one device to
another. dd
should work without an issue as long as the target drive is greater or equal to
the size of the source. If you want to grow the file system after the dd copy,
the copy a partition, then use gparted (or the like) to grow the partition
before copying the next one.

I have successfully moved Linux installs, windows installs and
virtualbox VDI's
that way. After you move the partitions to a new disk, you still may need to
boot with the install disk because the grub device designations will surely have
changed. (/dev/disk/by-id, etc..)

Here are my notes for 'dd copy MBR and/or Partition Table'

MBR is divided into 3 sections:

1. Bootstrap . 446 bytes
2. Partition table. 64 bytes
3. Signature. 2 bytes

Copy MBR & Partition Table: (only for same sized partitions)

dd if=/dev/sda of=/dev/sdb bs=512 count=1

Copy MBR only:

dd if=/dev/sda of=/dev/sdb bs=446 count=1

Make a backup first:

Here’s what I do to copy just the MBR from a hdd:

dd if=/dev/sda of=mbrbackup bs=512 count=1

Now to restore the image to any hdd:

dd if=mbrbackup of=/dev/sdb bs=446 count=1

Backing up and restoring the MBR and boot sector(s):

It is very easy to back up these essential parts of your disk. You will need
to copy (part of) the MBR, and boot sectors in order to have your new system
boot like the old one.

To save the MBR to a file (this contains the partition table too):

dd if=/dev/hda of=hda-mbr-full bs=512 count=1

To save the MBR, without the partition table, to a file:

dd if=/dev/hda of=hda-mbr-nopart bs=446 count=1

To save a boot sector (e.g. partition 3) to a file:

dd if=/dev/hda3 of=hda3-bootsect bs=512 count=1

Good luck :p

David C. Rankin, J.D.,P.E.
Rankin Law Firm, PLLC
510 Ochiltree Street
Nacogdoches, Texas 75961
Telephone: (936) 715-9333
Facsimile: (936) 715-9339
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups