Chinaunix首页 | 论坛 | 博客
  • 博客访问: 641862
  • 博文数量: 70
  • 博客积分: 145
  • 博客等级: 入伍新兵
  • 技术积分: 1150
  • 用 户 组: 普通用户
  • 注册时间: 2012-10-11 08:15
个人简介

没有简介就是最好的简介

文章分类

全部博文(70)

文章存档

2020年(1)

2018年(2)

2017年(3)

2016年(11)

2015年(12)

2014年(16)

2013年(19)

2012年(6)

我的朋友

分类: LINUX

2015-06-30 16:46:24

原文地址:linux lvm 减小lv的实例 作者:hot815

由于之前分的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来查看是否已经修改






.









阅读(2802) | 评论(0) | 转发(0) |
0

上一篇:linux常见问题

下一篇:powervm日常维护

给主人留下些什么吧!~~