Wednesday, November 28, 2007

vzdump --snapshot revisited

[root@svr~]# vzdump --snapshot 101
/dev/cdrom: open failed: No medium found
starting backup for VPS 101 (/vz/private/101)
Thu Jul 12 06:53:52 2007
creating backup for VPS 101 failed
(0.00 minutes): unable to dump into snapshot
(use option --dumpdir) at /usr/bin/vzdump line 450.


What is going on?

Here is the answer


Labels:

Prepare a stock centos HN to do vzdumps using LVM snapshots

Situation:

- Stock Centos 4 system with OpenVZ kernel + utilities installed. One big /vz partition, using LVM.

Trying to make a backup using:

vzdump --dumpdir /var/ --snapshot 101
Error message received:
Insufficient free extents (1) in volume group
VolGroup00: 16 required
What does that mean?

It means that you don't have enough free space in the VG (Volume Group) to create an LVM snapshot.

What is the solution? Reduce the size of one partition, then resize one LV (logical volume). This is easily done if you don't have only one big / partition. I usually always make a separate partition for /var and for /vz.

To determine what logical volume needs to be resized, you can use the df -h command. Mine showed:

/dev/mapper/VolGroup00-LogVol05
119G 16G 99G 14% /vz

To resize it:

  1. Make backups of your VM to be sure
  2. Stop the vz service (service vz stop)
  3. umount /vz
  4. e2fsck -f /dev/VolGroup00/LogVol05
  5. Use resize2fs /dev/VolGroup00/LogVol05 110G
  6. Use lvresize to reduce the LV sizey by 2 GB:lvresize --size -2G /dev/VolGroup00/LogVol05
Optionnaly, you can resize your FS to match the size of the LV, using no size arguments to ext2resize:
  1. e2fsck -f /dev/VolGroup00/LogVol05
  2. resize2fs /dev/VolGroup00/LogVol05
I have not re-tested this procedure itself from the beginning (I don't have a test system here), but it should be pretty safe. Please leave comments if you try this.

If you need to know how big are your LV : lvdisplay.
If you need to know how big are our VG: vgdisplay. This also tells the free space in the VG.

You can not try to use lvm snapshots with vzdump.

Labels:

A little mail server admin joke

I was trying to debug someone by e-mail and I think he was a little "slow". Then I thought, silently:

His brain returned "452 4.3.1 Insufficient system resources"