Linux系统下LVM的常规使用

一、创建LV
1.新建磁盘分区及物理pv
[root@rac1 nfsvg]# fdisk /dev/sdg
n
p
t
8e #此格式为Linux系统LVM专用格式
w

[root@rac1 nfsvg]# pvcreate /dev/sda{9,1 0,11 }
Physical volume "/dev/sda9 "successfully created
Physical volume "/dev/sda10 "successfully created
Physical volume "/dev/sdai1 "successfully created

2.创建逻辑卷组
[root@rac1 nfsvg]# vgcreate nfsvg /dev/sda{9,1 0}
Volumegroup "nfsvg "successfully created
注:批量跨盘多分区建卷组
[root@rac1 nfsvg]#vgcreate nfsvg /dev/sdg1 /dev/sdh1

3.创建逻辑卷
[root@rac1 etc]# lvcreate -L 5120M -n lvshareplex nfsvg
  Logical volume "lvshareplex" created

4.格式化
[root@rac1 nfsvg]# mkfs.ext3 /dev/nfsvg/lvshareplex
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
655360 inodes, 1310720 blocks
65536 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1342177280
40 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks: 
       32768, 98304, 163840, 229376, 294912, 819200, 884736

Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 21 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

5.挂载
[root@rac1 nfsvg]# mkdir /shareplex
[root@rac1 nfsvg]# mount /dev/nfsvg/lvshareplex /shareplex/

6.查看卷组信息
[root@rac1 /]# vgdisplay nfsvg
  --- Volume group ---
  VG Name               nfsvg
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  2
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               19.99 GB
  PE Size               4.00 MB
  Total PE              5118
  Alloc PE / Size       1280 / 5.00 GB
  Free  PE / Size       3838 / 14.99 GB
  VG UUID               3FaCdX-3agJ-xRpb-nUjR-UMv3-q33U-Cf0a35

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/22119.html