如果需要将一个已经挂载的分区进行容量缩小,将腾出的容量划分成其他分区,需要怎么做呢?下面为详细步骤:
1.卸载
#touch /opt/test.txt -->写入一些文件
#umount /opt
2.文件系统检查
# fsck -f /dev/mapper/VolGroup00-LogVol00_opt
fsck 1.39 (29-May-2006)
e2fsck 1.39 (29-May-2006)
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/VolGroup00-LogVol00_opt: 41641/135479296 files (0.7% non-contiguous), 31756336/270958592 blocks
3.调整文件系统的大小
# resize2fs /dev/mapper/VolGroup00-LogVol00_opt 500G -->将VolGroup00-LogVol00_opt瘦小到500G
resize2fs 1.39 (29-May-2006)
Resizing the filesystem on /dev/mapper/VolGroup00-LogVol00_opt to 131072000 (4k) blocks.
The filesystem on /dev/mapper/VolGroup00-LogVol00_opt is now 131072000 blocks long.
4.裁减逻辑卷
# lvreduce -L 500G /dev/mapper/VolGroup00-LogVol00_opt
WARNING: Reducing active logical volume to 500.00 GB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce LogVol00_opt? [y/n]: y
Reducing logical volume LogVol00_opt to 500.00 GB
Logical volume LogVol00_opt successfully resized
5.再次检查文件系统是否出现错误
# fsck -f /dev/mapper/VolGroup00-LogVol00_opt
fsck 1.39 (29-May-2006)
e2fsck 1.39 (29-May-2006)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Chaaaaecking group summary information
/dev/mapper/VolGroup00-LogVol00_opt: 41641/65536000 files (0.7% non-contiguous), 29561045/131072000 blocks
6.挂载
# mount -t ext3 /dev/mapper/VolGroup00-LogVol00_opt /opt
# df -h
/dev/mapper/VolGroup00-LogVol00_orabak 493G 198M 467G 1% /orabak
Yau's 10:44:54
增加:lvextend -n /dev/mapper/VolGroup00-orabak -L +100G
resize2fs /dev/mapper/VolGroup00-orabak
十年磨一剑,厚积薄发!
1.网站具有丰富的数据库实战方案,系统运维方案,高价值精品视频教程等;
2.注册会员可以发布自己的文章资源,赚取稿费!详情请访问并关注PC端: https://dbs-service.cn/
会员QQ群:532272497
手机/微信:13926108245
按左上角首页图标返回获得更多内容!
发表评论 取消回复