如何找出 LVM 的文件系统

How to find out the file system of a LVM

我在 /dev/xvdk 有一个逻辑卷,我想以编程方式检测它是否未格式化。过去,我在物理设备上 运行 "file -s" 如果设备未格式化,它将 return "data"。

但是因为它是一个 LVM(我想?),它给了我这样的东西,但没有帮助。

sudo file -sL /dev/xvdk

/dev/xvdk: LVM2 PV (Linux Logical Volume Manager), UUID: pmk0C-FABx-LAsZxB, size: 536870912000

我尝试过其他命令,例如 "fdisk"、"lsblk"、"parted"、"lvdisplay"。它们都适用于物理设备,但不适用于 LVM。

建议?

尝试 file -s /dev/volumn-group/lv 而不是分区,例如

[root@182 ~] # file -s /dev/vg1/test
/dev/vg1/test: symbolic link to `../dm-18'
[root@182 ~] # file -s /dev/dm-18
/dev/dm-18: data
[root@182 ~] # file -s /dev/vg1/root
/dev/vg1/root: symbolic link to `../dm-0'
[root@182 ~] # file -s /dev/dm-0
/dev/dm-0: Linux rev 1.0 ext4 filesystem data (needs journal recovery)    (extents) (large files) (huge files)
 # where /dev/vg1/root /dev/vg1/test is the logic volumn
 # /dev/vg1 the volumn group in 
 # /dev/xvdb is a disk