CentOS / RHEL : How to find the creation time of LVM volume

Metadata backups and archives are automatically created on every volume group and logical volume configuration change unless disabled in the /etc/lvm/lvm.conf file. By default, the metadata backup is stored in the /etc/lvm/backup directory. Each Volume group backup is stored in this directory with file name same as the VG name. The metadata archives are stored in the /etc/lvm/archive directory. How long the the metadata archives stored in the /etc/lvm/archive directory are kept and how many archive files are kept is determined by parameters you can set in the lvm.conf file. A daily system backup should include the contents of the /etc/lvm directory in the backup.

Finding the creation time of logical volume

1. Multiple files for each VG are created in the directory /etc/lvm/archive for every change done and VG or LV level.

# ls -lrt
total 36
-rw------- 1 root root 1332 Mar 11  2016 data_vg_00000-348356217.vg
-rw------- 1 root root 1736 Mar 11  2016 vg_os_00000-841042346.vg
-rw------- 1 root root 1330 Apr 26  2016 data_vg_00001-957076245.vg
-rw------- 1 root root 1743 Apr 26  2016 data_vg_00002-1897075856.vg
-rw------- 1 root root 2744 Mar 14 10:27 data_vg_00003-447171210.vg
-rw------- 1 root root 2917 May 19 15:13 data_vg_00004-1853760200.vg

2. You can see check for the line shown below in each of the files to see what was the activity done. In below example the newlv volume has been resized by 50GB.

description = "Created *before* executing 'lvcreate -L 50g -n newlv vg_data'"

3. So to find the creation time of a particular LV you can cat the latest file (as it should contain all the LVs) and look for the line “creation_time“. For example :

cat data_vg_00004-1853760200.vg
....
 logical_volumes {

  lv_data {
   id = "lG8ZJR-K11q-Lho5-df6n-lSse-eDE5-HJFeAF"
   status = ["READ", "WRITE", "VISIBLE"]
   flags = []
   creation_host = "localhost"
   creation_time = 1457695889 # 2016-03-11 17:01:29 +0530
   segment_count = 1
Note : Check for the Latest archive file of the VG as it will contain all the LVs in the VG
Related Post