How to move VM (including snapshots) to a new storage?

turnicus

Active Member
Jun 15, 2020
31
3
28
124
Hello,

I am using proxmox 6.2-4 on a single node. I did not use ZFS encryption at first, but I would like encrypt everything now. Unfortunately, it's impossible to encrypt existing ZFS datasets, so I just created new encrypted datasets to which I want to move my VM's now. So my storage configuration looks like:

IDTypeContentPath/TargetSharedEnabledBandwidth Limit
hddpool-type_zfsZFSDisk image, ContainerNoYes
hddpool-type_directoryDirectoryVZDump backup file, ISO image, Snippets, Container template/hddpool/proxmox_directories/type_directoryNoYes
hddpool-enc_type_zfsZFSDisk image, ContainerNoYes
hddpool-enc_type_directoryDirectoryVZDump backup file, ISO image, Snippets, Container template/hddpool/enc_proxmox_directories/type_directoryNoYes


  • the ID "hddpool-type_zfs" points to the non-encrypted dataset hddpool/proxmox_directories/type_zfs and "thin provision" is enabled
  • the ID "hddpool-enc_type_zfs" points to the encrypted dataset hddpool/enc_proxmox_directories/type_zfs and "thin provision" is enabled

So I would just like to move my VM's from hddpool-type_zfs to hddpool-enc_type_zfs. I tried using the "Move disk" button (VM -> Hardware -> Select HDD -> Move Disk) but it doesn't move the snapshots.

Could you please explain me how I can move EVERYTHING to the encrypted datasets?

Thanks for any help!
 
Last edited:
Do you really need the snapshots? I always just delete them and then move the the VM discs from one to another pool. If anything doesn't work and I need to restore a previous state I just use my backups.
 
Hello and thanks for your answers

Do you really need the snapshots?

Yes if possible, hence the whole point of this question!

I think the only way to to do it manually with "zfs send|zfs receiv" commands

This was my first idea and I tested it before creating this thread in this way:

- I moved the disk of the VM 110 with the GUI

- I "zfs send hddpool/proxmox_directories/type_zfs/vm-110-state-snap1 | zfs recv hddpool/enc_proxmox_directories/type_zfs/vm-110-state-snap1"

- I "zfs destroy hddpool/proxmox_directories/type_zfs/vm-110-state-snap1"

- I updated the new path of the snapshot in /etc/pve/qemu-server/110.conf

- I tried to rollback to snap1 with the GUI but I got an error "can't rollback, more recent snapshots exist".

I guess I should do it exclusively through the command line but what am I missing?
 
Last edited:
Hello,

OK, I think I found the correct way.

- step1 = shutdown VM via the GUI

- step2 = create a snapshot (called "ready_to_move" in this example) via the GUI

- step3 = send this snapshot recursively (with the -R flag) which will send the complete tree (snapshot + all previous snapshots + initial volume)
Code:
zfs send -R hddpool/proxmox_directories/type_zfs/vm-110-disk-0@ready_to_move | zfs recv hddpool/enc_proxmox_directories/type_zfs/vm-110-disk-0

- step4 = send the state volumes (states volumes are created when snapshotting an active VM with the "include RAM" checkbox ticked). You can list them with "zfs list"
Code:
zfs send hddpool/proxmox_directories/type_zfs/vm-110-state-snap2 | zfs recv hddpool/enc_proxmox_directories/type_zfs/vm-110-state-snap2

- step5 = update all paths in /etc/pve/qemu-server/110.conf

- step6 = start VM and test everything

- step7 = destroy the old volumes and snapshots (with the -r flag)
Code:
zfs destroy -r ssdpool/proxmox_directories/type_zfs/vm-110-disk-0

- step8 = destroy the state volumes
Code:
zfs destroy ssdpool/proxmox_directories/type_zfs/vm-110-state-snap2

Hope it helps!
 

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!