Copying partition table

I need to copy partition table for sda, I have 3 primary partitions and 1 extended partition on sda. I understand that fdisk cant copy extended partition table and I need to use sfdisk.

Correct me if I am wrong -

  1. For primary partitions
dd if=sda-mbr.bin of=/dev/sdX bs=1 count=64 skip=446 seek=446
  1. For extended partition
sfdisk -d /dev/sda2 > backup-sdX.sf

Where it will store the files after backing them up. I tried SUSE 11.2 DVD, it has back up partition table utility under repairs-advanced options but it suggests saving partition table to floppy. Why it doesnt offer to save it on a removable medium or to CD.

Best,

David

You can use sfdisk to dump this info in a readable format which can be used as input to sfdisk again.

       -d     Dump the partitions of a device in a format useful as  input  to
              sfdisk. For example,
                  % sfdisk -d /dev/hda > hda.out
                  % sfdisk /dev/hda < hda.out
              will correct the bad last extended partition that the OS/2 fdisk
              creates.

This option is particularly useful for duplicating the partition table of the working disk of a RAID1 pair to a replacement.

Thanks, ken_yap; will try that soon.

Secondly, I need to clone the hard disk, what tools i should use.

On 2010-11-06 09:06, avenuemax wrote:
>
> Thanks, ken_yap; will try that soon.
>
> Secondly, I need to clone the hard disk, what tools i should use.

Exact copy, dd. Otherwise, perhaps ghost for linux.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)