[root@localhost ~]# vgremove myvg
Volume group "myvg" successfully removed
[root@localhost ~]# vgcreate -s 16M myvg /dev/sdb{1,2,3}
Volume group "myvg" successfully created
[root@localhost ~]# vgs
VG #PV #LV #SN Attr VSize VFree
myvg 3 0 0 wz--n- 1.95g 1.95g
[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name myvg
System ID
Format lvm2
Metadata Areas 3
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 3
Act PV 3
VG Size 1.95 GiB
PE Size 16.00 MiB
Total PE 125
Alloc PE / Size 0 / 0
Free PE / Size 125 / 1.95 GiB
VG UUID 3Eu9GX-U4ip-mxSF-zibe-7802-8Suh-38b4dG
创建逻辑卷
[root@localhost ~]# lvcreate -L 1.4G -n mylv myvg /dev/sdb{1,3} //-L 指定大小,-n指定名称
Rounding up size to full physical extent 1.41 GiB
Logical volume "mylv" created.
[root@localhost ~]# lvs //简单查看信息
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
mylv myvg -wi-a----- 1.41g
[root@localhost ~]# lvdisplay //详细查看信息
--- Logical volume ---
LV Path /dev/myvg/mylv
LV Name mylv
VG Name myvg
LV UUID coMhuV-ywOe-FEbm-SkQd-upfQ-0era-cCfqHy
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2017-05-17 16:30:37 +0800
LV Status available
# open 0
LV Size 1.41 GiB
Current LE 90
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
格式化:
[root@localhost ~]# mkfs.ext4 /dev/myvg/mylv
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
92160 inodes, 368640 blocks
18432 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=377487360
12 block groups
32768 blocks per group, 32768 fragments per group
7680 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Allocating group tables: done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
3、挂载使用
查看物理位置:
[root@localhost ~]# ll /dev/myvg/mylv
lrwxrwxrwx 1 root root 7 May 17 16:30 /dev/myvg/mylv -> ../dm-0
挂载到目录并进行读写操作: