PV UUID tbAPyW-Mxzp-spvY-6qtA-k08s-pj40-7gWZHo
----------------------------------------------------------------------------
3:pv 的移除
[root@localhost ~]# pvremove /dev/sdb1------>跟要移除的分区
Labels on physical volume "/dev/sdb1" successfully wiped
[root@localhost ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 VolGroup lvm2 a-- 19.51g 0
/dev/sdc1 lvm2 a-- 6.99g 6.99g
-----------------------------------------------------
4:pv 元数据的移动
pvmove :加入vg以后,及生成PE ;使用pvremove 之前,要pvmove 转移原数据
----------------------------------------------------
5;pvscan 扫描系统上pv
[root@localhost ~]# pvscan
PV /dev/sda2 VG VolGroup lvm2 [19.51 GiB / 0 free]
PV /dev/sdb1 lvm2 [4.99 GiB]
PV /dev/sdc1 lvm2 [6.99 GiB]
Total: 3 [31.50 GiB] / in use: 1 [19.51 GiB] / in no VG: 2 [11.99 GiB
=============================================
6 vg 卷组
1;创建vg vgcreate
[root@localhost ~]# vgcreate myvg /dev/sdb1 /dev/sdc1---->vgcreate vg_name /part/to/sd :vgcreate 卷组名 跟要创建vg的设备
Volume group "myvg" successfully created
2;显示vg vgs/vgdisplay
[root@localhost ~]# vgs
VG #PV #LV #SN Attr VSize VFree
VolGroup 1 2 0 wz--n- 19.51g 0
myvg 2 0 0 wz--n- 11.98g 11.98g
-----------------------------------------------
[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name myvg
System ID
Format lvm2
Metadata Areas 2
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 2
Act PV 2
VG Size 11.98 GiB
PE Size 4.00 MiB
Total PE 3068
Alloc PE / Size 0 / 0
Free PE / Size 3068 / 11.98 GiB
VG UUID 7qz29d-SrAL-wgpf-0sQZ-XgjJ-mtVf-1eQpEG
--- Volume group ---
VG Name VolGroup
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 19.51 GiB
---------------------------------------------
3 删除vg vgremove
[root@localhost ~]# vgremove myvg ---->vgremove 卷组名
Volume group "myvg" successfully removed
4缩减vg(从vg中缩减pv) vgreduce
[root@localhost ~]# vgreduce myvg /dev/sdc1----->vgreduce 卷组名 卷组中的设备
Removed "/dev/sdc1" from volume group "myvg"
5扩展vg ;vgextend
[root@localhost ~]# vgextend myvg /dev/sdc1--->vgextend 要添加卷组名 要添加设备
Volume group "myvg" successfully extended
6扫描vg vgscan
[root@localhost ~]# vgscan
Reading all physical volumes. This may take a while...
Found volume group "myvg" using metadata type lvm2
Found volume group "VolGroup" using metadata type lvm2
----------------------------------------------------------
7 lv 逻辑卷
1逻辑卷创建:lvcreate -L #G -n lv_name vg_name
-L :指定创建lv大小
-n :lv的名字
[root@localhost ~]# lvcreate -L 6G -n testlv myvg--->
Logical volume "testlv" created
2 lv 的查看 :lvs :查看信息 / lvdisplay:查看详细信息
[root@localhost ~]# lvs
LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert
lv_root VolGroup -wi-ao---- 17.51g
lv_swap VolGroup -wi-ao---- 2.00g
testlv myvg -wi-a----- 6.00g
3 扫描lv :lvscan
[root@localhost ~]# lvscan
ACTIVE '/dev/myvg/testlv' [6.00 GiB] inherit
ACTIVE '/dev/VolGroup/lv_root' [17.51 GiB] inherit
ACTIVE '/dev/VolGroup/lv_swap' [2.00 GiB] inherit
4 格式化 mkfs /mke2fs
mke2fs -j /dev/myvg/testlv
[root@localhost ~]# mkfs /dev/myvg/testlv
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
393216 inodes, 1572864 blocks
78643 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1610612736
48 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736