Proxmox ZFS Migration

sammeeeeeee

New Member
May 11, 2024
8
2
3
Hi,

I have proxmox running on ZFS RAID1 on 2 disks.

I would like to replace both disks (with higher quality disks of equivilant size)

Please advise which is the best method of these - or if i should use an alternate method.

A. zpool replace

1. Partition new disks
Bash:
sgdisk --replicate=/dev/sdc /dev/sda
   sgdisk --randomize-guids /dev/sdc

   sgdisk --replicate=/dev/sdd /dev/sdb
   sgdisk --randomize-guids /dev/sdd

   partprobe /dev/sdc
   partprobe /dev/sdd

2. Replace disk 1

Bash:
OLD1=$(blkid -s PARTUUID -o value /dev/disk/by-id/…-sda2)
   zpool replace rpool \
     /dev/disk/by-partuuid/$OLD1 \
     /dev/disk/by-partuuid/$OLD1

3. Replace disk 2

Bash:
OLD2=$(blkid -s PARTUUID -o value /dev/disk/by-id/…-sdb2)
   zpool replace rpool \
     /dev/disk/by-partuuid/$OLD2 \
     /dev/disk/by-partuuid/$OLD2

4. Chroot into new root and install GRUB on each new disk’s ESP

Bash:
mount --bind /dev  /mnt/new/dev
   mount --bind /proc /mnt/new/proc
   mount --bind /sys  /mnt/new/sys
   chroot /mnt/new /bin/bash -l

   for disk in /dev/disk/by-id/…-sdc /dev/disk/by-id/…-sdd; do
     grub-install --target=x86_64-efi \
                  --efi-directory=/boot/efi \
                  --bootloader-id="proxmox" \
                  --recheck "$disk"
   done
   update-grub


5. Reboot


B. Force repair
Pull one disk, use the new one as a replacement, repeat.

C. Clonezilla or other options
Essentially, shut down the system and just clone each disk. My much preferred option, but apparently not good with ZFS due to GUID's.


Thanks in advance,
Sam
 
Please advise which is the best method of these - or if i should use an alternate method.

this is fairly straightforward.

step 1: ensure autoexpand is enabled: zpool set autoexpand=on rpool
step 2: use the instructions here to replace the first disk: https://pve.proxmox.com/wiki/ZFS_on_Linux#_zfs_administration
step 3: either wait for rebuild to complete, OR follow the instructions to ADD the new disk instead of replacing the existing.
step 4: when you have 3 healthy disks in the vdev, remove the last remaining (small) disk.

done.
 

Update: This is what I did:​

Bash:
 # Run this for each disk:

sgdisk -R /dev/by-id/new_disk /dev/by-id/old_disk
sgdisk -G /dev/by-id/new_disk

zpool replace -f rpool /dev/disk/by-id/old_disk-part3 /dev/disk/by-id/new_disk-part3

proxmox-boot-tool format /dev/disk/by-id/new_disk-part2
proxmox-boot-tool init /dev/disk/by-id/new_disk-part2

And then proxmox-boot-tool refresh and proxmox-boot-tool clean.

If you are using an adapter or something that messes with the /dev/disk/by-id name like ID, use WWN ID.



Thanks for the assistance alexskysilk and thearona for the useful resources.
 
  • Like
Reactions: UdoB