Move rpool (raidz1) to smaller disks

Jan 21, 2016
96
8
73
43
Germany
www.pug.org
Hello,

we have to migrate a rpool on a raidz, to smaller disks and asking for the best way.

At the moment we use 2 x Crucial M550 1TB (953.9GB) disks and want to switch to 2 x Samsung 960 1TB (894.3GB). The Samsungs are slightly smaller, so we can't just replace them. The next problem is, that the node has only two HDD slots, so I can't just add the new disks ...

So, the only way is USB or SSH .... If I use USB ... I think, I can't name the pool "rpool", because the name already exists ...

So, what is the best way to "clone" the complete rpool, so that I can switch the disks and add the second Samsung and have a working raidz again ?

cu denny
 
First i 've never done this. But it should work like this:
Code:
sgdisk -Z -o /dev/disk/by-id/XXX
sgdisk -Z /dev/disk/by-id/XXX
sgdisk -a1 -n1:34:2047 -t1:EF02 -n9:-8M:0 -t9:BF07 -n2:2048:0 -t2:BF01 -c 2:zfs /dev/disk/by-id/XXX
zfs snapshot rpool/ROOT/pve-1@migration
zfs send -v rpool/ROOT/pve-1@migration | zfs receive  newpool/datasetname
After that you must write grub:
Code:
update-grub2
grub-intall /dev/disk/by-id/XXX
And then you must say to the system it should boot from... for example: "rpoolnew". Never done this before. So search a little bit on oracle documentation.

This is on of our reasons why we install only the rpool on two extra SSD's. Everything is easier to do.
 
  • Like
Reactions: Denny Fuchs
hi,

here is, what I have done:
Requirements:

  1. Create USB Stick with ZFS on it: https://wiki.gentoo.org/wiki/User:Fearedbliss/Installing_Gentoo_Linux_On_ZFS
    I used this Image: http://list.zfsonlinux.org/zfs-iso/sysresccd-5.0.2_zfs_0.7.0.iso
  2. Connect the new SSD/Disk on the Laptop/PC
  3. sgdisk -Z -o /dev/disk/sdb
  4. sgdisk -Z /dev/disk/by-id/sdb
  5. Create the partitions GPT:
    sgdisk -a1 -n1:34:2047 -t1:EF02 -n9:-8M:0 -t9:BF07 -n2:2048:0 -t2:BF01 -c 2:zfs /dev/sdb
  6. Create the new "rpool" zpool, but with deactivated features, if needed (!!). Compare with zpool get all, otherwise you can't import the pool, because of new features, that ZFS version from PVE doesn't have.
    zpool create -d -o ashift=12 -o feature@sha512=disabled -o feature@skein=disabled -o feature@userobj_accounting=disabled rpool
On the target host, do:
  1. Shutdown all VMs (!)
  2. Remove the swapfs (!)
    swapoff
    zfs destroy -f rpool/swap
  3. Create the snapshot for the whole rpool
    zfs snapshot -r rpool@migration
  4. Connect both hosts via network
  5. copy / create SSH key from the host to the laptop/pc and test or use netcat version
  6. Copy now the whole rpool snaphot via SSH:
    SSH version: zfs send -Rv rpool@migration | ssh <laptop/pc> zfs receive -vF rpool
    Netcat version sender: zfs send -Rv rpool@migration | nc -w 20 <laptop/pc> 8023
    Netcat version receiver: nc -w 120 -l -p 8023 | zfs receive -vF rpool
After the copyjob is done, reinstall Grub on the new disk (Laptop/PC):
  1. zpool export rpool
  2. mkdir /bla
  3. zpool import -a -N -R /bla
  4. zfs mount rpool/ROOT/pve-1
  5. mount --bind /dev /bla/dev
  6. mount --bind /proc /bla/proc
  7. mount --bind /sys /bla/sys
  8. chroot /bla /bin/bash
  9. mv /boot/grub/grub.cfg /boot/grub/grub.cfg.migration
  10. update-grub
  11. grub-install /dev/sdb
  12. exit
  13. Create swapfs
    zfs create -o sync=always -o primarycache=none -b 4k -V 8G -o logbias=throughput rpool/swap
    mkswap -f /dev/zvol/rpool/swap
Now you can poweroff both hosts and replace/swap the disks. If all is done, the snapshot could be deleted on the new disk with zfs destroy -f rpool@migration and all other (zfs list -t snapshots)

The only problem I had, was the the ZFS version on the USB stick created a Zpool with features, the the PVE ZFS version doesn't have, so that it wasn't possible to import the Zpool with the PVE kernel. So I had to recreate and copy the whole system again.

@fireon Thanks for the sgdisk commands :)

Update:

In german, with a bit more text: https://www.pug.org/mediawiki/index.php/Zpool_migrieren
 
Last edited:
  • Like
Reactions: fireon

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!