8.7. Tracking and displaying removed thin snapshot volumes
This procedure describes how to display and manage deleted historical logical volumes.
Procédure
-
Ensure that historical logical volumes are retained by setting
record_lvs_history=1in thelvm.conffile. This metadata option is not enabled by default. -
Optional: Set the value of the
lvs_history_retention_timeoption in seconds. This is the time interval after which a record about individual historical logical volume is automatically destroyed. The automatic default value is0and it disables this feature. If you do not set this option, you can also delete individual historical volumes manually. To display a thin-provisioned snapshot chain:
Dans cet exemple :
-
lvol1is an origin volume, the first volume in the chain. -
lvol2is a snapshot oflvol1. -
lvol3is a snapshot oflvol2. -
lvol4is a snapshot oflvol3. lvol5is also a snapshot oflvol3.Copy to Clipboard Copied! Toggle word wrap Toggle overflow Note that, despite using
lvsutility with the-Hoption, no thin snapshot volume is removed and there are no historical logical volumes to display.
-
Remove logical volume
lvol3from the snapshot chain:lvremove -f vg/lvol3
# lvremove -f vg/lvol3 Logical volume "lvol3" successfully removedCopy to Clipboard Copied! Toggle word wrap Toggle overflow Run the
lvsutility to see the details of historical logical volumes, along with their ancestors and descendants:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Additionally, display the removal timestamp of a historical volume:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow You can reference historical logical volumes individually in a display command by specifying the vgname/lvname format:
lvs -H vg/-lvol3
# lvs -H vg/-lvol3 LV VG Attr LSize -lvol3 vg ----h----- 0Copy to Clipboard Copied! Toggle word wrap Toggle overflow Note that the fifth bit in the
lv_attrfield is set tohto indicate the volume is a historical one.LVM does not keep historical logical volumes if the volume has no live descendant. This means that if you remove a logical volume at the end of a snapshot chain, the logical volume is not retained as a historical logical volume.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Remove the volume
lvol1andlvol2and to see how thelvscommand displays the volumes once they have been removed.Copy to Clipboard Copied! Toggle word wrap Toggle overflow Remove a historical logical volume completely by specifying the name of the historical volume that now includes the hyphen, as in the following example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow