On Mon, May 21, 2018 at 12:24:09AM +1000, Russell Coker wrote:
> You have to be careful when using dd on disk images as matching UUIDs cause
> problems.
>
> Also for RAID configurations using the DOS partition table you can use "dd
> if=sda of=sdb bs=1024k count=10" to copy the partition table and boot loader
> configuration to a new disk.  But that causes big problems with GPT.
>
> As an aside does anyone know of a fdisk type program that makes it easy to
> copy the partition layout from one disk to another?

˙sfdisk˙ works for both MBR and GPT partition tables now:

   # sfdisk -d "/dev/$source" | sfdisk "/dev/$target"

Then you have to change the UUIDs on the partitions with a loop around
something like:

    # sfdisk --part-uuid "/dev/$target" "$partition-number" "$(uuid)"

BTW, from the man page:

    "Since version 2.26 sfdisk supports MBR (DOS), GPT, SUN and SGI disk
     labels, but no longer provides any functionality for CHS
     (Cylinder-Head-Sector) addressing.  CHS has never been important for
     Linux, and this addressing concept does not make any sense for new
     devices."



'sgdisk˙ works for GPT only, but also has a useful option to randomise the
UUIDs:

    # sgdisk --replicate="/dev/$target" "/dev/$source"
    # sgdisk --randomize-guids "/dev/$target"

Note that sgdisk's --replicate option argument is the target, not the source
drive. ІMO that's confusing and it should be the other way around, but it is
what it is.

From the man page:

    -R, --replicate=second_device_filename

    Replicate the main device's partition table on the specified second
    device.  Note that the replicated partition table is an exact copy,
    including all GUIDs; if the device should have its own unique GUIDs, you
    should use the -G option on the new disk.

    -G, --randomize-guids

    Randomize the disk's GUID and all partitions' unique GUIDs (but not their
    partition type code GUIDs).  This function may be used after cloning a
    disk in order to render all GUIDs once again unique.


craig
_______________________________________________
luv-main mailing list
[email protected]
https://lists.luv.asn.au/cgi-bin/mailman/listinfo/luv-main

Reply via email to