Adding disk to run proxmox on a ZFS mirror

promoxer

Member
Apr 21, 2023
208
20
18
Code:
root@pve:/# ls -lha /dev/disk/by-id/
total 0
drwxr-xr-x 2 root root 720 Sep 20 21:36 .
drwxr-xr-x 8 root root 160 Sep 20 21:03 ..
lrwxrwxrwx 1 root root   9 Sep 20 21:36 ata-SAMSUNG_MZNTE256HMHP-000L7_S1KHNYAG111222 -> ../../sdb
lrwxrwxrwx 1 root root  10 Sep 20 21:36 ata-SAMSUNG_MZNTE256HMHP-000L7_S1KHNYAG111222-part1 -> ../../sdb1
lrwxrwxrwx 1 root root  10 Sep 20 21:36 ata-SAMSUNG_MZNTE256HMHP-000L7_S1KHNYAG111222-part9 -> ../../sdb9
lrwxrwxrwx 1 root root   9 Sep 20 21:03 ata-TS128GSSD360S_C634230853 -> ../../sda
lrwxrwxrwx 1 root root  10 Sep 20 21:03 ata-TS128GSSD360S_C634230853-part1 -> ../../sda1
lrwxrwxrwx 1 root root  10 Sep 20 21:03 ata-TS128GSSD360S_C634230853-part2 -> ../../sda2
lrwxrwxrwx 1 root root  10 Sep 20 21:03 ata-TS128GSSD360S_C634230853-part3 -> ../../sda3


......



root@pve:/# zpool status

  pool: rpool
 state: ONLINE
  scan: scrub repaired 0B in 00:01:14 with 0 errors on Wed Sep 20 21:21:45 2023
config:

        NAME        STATE     READ WRITE CKSUM
        rpool       ONLINE       0     0     0
          sda3      ONLINE       0     0     0

......

root@pve:/# zpool attach rpool sda sdb
cannot attach sdb to sda: no such device in pool
root@pve:/#


1. I would like my ProxMox to boot off and run on a ZFS mirror.
2. My rpool as above right now. It is sda3, does that mean that my ProxMox is not on ZFS?
3. I can't attach my sdb too (probably because I need to write zpool attach rpool sda3 sdb)

What should I do? Thank you.
 
Last edited:
Full details here https://r00t.dk/post/2022/05/02/proxmox-ve-7-replace-zfs-boot-disk/

Code:
# clone the sda partitions to sdb
sgdisk /dev/sda -R /dev/sdb
sgdisk -G /dev/sdb

# install proxmox onto sdb2 (make it bootable)
proxmox-boot-tool format /dev/sdb2
proxmox-boot-tool init /dev/sdb2
proxmox-boot-tool refresh

# attach new and detach old in 1 command (preferred)
zpool replace rpool sda3 sdb3

# attach sdb3 into the rpool (less preferred)
zpool attach rpool sda3 sdb3

# to detach a drive, e.g. sda (less preferred)
zpool detach rpool sda

# once sda is detached, it can be physically pulled after making sure sdb can boot
 
Last edited:
  • Like
Reactions: milew and news
My last question would be, do I just zpool detach rpool sda3 and pull sda out?
How can I be certain that it will boot from sdb when sda is gone?
 
Why would you want to detach sda3? I thought the intention was to use both disks as a mirror.
 
Hmm.. in preparation for the future when it dies...
If you just want to test what happens with a failed disk I would use the "zpool offline" command, then shutdown the server remove the cable, boot it.
Don't forget to put both disks in the UEFI boot order. If the system boots you can connect the cable again and use the "zpool online" command to enable that second vdev again.