例如想扩展 / 分区
[[email protected] 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
[[email protected] mapper]#fdik -l 查看可用的磁盘
添加逻辑卷
[[email protected] 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 保存
[[email protected] 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 ----- 新增逻辑卷
[[email protected] mapper]# partx -a /dev/sdb7
[[email protected] mapper]# pvcreate /dev/sdb7 创建PV
[[email protected] mapper]# vgs 查看你需要扩展的VG
VG #PV #LV #SN Attr VSize VFree
vg_mysql 3 2 0 wz--n- 24.52g 8.00m
[[email protected] mapper]#vgextend vg_mysql /dev/sdb6 扩展VG
[[email protected] mapper]#lvextend -L +5G /dev/mapper/vg_mysql-lv_root 扩展LV
[[email protected] mapper]#resize2fs /dev/mapper/vg_mysql-lv_root 重置vg大小