Snapshotting Virtual Machines

renss78

Member
Aug 26, 2015
26
1
23
Hello all,

I have a question about the snapshot feature in ZFS. Forgive me if this is allready a discussed topic but i'm wandering the internet for this problem a while.

I'm currently using Proxmox for my virtual machines(VM). My VM's are currently in RAW format running on my ZFS Datapool.
I want to make snapshots of the different VM's i'm running. I found out that i can use ZFS to make snapshots of the VM's and i know that i need to make a ZVOL virtual block device.

I'm left in the dark concerning how to create a ZVOL virtual block device from a VM in Proxmox.
I'm well aware how to create a block device but idk how to connect/couple the block device with a VM.

Best regards,

Rens
 
Hi,
If you are using zfspool plugin all this will done by the plugin.
 
If you create a disk in the GUI for a VM and select zpool as storage a block device will create on zfs.
and also automatically used (connect).
 
If you create a disk in the GUI for a VM and select zpool as storage a block device will create on zfs.
and also automatically used (connect).

Ah i tested it and it works, great!

But we are migrating from a esxi environment, we have disks in "vmdk" format. The method you described above is only allowing RAW format. That's a good thing(and logical because it is a block device, since ZFS can only snapshot block devices).

I know how to convert the "vmdk" format to RAW format but than there is no block device present at the zpool for snapshotting.

Best regards,

Rens
 
Something along the line of (on the command line):
qemu-img convert -f vmdk -O raw server.vmdk server.raw

PS. If the vmdk file is split over several files you will need to merge them in to one vmdk by the use of vmware tools before using qemu-img.
 
Ah i tested it and it works, great!
I know how to convert the "vmdk" format to RAW format but than there is no block device present at the zpool for snapshotting.

In the GUI for your VM, on the Hardware tab select the existing attached disk. Either VMDK or RAW format, does not matter. Click the "move disk" option and select your ZFS storage as the target and let it run. It will do the right thing. You can do this even while the VM is running it seems.
 
Something along the line of (on the command line):
qemu-img convert -f vmdk -O raw server.vmdk server.raw

PS. If the vmdk file is split over several files you will need to merge them in to one vmdk by the use of vmware tools before using qemu-img.

Yes i was aware of this workaround, it works great.

In the GUI for your VM, on the Hardware tab select the existing attached disk. Either VMDK or RAW format, does not matter. Click the "move disk" option and select your ZFS storage as the target and let it run. It will do the right thing. You can do this even while the VM is running it seems.

This sounds great and i guess this could be the solution, i will test it today and post the results :)
 
Ah yes it works! Thank you.

But another problem is moving in... i cannot rollback to a snapshot while the VM is live...(Should i create a new Thread?)

xx@xx:/# zfs rollback datapool/vm-100-disk-1@27-08-2015_09:52
cannot rollback 'datapool/vm-100-disk-1': dataset is busy

And yes.. they are not readonly:

xx@xx:/# zfs get all | grep readonly
datapool readonly off local
datapool/vm-100-disk-1 readonly off inherited from datapool

Beste regards,

Rens
 
you should not use zfs command.
all will done by qm command or by the gui.

It is not possible to rollback if the vm if it is running on storage level.

use
Code:
 qm rollback <vmid> <snapname>
 
Well, why did i use ZFS to make snapshots in the first place?

Code:
 qm rollback <vmid> <snapname>
I can't use the given command because that is intended to use snaps created in ProxMox. My snapshots are on file system level, created by ZFS.
The option "Take Snapshot" in the gui is grayed out because i use the RAW format(thats what i'm thinking).

Is there a way to recover to ZFS snapshots via the GUI? or is this a complete different technique based on the qcow2 format.

Another idea is to send all snapshots to another ProxMox server... if the main server fails the other ProxMox server will contain all the snapshots and recover the VM's. But in that case i need to make a full cloned copy first? and later on incrementally make snapshots and send them to the remote (backup) server. Got any idea's on this matter?. In this last scenario i do not need to Rollback any live VM's on the station... they are simply used for backup purpose only.

Best regards,

Rens
 
As far I understand you are using ZFS but the dir plugin.
This make no sense for KVM VM!

You should add a new storage what is a type "zfs" Storage.
Then you can migrate your machine to this storage with move disk.
And the everything is working as you want form the gui.
 
As far I understand you are using ZFS but the dir plugin.
This make no sense for KVM VM!

You should add a new storage what is a type "zfs" Storage.
Then you can migrate your machine to this storage with move disk.
And the everything is working as you want form the gui.

Hmmm, no my VM's are located on the type "zfs" as storage. See the screenshot i uploaded..

Screenshot_3.jpg
 
Can you please send the output of

Code:
Cat /etc/pve/qemu-server/100.conf
 
Excuse for my late reaction, here is the output of the give command:

xx@xx:~# cat /etc/pve/qemu-server/100.conf
bootdisk: ide0
cores: 4
cpu: host
ide0: datapool:vm-100-disk-1,cache=writethrough,size=32G
ide2: ISO:iso/xxxx.iso,media=cdrom
memory: 8192
name: Windows-7-x.x.x.x
net0: e1000=x:x:x:x:x:x,bridge=vmbr0
numa: 0
ostype: win8
smbios1: uuid=68003cf4-092e-4f0e-9ec5-572dc4b19e86
sockets: 2
unused0: VMs:100/vm-100-disk-2.raw

Best regards,

Rens
 
You can not make a snapshot because you have a disk in your config witch is not capable of snapshots.
 
Yes the unused has no snapshot capacity.
 
I shut down the machine,
Removed the unused hard disk

But now the VM can't start with the following message(all VM's cannot start).

"storage 'datapool' does not exists (500)", i think this came because i moved the disk to the correct pool(zfspool).

When i install a fresh machine in the correct way, snapshotting is indeed possible. But now i have virtual machines that won't start because it say datapool not exist. Any ideas on this matter?
 

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!