步骤:
(1)新增一个8e systemID的分区;
(2)用pvcreate命令构建PV;
(3)用vgextend命令将PV加入vg_1;
(4)用lvresize命令将新加入的PV内的PE加入lv_1中;
(5)通过resize2fs命令将LV的容量扩充到整个文件系统;
(1)新增一个8e systemID的分区;由于前面创建的是4个主分区,如果想要再创建一个新分区,则需要把/dev/sdb4删除,创建一个扩展分区,然后在扩展分区下新增8e systemID的分区,步骤如下:
[root@centos6 ~]# df -h #查看lvm挂载情况
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 16G 1.5G 14G 11% /
tmpfs 112M 0 112M 0% /dev/shm
/dev/sda1 194M 29M 155M 16% /boot
/dev/mapper/vg_1-lv_1 20G 172M 19G 1% /mnt/lvm
[root@centos6 ~]# umount /mnt/lvm/ #卸载lvm
[root@centos6 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 16G 1.5G 14G 11% /
tmpfs 112M 0 112M 0% /dev/shm
/dev/sda1 194M 29M 155M 16% /boot
[root@centos6 ~]# lvremove /dev/vg_1/lv_1 #删除lv_1
Do you really want to remove active logical volume lv_1? [y/n]: y
Logical volume "lv_1" successfully removed
[root@centos6 ~]# lvs
[root@centos6 ~]# vgreduce vg_1 /dev/sdb4 #将/dev/sdb4从vg_1中移除
Removed "/dev/sdb4" from volume group "vg_1"
[root@centos6 ~]# pvremove /dev/sdb4 #将/dev/sdb4从pv中移除
Labels on physical volume "/dev/sdb4" successfully wiped
[root@centos6 ~]# pvs #查看pv的情况
PV VG Fmt Attr PSize PFree
/dev/sdb1 vg_1 lvm2 a-- 5.00g 5.00g
/dev/sdb2 vg_1 lvm2 a-- 5.00g 5.00g
/dev/sdb3 vg_1 lvm2 a-- 5.00g 5.00g
[root@centos6 ~]# fdisk /dev/sdb #进入/dev/sdb磁盘中划分分区
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): p
Disk /dev/sdb: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 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: 0x60710230
Device Boot Start End Blocks Id System
/dev/sdb1 1 654 5253223+ 8e Linux LVM
/dev/sdb2 655 1308 5253255 8e Linux LVM
/dev/sdb3 1309 1962 5253255 8e Linux LVM
/dev/sdb4 1963 2616 5253255 8e Linux LVM
Command (m for help): d #删除/dev/sdb4分区
Partition number (1-4): 4
Command (m for help): p
Disk /dev/sdb: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 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: 0x60710230
Device Boot Start End Blocks Id System
/dev/sdb1 1 654 5253223+ 8e Linux LVM
/dev/sdb2 655 1308 5253255 8e Linux LVM
/dev/sdb3 1309 1962 5253255 8e Linux LVM
Command (m for help): n
Command action
e extended
p primary partition (1-4)
e
Selected partition 4 #创建一个扩展分区
First cylinder (1963-10443, default 1963):
Using default value 1963
Last cylinder, +cylinders or +size{K,M,G} (1963-10443, default 10443): +10G
Command (m for help): p
Disk /dev/sdb: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 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: 0x60710230
Device Boot Start End Blocks Id System
/dev/sdb1 1 654 5253223+ 8e Linux LVM
/dev/sdb2 655 1308 5253255 8e Linux LVM
/dev/sdb3 1309 1962 5253255 8e Linux LVM
/dev/sdb4 1963 3268 10490445 5 Extended
Command (m for help): n #创建一个新的分区
First cylinder (1963-3268, default 1963):
Using default value 1963
Last cylinder, +cylinders or +size{K,M,G} (1963-3268, default 3268): +5G
Command (m for help): p
Disk /dev/sdb: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 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: 0x60710230
Device Boot Start End Blocks Id System
/dev/sdb1 1 654 5253223+ 8e Linux LVM
/dev/sdb2 655 1308 5253255 8e Linux LVM
/dev/sdb3 1309 1962 5253255 8e Linux LVM
/dev/sdb4 1963 3268 10490445 5 Extended
/dev/sdb5 1963 2616 5253223+ 83 Linux
Command (m for help): t
Partition number (1-5): 5
Hex code (type L to list codes): 8e #将/dev/sdb5分区的systemID改成8e
Changed system type of partition 5 to 8e (Linux LVM)
Command (m for help): p
Disk /dev/sdb: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 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: 0x60710230
Device Boot Start End Blocks Id System
/dev/sdb1 1 654 5253223+ 8e Linux LVM
/dev/sdb2 655 1308 5253255 8e Linux LVM
/dev/sdb3 1309 1962 5253255 8e Linux LVM
/dev/sdb4 1963 3268 10490445 5 Extended
/dev/sdb5 1963 2616 5253223+ 8e Linux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@centos6 ~]# partprobe
创建lv,并挂载;
[root@centos6 ~]# lvcreate -L 15G -n lv_1 vg_1
Logical volume "lv_1" created
[root@centos6 ~]# lvs
LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert
lv_1 vg_1 -wi-a----- 15.00g
[root@centos6 ~]# mkfs -t ext4 /dev/vg_1/lv_1
[root@centos6 ~]# mount /dev/vg_1/lv_1 /mnt/lvm
[root@centos6 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 16G 1.5G 14G 11% /
tmpfs 112M 0 112M 0% /dev/shm
/dev/sda1 194M 29M 155M 16% /boot
/dev/mapper/vg_1-lv_1 15G 166M 14G 2% /mnt/lvm
(2)新建新的PV;
[root@centos6 ~]# pvcreate /dev/sdb5
Physical volume "/dev/sdb5" successfully created
[root@centos6 ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sdb1 vg_1 lvm2 a-- 5.00g 0
/dev/sdb2 vg_1 lvm2 a-- 5.00g 0
/dev/sdb3 vg_1 lvm2 a-- 5.00g 0
/dev/sdb5 lvm2 a-- 5.01g 5.01g
(3)用vgextend命令将PV加入vg_1;
[root@centos6 ~]# vgextend vg_1 /dev/sdb5
Volume group "vg_1" successfully extended
[root@centos6 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
vg_1 4 1 0 wz--n- 20.00g 5.00g
[root@centos6 ~]# vgdisplay
--- Volume group ---
VG Name vg_1
System ID
Format lvm2
Metadata Areas 4
Metadata Sequence No 15
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 4
Act PV 4
VG Size 20.00 GiB
PE Size 16.00 MiB
Total PE 1280
Alloc PE / Size 960 / 15.00 GiB
Free PE / Size 320 / 5.00 GiB #剩余320个PE,容量为5G
VG UUID NpO8m2-s4rx-WOIA-SbCt-yqQV-MU1w-wru4cS
(4)用lvresize命令将新加入的PV内的PE加入lv_1中;
[root@centos6 ~]# lvresize -l +320 /dev/vg_1/lv_1
Extending logical volume lv_1 to 20.00 GiB
Logical volume lv_1 successfully resized
[root@centos6 ~]# lvdisplay
--- Logical volume ---
LV Path /dev/vg_1/lv_1
LV Name lv_1
VG Name vg_1
LV UUID n2bChT-rimu-eRDs-5onU-mgUF-ukuh-NqO7me
LV Write Access read/write
LV Creation host, time centos6.5, 2016-09-09 19:04:37 +0800
LV Status available
# open 1
LV Size 20.00 GiB #查看LV的容量已经变成了20G
Current LE 1280
Segments 4
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
[root@centos6 ~]# df -h /mnt/lvm/
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_1-lv_1 15G 166M 14G 2% /mnt/lvm #查看/mnt/lvm目录的容量还是15G,没有变化
[root@centos6 ~]# dumpe2fs /dev/vg_1/lv_1
(5)通过resize2fs命令将LV的容量扩充到整个文件系统;
[root@centos6 ~]# resize2fs /dev/vg_1/lv_1
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/vg_1/lv_1 is mounted on /mnt/lvm; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 2
Performing an on-line resize of /dev/vg_1/lv_1 to 5242880 (4k) blocks.
The filesystem on /dev/vg_1/lv_1 is now 5242880 blocks long.
[root@centos6 ~]# df -h /mnt/lvm/
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_1-lv_1 20G 170M 19G 1% /mnt/lvm #/mnt/lvm目录的容量已经变成了20G
我的博物馆故事 官方安卓版v1.61.2
我的博物馆故事是一款以消除为主题的经营养成类手游,在这里玩家
专业模拟飞行10 手机版v12.2.4
专业模拟飞行10安卓版是一款飞行休闲手游,顶尖的物理飞行引擎
动物起义战斗模拟器二琳同款 最新版v4.1.1
动物起义战斗模拟器是一个非常有趣的模拟类游戏,玩家可以召唤各
迷你世界七周年 安卓手机版v1.43.0
迷你世界7周年是一款由《迷你世界》官方推出的庆祝特别版本,在
劫后公司无限资源版 v1.0.5.1
劫后公司内置菜单版是游戏的破解版本,在该版本中为玩家提供了内