Device Boot Start End Blocks Id System
/dev/vda1 * 1 7833 62912512 83 Linux
Disk /dev/vdb: 536.9 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x3a7be7cb
Device Boot Start End Blocks Id System
/dev/vdb1 1 65270 524281243+ 8e Linux LVM
[root@linuxidc ~]# pvscan
No matching physical volumes found
#先建pv.后面接具体的划分的路径.
[root@linuxidc ~]# pvcreate /dev/vdb1
Physical volume "/dev/vdb1" successfully created
[root@linuxidc ~]# pvscan
PV /dev/vdb1 lvm2 [499.99 GiB]
Total: 1 [499.99 GiB] / in use: 0 [0 ] / in no VG: 1 [499.99 GiB]
[root@linuxidc ~]# pvdisplay
"/dev/vdb1" is a new physical volume of "499.99 GiB"
--- NEW Physical volume ---
PV Name /dev/vdb1
VG Name
PV Size 499.99 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID GOeBQF-iCCD-n7i7-Y4DT-U5PE-tjHK-B9Z3CL
#再建VG.由于是直接使用整个划分的区块,所以直接跟区块名 /dev/vdb1,前面接的是vg名称,这个随便命名的.
[root@linuxidc ~]# vgcreate mailbox_vg /dev/vdb1
Volume group "mailbox_vg" successfully created
[root@linuxidc ~]# vgscan
Reading all physical volumes. This may take a while...
Found volume group "mailbox_vg" using metadata type lvm2
[root@linuxidc ~]# pvscan
PV /dev/vdb1 VG mailbox_vg lvm2 [499.99 GiB / 499.99 GiB free]
Total: 1 [499.99 GiB] / in use: 1 [499.99 GiB] / in no VG: 0 [0 ]
[root@linuxidc ~]# vgdisplay
--- Volume group ---
VG Name mailbox_vg
System ID
Format lvm2
Metadata Areas 1
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 1
Act PV 1
VG Size 499.99 GiB
PE Size 4.00 MiB
Total PE 127998
Alloc PE / Size 0 / 0
Free PE / Size 127998 / 499.99 GiB
VG UUID JjdDER-Y1OK-ICwZ-3FgC-cry2-bZYl-SqD3RP
#下面需要创建LV.-l后面接的是pe的数量.这个可使用上面的vgdisplay的命令来查看.
#然后后面接lv的名称.也是可以随便命名,但是个人建议这里写个可以区分的.要不到时难分清楚.
[root@linuxidc ~]# lvcreate -l 127998 -n mailbox_lv mailbox_vg
Logical volume "mailbox_lv" created
[root@linuxidc ~]# lvdisplay
--- Logical volume ---
LV Path /dev/mailbox_vg/mailbox_lv
LV Name mailbox_lv
VG Name mailbox_vg
LV UUID VPA4HE-22B4-gZc0-Qo8V-TO1C-tKaF-AT8s5T
LV Write Access read/write
LV Creation host, time linuxidc, 2016-09-13 09:25:34 +0800
LV Status available
# open 0
LV Size 499.99 GiB
Current LE 127998
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
[root@linuxidc ~]# fdisk -l