Table of Contents

Move proxmox to another disk (ZFS) - INCOMPLETE

Moving proxmox to another disk is not that straight forward. If the new disk is different size you can't just copy the whole disk. Here is how you can do that.

Warning

This is not a trivial task. Having knowledge on zfs will help. It would be nice to experiment on a virtual machine before doing it on an actual proxmox install.

1. Backup

You can backup the rpool using zfs send. First you need to boot ubuntu live (zfs on Debian does not recognize some of proxmox rpool features). After ubuntu boots open terminal and:

sudo su -
apt update
apt install openssh-server net-tools zstd -y

Install zfs

apt install zfsutils-linux zfs-dkms

then change the password:

passwd

then

vim /etc/ssh/sshd_config

add

PermitRootLogin yes

and save

service sshd restart
ifconfig

note the ip address and you can login remotely in order to be albe sit comfortably, open this manual and copy/paste

cd /mnt
mkdir -p backup

Plug a usb disk or mount network share to /mnt/backup. now import the rpool

zpool import –R /mnt/rpool rpool

now make a backup of the pool:

zfs send rpool |zstd -5 -T0 >/mnt/backup/proxmox-zfs-send.img.zst

After backup is done export the pool and unmount backup disk/network share

umount /mnt/backup
zpool export rpool

Shutdown and remove the disk.

2. Copy proxmox to the new disk

Place the new disk. install fresh copy of proxmox and update it.

Shutdown and plug the old disk (if it's nvme and you don't have second NVMe slot you can use usb to NVMe adapter or PCIe to m.2).

Boot to Ubuntu live again and do all the steps from the previous chapter to enable yourself to use ssh, but don't import any pools yet.

Run lsblk to see which disk which is your disk. If you can't recognize it based on size alone you can check each disk's serial number:

smartctl -i /dev/nvme2n1|grep -i serial
Serial Number:                      S3TNNF0K938696

run

zpool import

to see the list of pools. You'll see something like:

   pool: rpool
     id: 9353721585537995636
  state: ONLINE
status: The pool was last accessed by another system.
 action: The pool can be imported using its name or numeric identifier and
        the '-f' flag.
   see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-EY
 config:

        rpool       ONLINE
          sda       ONLINE

Note that there are two pools named 'rpool'. Once you figured out which is your old pool import it like this (you have to use the id instead of the name):

zpool import -R /mnt/old <old pool id> oldrpool
zpool import -R /mnt/new <new pool id> rpool

Record mountpoints (or better use a flash drive or network share so you don't loose it on reboot)

zfs list >/mountpoint-backup.txt

create snapshot to send to the new pool

zfs snapshot -r rpool@move

now you need to remove mount points because zfs will fail to copy the pool:

zfs set mountpoint=none rpool/ROOT
zfs set mountpoint=none rpool/data
zfs set mountpoint=none rpool/var-lib-vz
zfs set mountpoint=none rpool

I haven't tried this, so not sure if it'll work - copy the root dataset:

zfs send -R rpool@move | zfs receive -F rpool

If it doesn't work you have to copy each second level dataset individually

zfs send -R rpool/ROOT@move | zfs receive -F rpool/ROOT
zfs send -R rpool/data@move | zfs receive -F rpool/data
zfs send -R rpool/var-lib-vz@move | zfs receive -F rpool/var-lib-vz

the receiving dataset must not have snapshots. If it has, you need to delete them before copying. That can happen if you need to copy again. to delete snapshot:

zfs destroy -r rpool@move

Fix new machine - ToDo

  1. boot
  2. /etc/zfs/zpool.cache → zpool.cache.bak
  3. rm -f /etc/zfs/zpool.cache
  4. zpool set cachefile=/etc/zfs/zpool.cache rpool
  5. update efi disk id in /etc/kernel/proxmox-boot-uuids (lsblk -o NAME,MOUNTPOINT,UUID,FSTYPE then find /dev/disk -name 17A5-7881)
  6. proxmox-boot-tool refresh
  7. next reboot will fail. just do zpool import rpool then exit