我们在使用LINUX系统时候,如果需要将一个已经挂载使用中的分区进行容量缩小,将腾出的容量划分成其他分区,需要怎么做呢?下面为Linux在线收缩lvm逻辑卷的详细步骤(前提是此lvm的剩余空间能足够缩小至操作值):
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
7.另外LVM在线扩容操作:
lvextend -n /dev/mapper/VolGroup00-orabak -L +100G
resize2fs /dev/mapper/VolGroup00-ora
发表评论 取消回复