如何查看物理卷上的逻辑卷?

djm*_*che 5 linux lvm

我有一个由不同驱动器组成的卷组 - 一个 HDD 和一个 SSD。我希望某些 LV 位于 SSD 上。我可以lvcreate在创建新 LV 时建议这样做,我可以用 移动东西pvmove,但是我如何查看当前状态?

djm*_*che 6

这在文档中很难找到,但是lvdisplay联机帮助页提供了一些很好的信息。首先,lvdisplay -m将向您显示特定逻辑卷的相关信息:

--- Logical volume ---
LV Path                /dev/lvm/base
LV Name                base
VG Name                lvm
LV UUID                9bFriv-5DA2-3NSA-FeSO-6hKj-Un3j-74rzWQ
LV Write Access        read/write
LV Creation host, time ,
LV Status              available
# open                 1
LV Size                25.00 GiB
Current LE             6400
Segments               4
Allocation             inherit
Read ahead sectors     auto
- currently set to     256
Block device           254:7

--- Segments ---
Logical extent 0 to 2971:
    Type                linear
    Physical volume     /dev/sda11
    Physical extents    0 to 2971

Logical extent 2972 to 5530:
    Type                linear
    Physical volume     /dev/sda10
    Physical extents    0 to 2558

Logical extent 5531 to 6398:
    Type                linear
    Physical volume     /dev/sda9
    Physical extents    1024 to 1891

Logical extent 6399 to 6399:
    Type                linear
    Physical volume     /dev/sda7
    Physical extents    2429 to 2429
Run Code Online (Sandbox Code Playgroud)

在许多情况下,您想知道的是相反的:PV 上的 LV 是什么。为此,pvs --segments -o+lv_name,seg_start_pe,segtype

knuth ~ # pvs --segments -o+lv_name,seg_start_pe,segtype
PV         VG     Fmt  Attr PSize  PFree  Start SSize LV                                         Start Type
/dev/sda10 lvm    lvm2 a--  10.00g     0      0  2559 base                                        2972 linear
/dev/sda11 lvm    lvm2 a--  11.61g     0      0  2972 base                                           0 linear
/dev/sda5         lvm2 a--  10.00g 10.00g     0     0                                                0 free
/dev/sda6         lvm2 a--  10.00g 10.00g     0     0                                                0 free
/dev/sda7  lvm    lvm2 a--  10.00g  2.99g     0   769 buildslave                                  2303 linear
Run Code Online (Sandbox Code Playgroud)