Possible Error In Proxmox ZFS Wiki?

mhayhurst

Well-Known Member
Jul 21, 2016
108
5
58
43
Hello Everyone,

In the ZFS: Tips and Tricks Wiki about 3/4 the way down discussing copying the partition table, it appears the syntax for the sgdisk command is wrong:
Code:
root@pve:~# sgdisk --replicate=/dev/sdb /dev/sda
/dev/sdb is the failed disk and in this example we are suppose to be copying the /dev/sda partition table to /dev/sdb. Am I correct or has my coffee not kicked in yet?
 
no, it is correct ;) although a more readable variant might be
Code:
sgdisk /dev/source --replicate /dev/target
to keep with the established source first, target second semantics of most UNIX commands.. getopts and thus sgdisk does not care about the order..
 
  • Like
Reactions: GadgetPig
I had the same thoughts when I first read these steps.

I found some info here:

https://askubuntu.com/questions/579...rtition-scheme-from-one-hard-drive-to-another

From what I understand, bootable ZFS pool uses only 2 disks? So you copy from good boot disk to new target disk:

sgdisk --replicate=/dev/target /dev/source
or
sgdisk -R/dev/target /dev/source

And then sgdisk -G /dev/sdb (randomize the disk's GUID and all partitions' unique GUIDs)

They mentioned another method which I really liked:

sgdisk --backup=table /dev/sda (backup table from good source ZFS boot disk)
sgdisk --load-backup=table /dev/sdb (load table to new target ZFS boot disk)
sgdisk -G /dev/sdb (randomize target ZFS boot disk's GUID and all partitions' unique GUIDs)

If someone can confirm this looks right, I had WAY too much coffee this AM ;)

[EDIT]
Thank You Fabian for your post, it makes much more sense:
"sgdisk /dev/source --replicate /dev/target"
 
Last edited:
From what I understand, bootable ZFS pool uses only 2 disks? So you copy from good boot disk to new target disk:

That's right.

Using disks all the same size, what I do is set the host with 2 disks as ZFS RAID 1. Change the pool to use IDs. Then add 2 more disks and issue the following commands (Using /dev/sdX and /dev/sdY as example for the new drives):
Code:
# Replicate existing disk (Normally /dev/sda or /dev/sdb)
sgdisk /dev/sda -R /dev/sdX
sgdisk /dev/sda -R /dev/sdY

# Randomize GUIDS
sgdisk --randomize-guids /dev/sdX
sgdisk --randomize-guids /dev/sdY

# Install GRUB
grub-install /dev/sdX
grub-install /dev/sdY

# Find the ID of the second partition(data) in /dev/disk/by-id (-part2)
ll /dev/disk/by-id/

# Add them to the pool
zpool add rpool mirror scsi-3600508b1001cea190e6d735e752-part2 scsi-3600508b1001c345f2ba190e6d735e752-part2

# Confirm everything is fine
zpool status

Now all your drives should be bootable and with the same partition scheme.
 
  • Like
Reactions: GadgetPig
no, it is correct ;) although a more readable variant might be
Code:
sgdisk /dev/source --replicate /dev/target
to keep with the established source first, target second semantics of most UNIX commands.. getopts and thus sgdisk does not care about the order..

Yes, thank you fabian for the clarification!
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!