Redstor's LVM Snapshot feature for the Linux ESE Agent is used when a crash-consistent backup is required, for example when backing up database files that can be written to while a backup is in progress.
Configuration
The LVM Snapshot option will only be available if LVM is installed on the machine. The feature can be enabled in Options and Settings > Advanced in the Agent.
Note: If LVM is not installed on the machine, it is possible to install LVM and create additional volumes as LVM volumes. However, if you want your root filesystem to be an LVM volume, you will need to build a new machine with LVM and migrate your data to it.
LVM options can be profiled in the Management Console under Configure > Profiling > LVM - Advanced.
When LVM Snapshot is enabled, at the start of each backup a snapshot is taken of each LVM volume that contains files selected for backup. These snapshots are used to read the contents of these filesystems during backup. Non-LVM volumes are processed as usual. The snapshots are deleted upon completion of the backup.
Snapshots are created with a size expressed as a percentage of the volume size. Before enabling LVM snapshots, you need to ensure that there is sufficient free space in each volume group for snapshots of all the logical volumes in that volume group.
For example, in a volume group with 100GB of space, of which 75G is allocated to the data volume, the remaining 25GB of free space will be sufficient for our default 10% LVM Snapshot size (10% of 75GB = 7.5G).
The backup of each LVM volume will be in a crash-consistent state. However, the snapshots will not be simultaneous, which means that the backup will not be crash-consistent across volumes. As usual, the backup of non-LVM volumes will not be consistent.
Troubleshooting
- Insufficient free space
If an error occurs while creating a snapshot for any of the volumes (e.g. insufficient space in the volume group), the backup will fail.
To fix this, you need to increase the free space in the relevant volume group in one of three ways.
1. Add another disk.
- Create a partition table on the new disk using
gparted
.
- Under Create as, choose Primary Partition.
- Under File system, choose lvm2 pv.
- Reboot the machine so that the partition is correctly detected.
- Run ‘pvs’ to show that the partition is present.
- Create a PV on the partition.
- Extend the VG using the new PV by entering vgextend <volume-group-name> </dev/partition>, e.g. vgextend ubuntu-vg /dev/sda2
2. Extend the volume group’s existing disk.
- Create a new partition using the extra space.
- Reboot the machine so that the partition is correctly detected.
- Run ‘pvs’ to show that the partition is present.
- Create a PV on the partition.
- Extend the VG using the new PV by entering vgextend <volume-group-name> </dev/partition>, e.g. vgextend ubuntu-vg /dev/sda2
For methods 1 and 2 above, use the following commands:
- fdisk /dev/sda
- ‘n’ to create new partition
- ‘p’ to create as primary partition (default start and end sectors are accepted)
- ‘2’ for partition number (the default in our case)
- ‘t’ to set the type
- ‘8e’ to set the partition to Linux LVM
- ‘w’ to write the changes and ‘q’ to quit fdisk
3. Alternatively, you can also decrease the snapshot size by shrinking the filesystems to free up space, then creating a new partition to add to the volume group. Be sure to backup first.
- Snapshot is invalid
If a snapshot runs out of space during a backup, the snapshot will become invalid. This happens when a snapshot is too small to contain the volume of data written to the filesystem while the backup is in progress. Two errors will be logged: one for the files on that volume that have not yet been backed up, and one at the end of the backup indicating the snapshot ran out of space.
To fix this, you need to increase the snapshot size or reduce the volume of writes to the relevant filesystem during the backup.
Comments
0 comments
Please sign in to leave a comment.