1

I'm configuring an openvz node and would like to use lvm snapshot for backup (I do remote backup too).

The snapshot size is the same that data in the backuped partition ?

If I have a logical volume with 100G data, the snapshot is 100G size ?

I ask that because I don't know how space use for virtual machines and snapshots in my volume group.

My vg is 450G.

roberto

1
  • sidenote: a snapshot is not a backup. it's usefull for making a backup, since it shows an exact copy at given instant in time. The best use is: flush all databases, make a snapshot, allow the VM to continue while you copy from the snapshot to the real backup media, finally destroy the snapshot.
    – Javier
    Apr 29, 2011 at 15:24

3 Answers 3

2

The size of an LVM snapshot gives the maximum number of blocks you can write in the snapshot or the underlying volume before the snapshot overflows and is broken. So, in your example, having a logical volume of 100G you can create a 1GB snapshot volume it will take 1G in your LVM. Now you can write 1G of data to the snapshot, 1GB of data to the original volume or 500MB to each before the snapshot overflows. A snapshot of 100G would never overflow.

Using snapshots as disks for virtual machines is very nice, as you can provision them quickly, but if you expect the users to write a lot you will have to monitor the size of the snapshots and potentially increase it. The relevant stat is Allocated to snapshot in lvdisplay.

1

There's a relevant bit in the man page for lvcreate that seems clear to me:

-s, --snapshot
  ... the  snapshot does  not  need  the same amount of
  storage the origin has. In a typical scenario, 15-20%
  might be enough. In case  the snapshot runs  out
  of  storage,  use lvextend(8) to grow it. Shrinking
  a snapshot is supported by lvreduce(8) as well.
  Run  lvdisplay(8) on  the snapshot in order to check
  how much data is allocated to it....

So, for a 100 GB LV, I'd start with 20 GB for the snapshot volume.

0

A snapshot volume ONLY contains the files that have been changed since it was created. i.e. If you only changed 2kb of files since the snapshot... the snapshot consumes 2kb of disk space. It is a good idea to plan on allowing the snapshot sufficient space to do what you need before the snapshot is removed... i.e. if you are going to make 100gb of changes after the snaphot is taken... you need to allocate 100gb to the snapshot.. so it can consume 100gb if needed.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .