使用lvreduce进行容量裁剪

如果需要将一个已经挂载的分区进行容量缩小,将腾出的容量划分成其他分区,需要怎么做呢?下面为详细步骤:
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: Checking 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
 
 
 


来自为知笔记(Wiz)


你可能感兴趣的:(使用lvreduce进行容量裁剪)