由于之前分的lv太大所以想缩小一些 腾出点空间给其它用
要减小lvm的文件系统 需要文件系统在umount状态下修改 所以在线不要去改重要文件系统
操作步骤如下:
1.查看挂载的文件系统和lv
df -h 查看文件系统 ,下面是我要更改的文件系统。这里是99G
/dev/mapper/vg_LogVol01
99G 188M 94G 1% /home
lvdisplay 下面是文件系统对应的逻辑卷(lv)
--- Logical volume ---
LV Name /dev/vg_test/LogVol01
VG Name vg_test
LV UUID cXylir-3KNW-UQ8a-kXos-fuIy-NAx2-0DJ5Fw
LV Write Access read/write
LV Status available
# open 1
LV Size 100.00 GiB
Current LE 800
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2
2. 卸载文件系统
umount /dev/mapper/vg_LogVol01
3. 查看是否卸载 df -h 文件系统已经没有了
4.文件系统检查 确认没有坏块
e2fsck -f /dev/mapper/vg_LogVol01
e2fsck 1.41.12 (17-May-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/mapper/vg_LogVol01: 11/6553600 files (0.0% non-contiguous), 459
349/26214400 blocks
5.缩小文件系统 到20g
resize2fs /dev/mapper/vg_LogVol01 20G
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/mapper/vg_LogVol01 to 5242880 (4k) b
locks.
The filesystem on /dev/mapper/vg_LogVol01 is now 5242880 blocks long
6.缩小逻辑卷
lvreduce -L 20G /dev/vg_test/LogVol01
WARNING: Reducing active logical volume to 20.00 GiB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce LogVol01? [y/n]: y
Reducing logical volume LogVol01 to 20.00 GiB
Logical volume LogVol01 successfully resized
7.挂载上文件系统
mount /dev/mapper/vg_LogVol01
8.通过df -h 和lvdisplay来查看是否已经修改
.
阅读(12086) | 评论(0) | 转发(1) |