如何扩容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磁盘分区

linux下创建LV逻辑卷并挂载磁盘过程

买了个KT服务器,KT官方技术只给/home分了2G,也是醉了。教程参考http://jingyan.baidu.com/article/6079ad0e9d7d9e28fe86db11.html

创建PV:

扫面系统PV:pvscan

查看PV:pvdisplay

[root@DQ5620-C5-4-SAS ~]# pvscan
PV /dev/sda2 VG rootvg lvm2 [464.47 GiB / 425.47 GiB free]
Total: 1 [464.47 GiB] / in use: 1 [464.47 GiB] / in no VG: 0 [0 ]
[root@DQ5620-C5-4-SAS ~]# pvdisplay
— Physical volume —
PV Name /dev/sda2
VG Name rootvg
PV Size 464.48 GiB / not usable 16.00 MiB
Allocatable yes
PE Size 32.00 MiB
Total PE 14863
Free PE 13615
Allocated PE 1248
PV UUID pU8XYG-Au6O-vNrY-CMMa-2dzD-MuVP-ywykAh

继续阅读linux下创建LV逻辑卷并挂载磁盘过程