首页 > 代码库 > linux 逻辑卷扩展
linux 逻辑卷扩展
例如想扩展 / 分区
[root@mysql mapper]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_mysql-lv_root 24G 8.4G 14G 39% /
tmpfs 499M 224K 498M 1% /dev/shm
/dev/sda1 485M 35M 426M 8% /boot
[root@mysql mapper]#fdik -l 查看可用的磁盘
添加逻辑卷
[root@mysql mapper]# fdisk /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):n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (1961-2610, default 1961):
Using default value 1961
Last cylinder, +cylinders or +size{K,M,G} (1961-2610, default 2610):
Using default value 2610
Command (m for help):w 保存
[root@mysql mapper]# fdisk -l
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 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: 0x000b6c05
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 1306 9972736 8e Linux LVM
Disk /dev/sdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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: 0x3eb0062a
Device Boot Start End Blocks Id System
/dev/sdb1 1 2610 20964793+ 5 Extended
/dev/sdb5 1 1306 10490382 83 Linux
/dev/sdb6 1307 1960 5253223+ 83 Linux
/dev/sdb7 1961 2610 5221093+ 83 Linux ----- 新增逻辑卷
[root@mysql mapper]# partx -a /dev/sdb7
[root@mysql mapper]# pvcreate /dev/sdb7 创建PV
[root@mysql mapper]# vgs 查看你需要扩展的VG
VG #PV #LV #SN Attr VSize VFree
vg_mysql 3 2 0 wz--n- 24.52g 8.00m
[root@mysql mapper]#vgextend vg_mysql /dev/sdb6 扩展VG
[root@mysql mapper]#lvextend -L +5G /dev/mapper/vg_mysql-lv_root 扩展LV
[root@mysql mapper]#resize2fs /dev/mapper/vg_mysql-lv_root 重置vg大小
本文出自 “赶不上的脚步” 博客,请务必保留此出处http://xxmspace.blog.51cto.com/1056016/1557818
linux 逻辑卷扩展