Notes partitionnement

Voir Partitionnement - Aide mémoire : parted, fdisk, sfdisk, gdisk, sgdisk

parted

parted --script -a optimal /dev/device mklabel gpt mkpart primary 0% 100%
parted --script -a optimal /dev/device rm 1

luns=`ls|grep -v control` for i in $luns do parted -a optimal -s -- /dev/mapper/$i mklabel gpt mkpart primary xfs 0% 100% done

https://pure-storage-openstack-docs.readthedocs.io/en/wallaby/swift/section_swift-partitioning.html

You can verify that the partition was successfully created and is properly aligned by using the parted command:

# parted /dev/mapper/3624a937043be47c12334399b00016d73 align-check optimal 1
1 aligned

sgdisk (compatible GPT)

Backup the table of /dev/sda:

sgdisk --backup=table /dev/sda

Restore the table to the new disk:

sgdisk --load-backup=table /dev/sdb

Backup and Restore from /dev/sda to /dev/sdb in one command:

sgdisk -R /dev/sdb /dev/sda

Finally randomize the GUID of all partitions on the disk:

sgdisk -G /dev/sdb

Method for MBR-TablesCopy table from /dev/sda to /dev/sdb:

sfdisk -d /dev/sda | sfdisk /dev/sdb

(Optional)If you don’t see the partitions, read it again:

sfdisk -R /dev/sdb