Snapshots for KVMs

Hello Eric, Jamie

Let me begin by saying that i do not have the entire understanding of LVMs.. but let me try to get to what i am trying to do.
I have installed cloudmin on a host machine only this time with LVMs instead of traditional EXT4 partitions. i have boot, swap and only root. now i thought that after this if i would install cloudmin and run KVMs, i would be able to snapshot them..
but looks i am wrong, i have gone thru https://www.virtualmin.com/documentation/cloudmin/snapshot

this link and the first requirement
" The primary disk and all additional disks to be included in the snapshot must be stored in LVM logical volumes. Because snapshotting makes use of LVM's snapshot feature, it cannot be performed on regular files. "

Which disks are we talking about here the host disks or the guest disks? confused_?

Status: 
Active

Comments

The guest disks - typically you're host system would have a large volume group, in which Cloudmin will create logical volumes for guest disks. The same VG can also be used for the host filesystem, but that's not strictly required.

You may need to re-install the host system. The best setup if you have say a 4 TB disk is to use is all in a single LVM volume group, and in that create a logical volume of say 200 GB for the root filesystem. The rest of the space can then be used by Cloudmin for VM disks.

Seems like a bit complicated setup for getting snapshots to work.. btw, its seems this is only for KVMs, so LXC guest systems cannot have snapshots.. would that be correct?
Additionally, it made think about how virtualmin manages incremental backups.. is there no way we could do it for KVM or Cloudmin backups? similar to incremental backups.. .. i assume not :) or else it would have been implemented already. just trying to think, if all this worth the hazzle..

Ok here is my plan. i have 2 HDD 2.75 TB each.. going to be on RAID1 so that i have redundancy.
on that RAID, first partition of 1gb for /boot, then a VG0 consisting of the logical volumes of 16Gb for Swap, 1.5GB for root (which will be used to store backups and host disks for LXCs) and leave the rest of the VG0 empty.

so when the a new KVM would be setup using LVM, it will be create a new physical volume. which then will be able to be snapshoted, i guess in the /home folder.

That seems reasonable. Or better still, assuming you disks are /dev/sda and /dev/sdb, partition each into 1 gb for boot, and the rest of LVM.

Combine /dev/sda1 and /dev/sdb1 to create a RAID1 volume that will be mounted at /boot . This provides redundancy to allow booting even if one disk fails.

Combine /dev/sda2 and /dev/sdb2 into a RAID1 volume that then has an LVM volume group on top of it. Within that, create an LV of say 100 GB for root, another of 16 GB for swap, and leave the rest empty.

Cloudmin can then create LVs within the VG for VM disks. Snapshots are actually special LVs that can be quickly created and reverted to - they don't go in /home.

Yeah that the plan for the /boot.. it be on RAID1 on both disks..
i will still leave some 1TB for root.. as i need some space to use for FTP backups / images / stores virtualmin backups from others server, etc.. i would be happy with with the rest of the space to leave for just KVM and snapshots. if LXCs could have been setup with LVMs, that would have been a perfect setup.. BTW proxmox LXCs can be snapshot-ted, they seem to use something called thin LVM pool for something.

Cloudmin does support LXC on LVM, but doesn't yet support snapshotting of LXC containers.

Percent of virtual disk to allocate

i am not very clear about this function, does this mean that 20% of the virtual guest disk will be snapshoted or or it mean that 20% will be ustilized for the snapshot ..

It means 20% will be used for the snapshot. This means that if more than 20% of the VM's disk contents change, the snapshot will be come invalid.

This is confusing haha.. I was under the impression, if u snapshot, u can always go back to that snapshot..
anyway, next to snapshot id, is there a possibility to get a text field so that some comments can be captured?

Incase you would want to go revert to a particular snapshot, the comment might help?

If you want a snapshot that will last forever, you need to enter 100% as the size. Unfortunately in LVM there's a tradeoff between snapshot size and longevity.

Thanks for the info, This is something which i am going to play with in the coming days.. its would have been awesome if you could get the LXC snap shotting in the next release.. i am all game for testing..

just adding to this thread, after i have taken a snapshotted and reverted back to this snapshot.. it seems nothings has reverted ? am i doing something wrong ?

And an error while taking a backup, Creating LVM snapshots for disks of virtualmin.interstellarconsulting.com ..

.. backup failed : Snapshot of /dev/vg0/virtualmin_cloudmin_interstellarconsulting_com_img failed : Snapshots of an origin that has a merging snapshot is not supported

masterg0g0 - that error happens when taking a backup of a clone that was itself created using snapshotting. The next Cloudmin release will deal with this situation properly.

well, hopefully you guys will release it soon.

would really like to get this fixed, when is the next cloudmin version planned to be released?

Creating snapshot of system virtualmin.interstellarconsulting.com .. .. failed : /dev/vg0/virtualmin.interstellarconsulting.com_0_instal1_snap: read failed after 0 of 4096 at 21474770944: Input/output error /dev/vg0/virtualmin.interstellarconsulting.com_0_instal1_snap: read failed after 0 of 4096 at 21474828288: Input/output error /dev/vg0/virtualmin.interstellarconsulting.com_0_instal1_snap: read failed after 0 of 4096 at 0: Input/output error /dev/vg0/virtualmin.interstellarconsulting.com_0_instal1_snap: read failed after 0 of 4096 at 4096: Input/output error Snapshots of an origin that has a merging snapshot is not supported

You should be able to work around this backup-of-a-clone problem by shutting down the VM before performing a backup.

ok i did some further testing on this. when i have a image from scratch and disk hosted on LVM groups.. creating the snapshot works fine but after restoring it, none of the deleted files return. may be this is suppose to be like that?

No, a snapshot should return the disk state (including deleted and changed files) to exactly as it was when the snapshot was taken.

but then this is not working for my setup. :(

Category: Support request ยป Bug report

read the other thread thanks, this is breaking the functionality, i struggled initially to get LVM configured and to find out that it does not work as intended.. bummer. are you guys internally also facing this issue? or do you not use LVM and snapshotting?

We just haven't seem this on our systems. I agree it is quite frustrating, but unfortunately there isn't much we can do about it because the bug appears to be at the LVM level :-(

We should disable option for lvm based snapshotting until this is fixed, it will unnecessarily mislead people to configure LVM.

The thing is, it does work for most people.