11.5. Expanding a snapshot

As mentioned in Section 11.2, as data is copied from the original volume to the snapshot, the space available for the snapshot might fill up, causing the snapshot to be invalidated. This situation might cause your data backup to end prematurely, as the snapshot volume begins returning I/O errors after it is invalidated.

To solve this problem, EVMS now has the ability to expand the storage space for a snapshot object while the snapshot volume is active and mounted. This feature allows you to initially create a small snapshot object and expand the object as necessary as the space begins to fill up.

In order to expand the snapshot object, the underlying object must be expandable. Continuing the example from the previous sections, the object "snap" is built on the LVM region lvm/Sample Container/Sample Region. When we refer to expanding the "snap" object, the region lvm/Sample Container/Sample Region is the object that actually gets expanded, and the object "snap" simply makes use of the new space on that region. Thus, to have expandable snapshots, you will usually want to build your snapshot objects on top of LVM regions that have extra freespace available in their LVM container. DriveLink objects and some disk segments also work in certain situations.

One notable quirk about expanding snapshots is that the snapshot object and volume do not actually appear to expand after the operation is complete. Because the snapshot volume is supposed to be a frozen image of the original volume, the snapshot volume always has the same size as the original, even if the snapshot has been expanded. However, you can verify that the snapshot object is using the additional space by displaying the details for the snapshot object and comparing the percent-full field before and after the expand operation.

11.5.1. Using the EVMS GUI or Ncurses

To create the snapshot using the GUI or Ncurses, follow these steps:

  1. Select Actions->Expand->Volume to see a list of EVMS feature objects.

  2. Select the volume /dev/evms/snap.

  3. Click or activate Next.

  4. Select lvm/Sample Container/Sample Region. This object is the object that will actually be expanded.

  5. Click or activate Next.

  6. Select the options for expanding the LVM region, including the amount of extra space to add to the region.

  7. Click or activate Expand.

Alternatively, you can perform the same steps using the context sensitive menus.

  1. From the Volumes panel, right click (or press Enter on) /dev/evms/snap.

  2. Select Expand from the popup menu.

  3. Click or activate Next.

  4. Select the region lvm/Sample Container/Sample Region. This is the object that will actually be expanded.

  5. Click or activate Next.

  6. Select the options for expanding the LVM region, including the amount of extra space to add to the region.

  7. Click or activate Expand.

11.5.2. Using the CLI

The CLI expands volumes by targeting the object to be expanded. The CLI automatically handles expanding the volume and other objects above the volume in the volume stock. As with a regular expand operation, the options are determined by the plug-in that owns the object being expanded.

Issue the following command to determine the expand options for the region lvm/Sample Container/Sample Region:

query:region,region="lvm/Sample Container/Sample Region",lo

The option to use for expanding this region is called "add_size." Issue the following command to expand the snapshot by 100 MB:

expand:"lvm/Sample Container/Sample Region", add_size=100MB