Hi,
In the PVE web UI when cloning a VM there is an option to use a specific snapshot.
I wanted to avoid having to create a VM clone since it does a full copy of the disks and this is not practical for some large VM disks in our infrastructure.
I ended up with the rbd + qm commands below to mount as new disk the snapshot "testsnap1" of VM 390 (testkernel).
Did I miss a UI for doing what I did?
If not is it on the roadmap to add such a feature?
Thanks!
In the PVE web UI when cloning a VM there is an option to use a specific snapshot.
I wanted to avoid having to create a VM clone since it does a full copy of the disks and this is not practical for some large VM disks in our infrastructure.
I ended up with the rbd + qm commands below to mount as new disk the snapshot "testsnap1" of VM 390 (testkernel).
Did I miss a UI for doing what I did?
If not is it on the roadmap to add such a feature?
Thanks!
Code:
root@pve:~# qm config 390
agent: 1
boot: c
bootdisk: scsi0
memory: 2048
name: testkernel
net0: virtio=BA:34:B8:8A:13:1C,bridge=vmbr0,tag=16
parent: testsnap1
scsi0: ceph1:vm-390-disk-0,size=8G
scsihw: virtio-scsi-pci
serial0: socket
smbios1: uuid=90dd8537-7bfb-40cb-a8b8-149670b8a9e3
vga: serial0
vmgenid: 77ca7f81-7655-474b-9ff1-92f9e1b16c36
root@pve:~# rbd snap list ceph1/vm-390-disk-0
SNAPID NAME SIZE PROTECTED TIMESTAMP
326 beforekernel 8 GiB Tue May 24 16:15:59 2022
658 testsnap1 8 GiB Mon Nov 7 10:55:53 2022
root@pve:~# rbd snap protect ceph1/vm-390-disk-0@testsnap1
root@pve:~# rbd clone ceph1/vm-390-disk-0@testsnap1 ceph1/vm-390-disk-1
root@pve:~# qm rescan --vmid 390
rescan volumes...
VM 390 add unreferenced volume 'ceph1:vm-390-disk-1' as 'unused0' to config
root@pve:~# qm set 390 --scsi1 ceph1:vm-390-disk-1,discard=on,ssd=1
update VM 390: -scsi1 ceph1:vm-390-disk-1,discard=on,ssd=1
root@testkernel:~# mkdir /mnt/testsnap1
root@testkernel:~# mount -o ro /dev/sdb1 /mnt/testsnap1
root@testkernel:~# ls -l /mnt/testsnap1/
total 76
lrwxrwxrwx 1 root root 7 10 mars 2022 bin -> usr/bin
drwxr-xr-x 4 root root 4096 24 oct. 06:38 boot
drwxr-xr-x 4 root root 4096 10 mars 2022 dev
drwxr-xr-x 74 root root 4096 7 nov. 06:35 etc
...
root@testkernel:~# umount /mnt/testsnap1
root@pve:~# qm unlink 390 --idlist scsi1
update VM 390: -delete scsi1
root@pve:~# qm unlink 390 --idlist unused0
update VM 390: -delete unused0
Removing image: 1% complete...
...
Removing image: 99% complete...
Removing image: 100% complete...done.
root@pve:~# rbd snap ls ceph1/vm-390-disk-0
SNAPID NAME SIZE PROTECTED TIMESTAMP
326 beforekernel 8 GiB Tue May 24 16:15:59 2022
658 testsnap1 8 GiB yes Mon Nov 7 10:55:53 2022
root@pve:~# rbd snap unprotect ceph1/vm-390-disk-0@testsnap1
root@pve:~# rbd snap ls ceph1/vm-390-disk-0
SNAPID NAME SIZE PROTECTED TIMESTAMP
326 beforekernel 8 GiB Tue May 24 16:15:59 2022
658 testsnap1 8 GiB Mon Nov 7 10:55:53 2022