[CentOS-virt] proper way to snapshot

Fri Apr 27 13:53:02 UTC 2012
aurfalien <aurfalien at gmail.com>

Hi,
On Apr 27, 2012, at 4:23 AM, Peter Peltonen wrote:

> Hi,
> 
> On Fri, Apr 27, 2012 at 12:48 AM, aurfalien <aurfalien at gmail.com> wrote:
>> On Apr 26, 2012, at 2:24 PM, Nux! wrote:
>> 
>>> On 26.04.2012 19:21, aurfalien wrote:
>>>> On Apr 26, 2012, at 2:15 PM, Nux! wrote:
>>>> 
>>>>> On 26.04.2012 19:12, aurfalien wrote:
>>>>>> On Apr 26, 2012, at 1:54 PM, Nux! wrote:
>>>>>> 
>>>>>>> On 26.04.2012 18:23, aurfalien wrote:
>>>>>>>> Hi,
>>>>>>>> 
>>>>>>>> While there are a few howtos floating around, what is the
>>>>>>>> standard
>>>>>>>> way to snapshot guests?
>>>>>>>> 
>>>>>>>> I went through and converted from raw to pre allocated meta data
>>>>>>>> qcow2 images for this purpose.
>>>>>>>> 
>>>>>>>> Some howtos suggest to do an xml snapshot file as so;
>>>>>>>> 
>>>>>>>> <domainsnapshot>
>>>>>>>> <name>UbuntuServer_10.10-16032011</name>
>>>>>>>> <description>Snapshot of OS install and updates</description>
>>>>>>>> </domainsnapshot>
>>>>>>>> 
>>>>>>>> And then to run as so;
>>>>>>>> 
>>>>>>>> virsh snapshot-create UbuntuServer_10.10
>>>>>>>> UbuntuServer_10.10-ss.xml
>>>>>>>> 
>>>>>>>> Seems a bit over kill.
>>>>>>>> 
>>>>>>>> I was thinking more along the lines of this;
>>>>>>>> 
>>>>>>>> qemu-img snapshot -c $date $filename
>>>>>>>> 
>>>>>>>> qemu-img convert -f qcow2 -O qcow2 -s $date $filename
>>>>>>>> $filename-$date
>>>>>>>> 
>>>>>>>> Or something like this.Anyways, hoping to see how you all are
>>>>>>>> doing
>>>>>>>> this for best practice sort of thing.
>>>>>>> 
>>>>>>> Hi,
>>>>>>> 
>>>>>>> I just use LVM snapshots; it's the fastest, most reliable way I
>>>>>>> could
>>>>>>> come with.
>>>>>> 
>>>>>> Hi,
>>>>>> 
>>>>>> I don't have LVMs.
>>>>>> 
>>>>>> But if I did, would it be possible to only snapshot a directory or
>>>>>> will it snapshot the entire file system?
>>>>> 
>>>>> Assuming you use LVM on the host to provide the virtual machine with
>>>>> a
>>>>> (virtual) HDD, then snapshotting that will obviously be (virtual)
>>>>> disk-wise.
>>>> 
>>>> I used a simple non LVM partitioning scheme.
>>>> 
>>>> Can I do directory based snapshots in LVM or is it the entire FS?
>>>> 
>>>> I can re implement or redo my host to use LVM.
>>>> 
>>>> - aurf
>>>> _______________________________________________
>>>> CentOS-virt mailing list
>>>> CentOS-virt at centos.org
>>>> http://lists.centos.org/mailman/listinfo/centos-virt
>>> 
>>> Aurf,
>>> 
>>> LVM is filesystem level, not directory level. What I'd recommend is to
>>> reinstall and use LVM, make a couple of volumes for / and swap and leave
>>> the rest for virtual machines.
>> 
>> The real problem with this is that snapshots are still on the local box and I don't have a SAN.
>> 
>> With KVM based qcow snaps, I can do snaps over NFS.
> 
> You can copy LVM snapshots easily to some other location with dd (=
> create image file of the snapshot LVM volume) that you can restore
> where ever you like using dd again.

After some experiment with qcow vs raw, I think raw is more stable and a tad fatser even if you pre allocate the metadata for your qcow images.

So, I will opt for LVMs.

Do you have a best practice in terms of ratio of snapshot to live FS?

In other words, should my LVM snapshot partition be 1:1 with my live FS size or 2/3 the size of bigger?

This will be based off a Raid 1 system.

- aurf