您知道“fdisk -l”如何列出驱动器分区表并显示每个分区的分区ID /类型?
编辑:我知道“lvs”,这主要是我正在寻找的(它给了我逻辑卷的列表,有点像“fdisk -l”……除了知道什么也是有用的逻辑卷的分区类型(我喜欢将其视为“虚拟分区”).该信息是“fdisk -l”在右侧最后两列中列出的内容.(例如“8e”表示物理LVM分区,或Linux分机的“83”等).
我正在寻找的工具可能不是LVM的一部分;也许只是一些其他实用程序可以打印给定分区的分区ID /类型?
解决方法
fdisk报告Linux LVM的分区ID为8e.
$sudo fdisk -l Disk /dev/sda: 8589 MB,8589934592 bytes 255 heads,63 sectors/track,1044 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0x00008ec7 Device Boot Start End Blocks Id System /dev/sda1 * 1 1013 8136891 8e Linux LVM /dev/sda2 1014 1044 249007+ 5 Extended /dev/sda5 1014 1044 248976 83 Linux
LVM是存储设备顶部的抽象层,使您可以更轻松地管理它.我不确定除了你想要的fdisk之外还有哪些信息,因为会显示LVM的分区ID.但是,有关LVM逻辑卷的其他信息,可以使用“lvscan”,“lvs”和“lvdisplay”.
$sudo lvscan ACTIVE '/dev/ops1test/root' [7.35 GB] inherit ACTIVE '/dev/ops1test/swap_1' [388.00 MB] inherit $sudo lvs LV VG Attr LSize Origin Snap% Move Log Copy% Convert root ops1test -wi-ao 7.35G swap_1 ops1test -wi-ao 388.00M $sudo lvdisplay --- Logical volume --- LV Name /dev/ops1test/root VG Name ops1test LV UUID BfKOpy-L7Ql-905o-7tFk-nnsV-0c7I-w4g9y6 LV Write Access read/write LV Status available # open 1 LV Size 7.35 GB Current LE 1881 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 252:0 --- Logical volume --- LV Name /dev/ops1test/swap_1 VG Name ops1test LV UUID 8SNfQ9-Hlfk-Edsb-vmL1-DeE3-nBRR-YAM1dV LV Write Access read/write LV Status available # open 2 LV Size 388.00 MB Current LE 97 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 252:1
同样,您可以使用“vgscan”,“vgs”和“vgdisplay”了解有关卷组本身的信息.
$sudo vgscan Reading all physical volumes. This may take a while... Found volume group "ops1test" using Metadata type lvm2 $sudo vgs VG #PV #LV #SN Attr VSize VFree ops1test 1 2 0 wz--n- 7.76G 32.00M $sudo vgdisplay --- Volume group --- VG Name ops1test System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 3 VG Access read/write VG Status resizable MAX LV 0 Cur LV 2 Open LV 2 Max PV 0 Cur PV 1 Act PV 1 VG Size 7.76 GB PE Size 4.00 MB Total PE 1986 Alloc PE / Size 1978 / 7.73 GB Free PE / Size 8 / 32.00 MB VG UUID ofpvks-2EDZ-limu-0wAh-tYUN-ISG3-mSS65O