Wednesday, January 25, 2012

reduce LVM size

http://www.azhowto.com/2009/02/07/how-to-resize-lvm-running-xen-part-2-decrease-disk-size/

reducing LVM size takes more step than expanding. i already tried and it's works :)


I want to reduce the size of the XenWeb logical volume to 9G. First of all, let me shut it down.
[root@bpehhome2 mapper]# xm shutdown web
[root@bpehhome2 mapper]# pwd
/dev/mapper
[root@bpehhome2 mapper]# kpartx -a /dev/xenvg/XenWeb
[root@bpehhome2 mapper]# ls
control     xenvg-XenAuth           xenvg-XenWeb    xenvg-XenWebp2  XenWeb2
xenvg-root  xenvg-XenCentOSInstall  xenvg-XenWeb1   xenvg-XenWebp3  XenWeb3
xenvg-swap  xenvg-XenDebianDefault  xenvg-XenWebp1  XenWeb1
OK, let’s reduce the partition XenWeb2 size. I want XenWeb2 to be 9000M, but when I do the resize, I need to bring it abit lower, say 8500M. You will see why later.
[root@bpehhome2 mapper]# resize2fs XenWeb2 8500M
resize2fs 1.39 (29-May-2006)
Please run 'e2fsck -f XenWeb2' first.

[root@bpehhome2 mapper]# e2fsck -f XenWeb2
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
/: 246385/2395520 files (1.0% non-contiguous), 1044750/2469993 blocks

[root@bpehhome2 mapper]# resize2fs XenWeb2 8500M
resize2fs 1.39 (29-May-2006)
Resizing the filesystem on XenWeb2 to 2176000 (4k) blocks.
The filesystem on XenWeb2 is now 2176000 blocks long.
Its time to resize the logical volumn
[root@bpehhome2 mapper]# lvresize -L 9000M /dev/xenvg/XenWeb
  Rounding up size to full physical extent 8.81 GB
  WARNING: Reducing active and open logical volume to 8.81 GB
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce XenWeb? [y/n]: y
  Reducing logical volume XenWeb to 8.81 GB
  Logical volume XenWeb successfully resized

additional information:
http://www.azhowto.com/2009/02/06/how-to-resize-lvm-running-xen-explained-part-1-increase-disk-size/
extending LVM size.

No comments:

Related Posts Plugin for WordPress, Blogger...