现在的位置: 首页 > 综合 > 正文

linux下 根目录扩展

2012年05月27日 综合 ⁄ 共 2042字 ⁄ 字号 暂无评论
孙国栋广告

[root@a ~]# df
文件系统 1K-块 已用 可用 已用% 挂载点
/dev/mapper/VolGroup00-LogVol00
6983168 2909812 3712908 44% /

系统分区的VG是VolGroup00,VL是LogVol00

这里我们增加一块硬盘/dev/sdb

将/dev/sdb建立为pv

[root@a ~]# pvcreate /dev/sdb
Physical volume "/dev/sdb" successfully created

由于系统已经有了VG:VolGroup00,这里直接将新建的pv加入到系统VG:VolGroup00

[root@a ~]# vgextend VolGroup00 /dev/sdb
Volume group "VolGroup00" successfully extended

给LogVol00系统LV增加1G的空间

[root@a ~]# lvextend -L +1G /dev/VolGroup00/LogVol00
Extending logical volume LogVol00 to 7.88 GB
Logical volume LogVol00 successfully resized

LV扩容之后需要激活修改的配置

[root@a ~]# resize2fs /dev/VolGroup00/LogVol00
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required
Performing an on-line resize of /dev/VolGroup00/LogVol00 to 2064384 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol00 is now 2064384 blocks long.

查看扩容之后的系统分区

[root@a ~]# df -l
文件系统 1K-块 已用 可用 已用% 挂载点
/dev/mapper/VolGroup00-LogVol00
7998912 2909816 4676232 39% /

/挂载点的总容量增加了1G,扩容成功

再来查看VolGroup00参数

[root@a ~]# vgdisplay -v VolGroup00
Using volume group(s) on command line
Finding volume group "VolGroup00"
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 7
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 10.84 GB
PE Size 32.00 MB
Total PE 347
Alloc PE / Size 284 / 8.88 GB
Free PE / Size 63 / 1.97 GB //还有剩余空间可以分配
VG UUID vPFrNV-lcZz-ZiAA-oZpt-VqWZ-gIC3-RCuJG7

--- Logical volume ---
LV Name /dev/VolGroup00/LogVol00
VG Name VolGroup00
LV UUID 9QP8xz-w6dQ-luU0-y52W-1vct-1BvG-zKjLO8
LV Write Access read/write
LV Status available
# open 1
LV Size 7.88 GB
Current LE 252
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0

--- Logical volume ---
LV Name /dev/VolGroup00/LogVol01
VG Name VolGroup00
LV UUID DWTtvU-SwNi-6Vho-HetD-O2a0-hSRV-F8AYi1
LV Write Access read/write
LV Status available
# open 1
LV Size 1.00 GB
Current LE 32
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1

--- Physical volumes --- //在这个VG中有两块物理硬盘
PV Name /dev/sda2
PV UUID 594r8z-ROTL-2VBc-DPlr-f4iG-Blx5-Vu1I81
PV Status allocatable
Total PE / Free PE 252 / 0

PV Name /dev/sdb
PV UUID 1R1H2t-f2DP-hYCQ-hkBE-HtmD-2kZy-2Bj4TY
PV Status allocatable
Total PE / Free PE 95 / 63

给我留言

留言无头像?