如何扩容LV磁盘分区

前面其实也发了2个教程了。http://www.v2kt.com/archives/446.html是新建lv磁盘,然后挂载某个目录,相当于新建一个LV磁盘。http://www.v2kt.com/archives/451.html是存在多余的VG空间,直接可以扩容现有的LV磁盘。本教程是不存在多余的VG空间,要先创建PV,然后扩容VG空间后,再扩容现有的LV分区。

先查看下磁盘分区情况:

root@103 [/]# fdisk -l

Disk /dev/sda: 171.8 GB, 171798691840 bytes
255 heads, 63 sectors/track, 20886 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: 0x000049b5

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 5222 41430016 8e Linux LVM

Disk /dev/mapper/VolGroup-lv_root: 40.3 GB, 40340815872 bytes
255 heads, 63 sectors/track, 4904 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: 0x00000000
Disk /dev/mapper/VolGroup-lv_swap: 2080 MB, 2080374784 bytes
255 heads, 63 sectors/track, 252 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: 0x00000000

再df -h看看文件系统:

root@103 [~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
37G 7.2G 28G 21% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
/dev/sda1 485M 62M 398M 14% /boot
/usr/tmpDSK 1.5G 35M 1.4G 3% /tmp

实际上160G的磁盘,根目录只挂载了37G,客户是做虚拟主机业务的,当然磁盘越大越好,肿么办?只有把现有的LV磁盘VolGroup-lv_root分区搞大,才是硬道理。也就是扩容下LV磁盘。

继续阅读如何扩容LV磁盘分区