PV\VG\LV对LVM分区的操作测试;

[root@station dev]# pvscan
  PV /dev/sda2   VG rhel_linuxprobe   lvm2 [19.51 GiB / 0    free]
  PV /dev/sdb    VG rhel_linuxprobe   lvm2 [1020.00 MiB / 720.00 MiB free]
  Total: 2 [20.50 GiB] / in use: 2 [20.50 GiB] / in no VG: 0 [0   ]
[root@station dev]# vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "rhel_linuxprobe" using metadata type lvm2

[root@station dev]# lvscan
  ACTIVE            '/dev/rhel_linuxprobe/swap' [2.00 GiB] inherit
  ACTIVE            '/dev/rhel_linuxprobe/root' [17.51 GiB] inherit
  ACTIVE            '/dev/rhel_linuxprobe/vo' [300.00 MiB] inherit
[root@station dev]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/rhel_linuxprobe/swap
  LV Name                swap
  VG Name                rhel_linuxprobe
  LV UUID                3Rgw9D-oAjx-LWxR-C0Uo-mWij-6hbo-mY8lfm
  LV Write Access        read/write
  LV Creation host, time localhost, 2018-03-27 04:19:31 +0800
  LV Status              available
  # open                 2
  LV Size                2.00 GiB
  Current LE             512
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0
   
  --- Logical volume ---
  LV Path                /dev/rhel_linuxprobe/root
  LV Name                root
  VG Name                rhel_linuxprobe
  LV UUID                tYTNA7-PAgV-CNPQ-jMCI-zfp0-n8x2-rf4UZb
  LV Write Access        read/write
  LV Creation host, time localhost, 2018-03-27 04:19:32 +0800
  LV Status              available
  # open                 1
  LV Size                17.51 GiB
  Current LE             4482
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1
   
  --- Logical volume ---
  LV Path                /dev/rhel_linuxprobe/vo
  LV Name                vo
  VG Name                rhel_linuxprobe
  LV UUID                YeYKqD-SQtV-dugf-2BOC-W3Yz-8pPV-ALhpEK
  LV Write Access        read/write
  LV Creation host, time station.domain1.example.com, 2019-08-29 22:04:02 +0800
  LV Status              available
  # open                 0
  LV Size                300.00 MiB
  Current LE             75
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:2
   
[root@station dev]#
[root@station dev]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               rhel_linuxprobe
  PV Size               19.51 GiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              4994
  Free PE               0
  Allocated PE          4994
  PV UUID               8Nx8r4-hFjx-jfle-X0jN-AZsj-t3lY-U1P4AV
   
  --- Physical volume ---
  PV Name               /dev/sdb
  VG Name               rhel_linuxprobe
  PV Size               1.00 GiB / not usable 4.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              255
  Free PE               180
  Allocated PE          75
  PV UUID               PzfHpe-c1yp-YKaH-Tjql-2rxy-BoG2-EOALQj
   
[root@station dev]# vgdisplay
  --- Volume group ---
  VG Name               rhel_linuxprobe
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  9
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               2
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               20.50 GiB
  PE Size               4.00 MiB
  Total PE              5249
  Alloc PE / Size       5069 / 19.80 GiB
  Free  PE / Size       180 / 720.00 MiB
  VG UUID               SjGdoP-sZ5D-oTdw-pXPn-26Kh-nOpp-eyvZXa

 
  [root@station dev]# lsblk -f
NAME                     FSTYPE      LABEL UUID                                   MOUNTPOINT
sda                                                                               
├─sda1                   xfs               38a8699b-374f-457d-80ce-32981061b02a   /boot
└─sda2                   LVM2_member       8Nx8r4-hFjx-jfle-X0jN-AZsj-t3lY-U1P4AV
  ├─rhel_linuxprobe-swap swap              ae318697-73a8-4ef6-88f3-0bf143f947cc   [SWAP]
  └─rhel_linuxprobe-root xfs               b100e9de-a3a4-4148-867a-d86f0cd606be   /
sdb                      LVM2_member       PzfHpe-c1yp-YKaH-Tjql-2rxy-BoG2-EOALQj
└─rhel_linuxprobe-vo                                                              



至此,该lv已经建立,后续只要挂载就可使用;
如:

[root@station /]# lvscan
  ACTIVE            '/dev/rhel_linuxprobe/swap' [2.00 GiB] inherit
  ACTIVE            '/dev/rhel_linuxprobe/root' [17.51 GiB] inherit
  ACTIVE            '/dev/rhel_linuxprobe/vo' [300.00 MiB] inherit
[root@station /]# mount /dev/rhel_linuxprobe/vo /testdir_one/
mount: /dev/mapper/rhel_linuxprobe-vo is write-protected, mounting read-only
mount: unknown filesystem type '(null)'
[root@station /]# 此处提示该LV没有文件格式,然后格式化成xfs格式就好
[root@station /]#
[root@station /]# lsblk
NAME                     MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                        8:0    0   20G  0 disk
├─sda1                     8:1    0  500M  0 part /boot
└─sda2                     8:2    0 19.5G  0 part
  ├─rhel_linuxprobe-swap 253:0    0    2G  0 lvm  [SWAP]
  └─rhel_linuxprobe-root 253:1    0 17.5G  0 lvm  /
sdb                        8:16   0    1G  0 disk
└─rhel_linuxprobe-vo     253:2    0  300M  0 lvm  
sr0                       11:0    1 1024M  0 rom  
[root@station /]# mkfs.xfs /dev/rhel_linuxprobe/vo
meta-data=/dev/rhel_linuxprobe/vo isize=256    agcount=4, agsize=19200 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0
data     =                       bsize=4096   blocks=76800, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=853, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@station /]#
[root@station /]# mount /dev/rhel_linuxprobe/vo /testdir_one/
[root@station /]#
[root@station /]#
[root@station /]# lsblk
NAME                     MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                        8:0    0   20G  0 disk
├─sda1                     8:1    0  500M  0 part /boot
└─sda2                     8:2    0 19.5G  0 part
  ├─rhel_linuxprobe-swap 253:0    0    2G  0 lvm  [SWAP]
  └─rhel_linuxprobe-root 253:1    0 17.5G  0 lvm  /
sdb                        8:16   0    1G  0 disk
└─rhel_linuxprobe-vo     253:2    0  300M  0 lvm  /testdir_one
sr0                       11:0    1 1024M  0 rom  
[root@station /]#

你可能感兴趣的:(PV\VG\LV对LVM分区的操作测试;)