Head check: Replacing zfs boot mirror

krby

New Member
Dec 9, 2024
21
4
3
For a home install, I salvaged two SATA SSDs from a another machine and one device doesn't come up every time. I have a couple of SATA M.2 drives of the "same" (same advertised size) size I can use so I'm thinking about just moving to those. Reading previous threads here and https://pve.proxmox.com/pve-docs/pve-admin-guide.html#sysadmin_zfs_change_failed_dev I think I understand the procedure, but wanted to lay it out and get a check before I proceed:
Current situation is I installed 8.3.1 fresh on an UEFI system on these two drives. I used ZFS, and the installer did the expected three partition thing.

NOTE: I'm using sda/sdb here as shorthand, I'll actually use the `/dev/disk/by-id` names for these devices in the commands. Here are the drives:
  • sda - current sketchy boot / rpool drive
  • sdb - current healthy boot/ rpool drive
  • newA - new M.2 drive
  • newB - new M.2 drive
I'm trying to be more cautious by adding the new devices before removing the old ones. Proposed procedure:

Bash:
sgdisk sdb -R newA
sgdisk -G newA

sgdisk sdb -R newB
sgdisk -G newB

zpool attach -f rpool newA_part3
zpool attach -f rpool newB_part3

proxmox-boot-tool format newA_part2
proxmox-boot-tool init newA_part2 [grub]

proxmox-boot-tool format newB_part2
proxmox-boot-tool init newB_part2 [grub]
Once the above is done, I will:
  • Shutdown and from BIOS force a boot from newA then newB.
  • Shutdown again pull the sda, sdb from the box
  • Boot, let the boot process do what it wants
  • Remove sda, sdb from rpool
  • Use proxmox-boot-tool clean --dry-run to confirm what it will do, then do it for real to remove the entries from the now disconnected sda and sdb.
Does this make sense?
 
Without executing it first: looks good, you are referencing the correct documentation :-)
zpool attach -f rpool newA_part3
Two remarks:

1) "-f" should not be necessary. Forcing something is always a bad idea, so start without it and add it only when it is clear that it is required.

2) the intermediate goal is to have four-way mirror, right? From your command it is not clear which specific vdev it should work on. As far as I remember the syntax is more like "zpool attach rpool sdb3 newA_part3" and the same again for the other new one "zpool attach rpool sdb3 newB_part3". (sdb being the intact half of the mirror, though sda should work too - the data which can not be read there will the read from the other half of the mirror.)

Instead of "attach" you could use "zpool replace rpool sdb3 newB_part3" in one step, but actually I also prefere the "attach additional" method.

Good luck!
 
Without executing it first: looks good, you are referencing the correct documentation :-)

Two remarks:

1) "-f" should not be necessary. Forcing something is always a bad idea, so start without it and add it only when it is clear that it is required.

2) the intermediate goal is to have four-way mirror, right? From your command it is not clear which specific vdev it should work on. As far as I remember the syntax is more like "zpool attach rpool sdb3 newA_part3" and the same again for the other new one "zpool attach rpool sdb3 newB_part3". (sdb being the intact half of the mirror, though sda should work too - the data which can not be read there will the read from the other half of the mirror.)

Instead of "attach" you could use "zpool replace rpool sdb3 newB_part3" in one step, but actually I also prefere the "attach additional" method.

Good luck!
Thanks for the review!
1) The `-f` was a copypasta from the replace command in Proxmox docs about replacing a failed boot device. Will remove!
2) Yes, intermediate goal is a 4-way mirror, test booting each new device, then removing the old devices. You're right about me missing the old device in the attach command. I'll add it. So my attach commands become:
"zpool attach rpool sda3 newA_part3"
"zpool attach rpool sdb3 newB_part3"

I got your point about it not really mattering if I attach to old dev sda or sdb since they're already in a mirror and I'm going to be removing them.
 
  • Like
Reactions: UdoB