linux中LV缩小逻辑卷产生的错误

一、容量缩小:

应该先缩小文件系统后再缩小逻辑卷,否则在进行lv逻辑卷缩小时产生文件系统大小与物理分区不匹配的错误

The filesystem size (according to the superblock) is 307200 blocks
The physical size of the device is 204800 blocks
Either the superblock or the partition table is likely to be corrupt!

此时,只能将逻辑卷扩容为缩小前大小,重新操作。

 

回收容量的一般方法为:

1,卸载挂载:

[root@qsing_redhat mnt]# umount /mnt/vo

2,检查文件系统的完整性

qsing_redhat mnt]# e2fsck -f /dev/storage/vo
e2fsck 1.42.9 (28-Dec-2013)
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

3,缩小文件系统(200M)

[root@qsing_redhat mnt]# resize2fs /dev/storage/vo 200M
resize2fs 1.42.9 (28-Dec-2013)
Resizing the filesystem on /dev/storage/vo to 204800 (1k) blocks.
The filesystem on /dev/storage/vo is now 204800 blocks long.

4,缩小逻辑卷(200M)

[root@qsing_redhat mnt]# lvreduce -L 200M /dev/storage/vo
  WARNING: Reducing active logical volume to 200.00 MiB
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce vo? [y/n]: y
  Reducing logical volume vo to 200.00 MiB
  Logical volume vo successfully resized

5,重新挂载文件系统并查看系统状态。

[root@qsing_redhat mnt]# mount /dev/storage/vo /mnt/vo

[root@qsing_redhat mnt]# df -h
Filesystem              Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root    18G  3.0G   15G  17% /
devtmpfs                905M     0  905M   0% /dev
tmpfs                   914M  140K  914M   1% /dev/shm
tmpfs                   914M  8.9M  905M   1% /run
tmpfs                   914M     0  914M   0% /sys/fs/cgroup
/dev/sda1               497M  119M  379M  24% /boot
/dev/sr0                3.5G  3.5G     0 100% /run/media/root/RHEL-7.0 Server.x86_64
/dev/mapper/storage-vo  190M  1.6M  175M   1% /mnt/vo

 

二,扩容的基本方法和容量回收一样

扩展逻辑卷基本步骤:

1,卸载挂载

2,扩展逻辑卷

[root@qsing_redhat mnt]# lvextend -L 300M /dev/storage/vo

3,检查文件系统

e2fsck -f /dev/storage/vo

4,扩展文件系统

resize2fs /dev/storage/vo

 

你可能感兴趣的:(linux,LVM,linux)