原因: root(/)分区只有5.4G,并已经100%被用。而swap分区有2G空间,大多数时候并没用到。
背景:Centos 默认安装,root和swap 都被置于LVM管理,并且他们属于同一个VG(Volume Group)
|
|
|
| [root@l-shc-00425594 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
5.4G 5.4G 0 100% /
/dev/hda1 487M 27M 435M 6% /boot
tmpfs 225M 0 225M 0% /dev/shm
/dev/hdb1 5.0G 1.1G 3.7G 23% /vendor
none 225M 104K 225M 1% /var/lib/xenstored
/dev/hdc 57M 57M 0 100% /media/CDROM
[root@l-shc-00425594 ~]# fdisk -l
Disk /dev/hda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 64 514048+ 83 Linux
/dev/hda2 65 1044 7871850 8e Linux LVM
Disk /dev/hdb: 7516 MB, 7516192768 bytes
16 heads, 63 sectors/track, 14563 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 1 10402 5242576+ 83 Linux
[root@l-shc-00425594 ~]# lvdisplay
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol00
VG Name VolGroup00
LV UUID nt2aLV-i3Rl-vDvT-zDog-0ccW-CPT1-tUSTK3
LV Write Access read/write
LV Status available
# open 1
LV Size 5.50 GB
Current LE 176
Segments 1
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 fIwop8-uT2t-DsLK-Rxqg-Z8r4-7hzu-m16TCl
LV Write Access read/write
LV Status available
# open 1
LV Size 2.00 GB
Current LE 64
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
[root@l-shc-00425594 ~]# cat /proc/swaps
Filename Type Size Used Priority
/dev/mapper/VolGroup00-LogVol01 partition 2097144 0 -1
[root@l-shc-00425594 ~]# swapoff -v /dev/mapper/VolGroup00-LogVol01
swapoff on /dev/mapper/VolGroup00-LogVol01
[root@l-shc-00425594 ~]# lvm lvreduce /dev/mapper/VolGroup00-LogVol01 -L 1G
/dev/hdc: open failed: Read-only file system
WARNING: Reducing active logical volume to 1.00 GB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce LogVol01? [y/n]: y
Reducing logical volume LogVol01 to 1.00 GB
Logical volume LogVol01 successfully resized
[root@l-shc-00425594 ~]# lvm lvreduce /dev/mapper/VolGroup00-LogVol01 -L -512M
/dev/hdc: open failed: Read-only file system
WARNING: Reducing active logical volume to 512.00 MB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce LogVol01? [y/n]: y
Reducing logical volume LogVol01 to 512.00 MB
Logical volume LogVol01 successfully resized
[root@l-shc-00425594 ~]# mkswap /dev/mapper/VolGroup00-LogVol01
Setting up swapspace version 1, size = 536866 kB
[root@l-shc-00425594 ~]# swapon -va
swapon on /dev/VolGroup00/LogVol01
[root@l-shc-00425594 ~]# cat /proc/swaps
Filename Type Size Used Priority
/dev/mapper/VolGroup00-LogVol01 partition 524280 0 -2
[root@l-shc-00425594 ~]# free -m
total used free shared buffers cached
Mem: 450 418 31 0 25 272
-/+ buffers/cache: 120 329
Swap: 511 0 511
[root@l-shc-00425594 ~]# lvextend -L +1.5G /dev/mapper/VolGroup00-LogVol0
VolGroup00-LogVol00 VolGroup00-LogVol01
[root@l-shc-00425594 ~]# lvextend -L +1.5G /dev/mapper/VolGroup00-LogVol00
/dev/hdc: open failed: Read-only file system
Extending logical volume LogVol00 to 7.00 GB
Logical volume LogVol00 successfully resized
[root@l-shc-00425594 ~]# resize2fs /dev/mapper/VolGroup00-LogVol0
VolGroup00-LogVol00 VolGroup00-LogVol01
[root@l-shc-00425594 ~]# resize2fs /dev/mapper/VolGroup00-LogVol00
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/mapper/VolGroup00-LogVol00 is mounted on /; on-line resizing required
Performing an on-line resize of /dev/mapper/VolGroup00-LogVol00 to 1835008 (4k) blocks.
The filesystem on /dev/mapper/VolGroup00-LogVol00 is now 1835008 blocks long.
[root@l-shc-00425594 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
6.8G 5.4G 1.2G 83% /
/dev/hda1 487M 27M 435M 6% /boot
tmpfs 225M 0 225M 0% /dev/shm
/dev/hdb1 5.0G 1.1G 3.7G 23% /vendor
none 225M 104K 225M 1% /var/lib/xenstored
/dev/hdc 57M 57M 0 100% /media/CDROM
|
阅读(960) | 评论(0) | 转发(0) |