标签:lvm
1、LVRESIZE
对于lvm,如果是扩大某个lv,操作比较简单,但如果是缩小lv,则有一定的风险。我们先要缩小/dev/myvg/lv2文件系统,然后才能缩小lvm,如果在缩小lvm之前忘了缩小文件系统,这时候可以这样来挽救:
1:不要进行对该分区的任何写入操作,最好是也不read
2:用lvresize2fs重新扩大该分区,且扩大的容量是刚刚缩小的容量(数字一定要和刚刚的一致哈~)。
3:缩小文件系统
4:最后缩小逻辑卷哈。
5:确认文件系统和逻辑卷大小一致。
[root@rhel5 ~]# umount /mnt/mylv2
[root@rhel5 ~]# lvresize -L 150M /dev/myvg/mylv2
Rounding up size to full physical extent 152.00 MB
Extending logical volume mylv2 to 152.00 MB
Logical volume mylv2 successfully resized
[root@rhel5 ~]# e2fsck -f /dev/myvg/mylv2
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/myvg/mylv2: 12/38912 files (8.3% non-contiguous), 10580/155648 blocks
[root@rhel5 ~]# resize2fs /dev/myvg/mylv2 100M
resize2fs 1.39 (29-May-2006)
Resizing the filesystem on /dev/myvg/mylv2 to 102400 (1k) blocks.
The filesystem on /dev/myvg/mylv2 is now 102400 blocks long.
[root@rhel5 ~]# lvresize -L 100M /dev/myvg/mylv2
WARNING: Reducing active logical volume to 100.00 MB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce mylv2? [y/n]: y
Reducing logical volume mylv2 to 100.00 MB
Logical volume mylv2 successfully resized
[root@rhel5 ~]# e2fsck -f /dev/myvg/mylv2
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/myvg/mylv2: 12/26624 files (8.3% non-contiguous), 9032/102400 blocks
[root@rhel5 ~]# mount -t ext3 /dev/myvg/mylv2 /mnt/mylv2
[root@rhel5 ~]#
本文出自 “Directed By Huboss” 博客,请务必保留此出处http://huboss.blog.51cto.com/9883568/1694682
标签:lvm
原文地址:http://huboss.blog.51cto.com/9883568/1694682