5.4.6. Creating Thinly-Provisioned Snapshot Volumes
5.4.6. Creating Thinly-Provisioned Snapshot Volumes The Red Hat Enterprise Linux release 6.4 version of LVM provides support for thinly-provisioned snapshot volumes. For information on the benefits and limitations of thin snapshot volumes, see Section 3.3.7, "Thinly-Provisioned Snapshot Volumes" . Note This section provides an overview of the basic commands you use to create and grow thinly-provisioned snapshot volumes. For detailed information on LVM thin provisioning as well as information on using the LVM commands and utilities with thinly-provisioned logical volumes, see the lvmthin (7) man page. Important When creating a thin snapshot volume, you do not specify the size of the volume. If you specify a size parameter, the snapshot that will be created will not be a thin snapshot volume and will not use the thin pool for storing data. For example, the command lvcreate -s vg/thinvolume -L10M will not create a thin snapshot, even though the origin volume is a thin volume. Thin snapshots can be created for thinly-provisioned origin volumes. As of the Red Hat Enterprise Linux 6.5 release, thin snapshots can also be created for origin volumes that are not thinly-provisioned. You can specify a name for the snapshot volume with the --name option of the lvcreate command. It is recommended that you use this option when creating a logical volume so that you can more easily see the volume you have created when you display logical volumes with the lvs command. The following command creates a thinly-provisioned snapshot volume of the thinly-provisioned logical volume vg001/thinvolume that is named mysnapshot1 . A thin snapshot volume has the same characteristics as any other thin volume. You can independently activate the volume, extend the volume, rename the volume, remove the volume, and even snapshot the volume. By default, a snapshot volume is skipped during normal activation commands. For information on controlling the activation of a snapshot volume, see Section 5.4.17, "Controlling Logical Volume Activation" . As of the Red Hat Enterprise Linux 6.5 release, you can create a thinly-provisioned snapshot of a non-thinly-provisioned logical volume. Since the non-thinly-provisioned logical volume is not contained within a thinpool, it is referred to as an external origin . External origin volumes can be used and shared by many thinly-provisioned snapshot volumes, even from different thin pools. The external origin must be inactive and read-only at the time the thinly-provisioned snapshot is created. To create a thinly-provisioned snapshot of an external origin, you must specify the --thinpool option. The following command creates a thin snapshot volume of the read-only inactive volume origin_volume . The thin snapshot volume is named mythinsnap . The logical volume origin_volume then becomes the thin external origin for the thin shapshot volume mythinsnap in volume group vg001 that will use the existing thin pool vg001/pool . Because the origin volume must be in the same volume group as the snapshot volume, you do not need to specify the volume group when specifying the origin logical volume. You can create a second thinly-provisioned snapshot volume of the first snapshot volume, as in the following command.
lvcreate -s --name mysnapshot1 vg001/thinvolume Logical volume "mysnapshot1" created lvs LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert mysnapshot1 vg001 Vwi-a-tz 1.00g mythinpool thinvolume 0.00 mythinpool vg001 twi-a-tz 100.00m 0.00 thinvolume vg001 Vwi-a-tz 1.00g mythinpool 0.00 lvcreate -s --thinpool vg001/pool origin_volume --name mythinsnap lvcreate -s vg001/mythinsnap --name my2ndthinsnap