lvreduce减少逻辑卷容量报错

今天在测试Linux的LVM,在用lvreduce命令对之前的逻辑卷减少容量,并重启挂载,出现容量已经减少,但是df -h显示lvm挂载的/other分区的容量依然没有变,搜遍了Google和百度,没有找到答案。
后来经过自己两天时间的摸索,终于知道了解决方法:
说明:/dev/myvg/mylv是我创建的逻辑卷,该逻辑卷挂在/other分区(3.8G)下。

[root@CentOS ~]# umount /dev/myvg/mylv
[root@CentOS ~]# lvreduce -L -800M /dev/myvg/mylv
/dev/cdrom: open failed: Read-only file system
WARNING: Reducing active logical volume to 3.00 GB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce mylv? [y/n]: y
Reducing logical volume mylv to 3.00 GB
Logical volume mylv successfully resized
[root@CentOS ~]# resize2fs -f /dev/myvg/mylv
resize2fs 1.39 (29-May-2006)
Resizing the filesystem on /dev/myvg/mylv to 786432 (4k) blocks.
resize2fs: Can't read an block bitmap while trying to resize /dev/myvg/mylv
[root@CentOS ~]# mount /dev/myvg/mylv /other
[root@CentOS ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda8 965M 200M 716M 22% /
/dev/hda6 1.6G 132M 1.4G 9% /var
/dev/hda5 1.6G 676M 823M 46% /usr
/dev/hda3 1.6G 35M 1.5G 3% /home
/dev/hda1 99M 17M 78M 18% /boot
tmpfs 395M 0 395M 0% /dev/shm
/dev/mapper/myvg-mylv
3.8G 71M 3.6G 2% /other //此处仍然显示的是没有进行缩减以前的容量3.8G
[root@CentOS ~]# umount /dev/myvg/mylv
[root@CentOS ~]# mkfs.ext3 /dev/myvg/mylv
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
393216 inodes, 786432 blocks
39321 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=805306368
24 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912

Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 21 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

[root@CentOS ~]# mount /dev/myvg/mylv /other
[root@CentOS ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda8 965M 200M 716M 22% /
/dev/hda6 1.6G 132M 1.4G 9% /var
/dev/hda5 1.6G 676M 823M 46% /usr
/dev/hda3 1.6G 35M 1.5G 3% /home
/dev/hda1 99M 17M 78M 18% /boot
tmpfs 395M 0 395M 0% /dev/shm
/dev/mapper/myvg-mylv
3.0G 71M 2.9G 2% /other // /other分区容量已变

搞定!
经过这次出现的问题,使我也对lvm的认识又加深了一小步。:)

你可能感兴趣的:(reduce)