Questions tagged [sgdisk]

Questions about the command-line component of GPT fdisk (aka gdisk) intended to be used in scripts. For interactive use see gdisk.

6 questions
12
votes
1 answer

How can I quickly copy a GPT partition scheme from one hard drive to another?

On a non GPT partition table I can do sfdisk -d /dev/sda | sfdisk /dev/sdb But sfdisk doesn't support GPT partition tables. What can I use instead? I'm looking for a one or two command solution, not just using GNU parted to output the partition…
Kris Harper
  • 381
  • 2
  • 7
9
votes
1 answer

Script to gdisk /dev/sdX and enter expert commands: x, z, y, y - how?

I am creating my first Arch Linux install script, and I want to automate the base installation as in the archwiki or you can find the same instructions but easier to read here: https://www.gloriouseggroll.tv/arch-linux-efi-install-guide/ I wish to…
Spacecow
  • 183
  • 2
  • 7
2
votes
1 answer

script to gdisk to create a new partition

I'm trying to script to gdisk to create a new partition of LVM type (for pvcreate) so I typed this but I does not work : diskModelName=yourDiskModel diskSerialNumber=yourDiskSerialNumber lvmPartitionNumber=2 cat<<-EOF | sudo gdisk…
SebMa
  • 1,941
  • 4
  • 22
  • 37
2
votes
2 answers

sgdisk: Force alignment of end sector

I am trying to get sgdisk to create partitions that align on 1 MB. This is easy for the starting sector (using -a), and for the ending sector, if I choose the size. But if I let sgdisk choose the ending sector I end up with something like: Device …
Ole Tange
  • 33,591
  • 31
  • 102
  • 198
1
vote
1 answer

Attempted to replicate partition table to replacement RAID1 disk, but source partition table now empty

I had a disk (/dev/sda) show signs of eventual failure in a RAID1 array, so I failed and then removed it from the array. I then replaced the disk, booted back up, and began the process of replicating the partition in order to add the disk to the…
Luke Pittman
  • 111
  • 2
1
vote
1 answer

How to determine sizes using sgdisk partitioning in bash script

I'm using sgdisk in a bash script similar to this: sgdisk --clear /dev/vda --set-alignment=1 --new 1:34:2047 --typecode 1:EF02 -c 1:"grub" -g /dev/vda sgdisk --new 2:2048:16779263 --typecode 2:8300 -g /dev/vda sgdisk --new 3:16779264:20971486…
BugBuddy
  • 618
  • 1
  • 10
  • 19