如何找到 LVM 卷组的创建日期和时间以及创建方式?
根据ComptTIA LPIC-1 手册LVM卷组元数据包含此类信息,但我不知道如何提取它?
答案1
这篇博文标题为:CentOS / RHEL:如何查看LVM卷的创建时间展示了如何去做。
...默认情况下,元数据备份存储在 /etc/lvm/backup 目录中。每个卷组备份都存储在该目录中,文件名与 VG 名称相同。元数据存档存储在 /etc/lvm/archive 目录中......
方法#1 - lvdisplay
此命令显示 LV 的创建时间。
$ sudo lvdisplay
--- Logical volume ---
LV Path /dev/vg/vol
LV Name vol
VG Name vg
LV UUID 9M1Hxw-X4bN-t7t4-7auG-qOnb-WHh1-WJVcne
LV Write Access read/write
LV Creation host, time name, 2015-08-20 11:42:33 +0530
LV Status available
# open 1
LV Size 18.62 GiB
Current LE 4768
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:0
方法#2 - 通过文件查找逻辑卷创建时间
# 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
如果您查看这些文件,您将看到 LV 的创建时间:
$ 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