[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-users] what's correct way of shrinking LVM based domU?



John Haxby wrote:
Rudi Ahlers wrote:
Hi all

I want to shrink one of my LVM based domU's, but don't quite know how to do it.

I have searched the Wiki & HOWTO's, and they all show you how expand / enlarge a LVM based domU, but not shrinking it.

It's the opposite, literally, of growing.
So, I stopped (destroyed) the domU, and then resized it as follows: lvresize /dev/data/cpanel1 -L10GB (It was 100GB), but when I a started it up again, I got some errors about the the disk being corrupt, and then a kernel panic.

Looks like you missed out a vital step: you shrunk the logical volume without first shrinking the file system within it. Note that while you can often grow a file system while it is on-line you almost always need the file system off-line in order to shrink it.

In this case, you need to shrink the file system, logical volume (if any), physical volume (if any) and partition in the guest OS _before_ you shrink the logical volume that contains them all in dom0. Of course, you can do all this from dom0 because the file system(s) contain in the logical volume are all off-line.

jch

ok, I don't know LVM at all. This is all a trail and error thing, since my previous installations have been image based and is difficult to resize.

So, what you're saying is that I should do this from the domU itself? But that then means it need to be running?

This is what I have:

[root@cPanel002 ~]# [root@HF-LINSRV01 ~]# lvscan
 ACTIVE            '/dev/data/cpanel002' [100.00 GB] inherit
 ACTIVE            '/dev/data/windows2003_web' [30.00 GB] inherit
 ACTIVE            '/dev/data/storage' [50.00 GB] inherit
 ACTIVE            '/dev/data/cacti' [20.00 GB] inherit
 ACTIVE            '/dev/data/cpanel2' [30.00 GB] inherit
 ACTIVE            '/dev/system/root' [39.06 GB] inherit
 ACTIVE            '/dev/system/swap' [9.75 GB] inherit


I need to resize the 100GB /dev/data/cpanel002

Do I enter the domU, and then resize it's partition first?

[root@HF-LINSRV01 ~]# xm console cPanel002
lvscan
 ACTIVE            '/dev/VolGroup00/LogVol00' [95.59 GB] inherit
 ACTIVE            '/dev/VolGroup00/LogVol01' [1.94 GB] inherit


Does this look right?

[root@cPanel002 ~]# lvresize /dev/VolGroup00/LogVol00  -L -80GB
 WARNING: Reducing active and open logical volume to 15.59 GB
 THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce LogVol00? [y/n]:

I somehow don't trust this....



--

Kind Regards
Rudi Ahlers
CEO, SoftDux

Web:   http://www.SoftDux.com
Check out my technical blog, http://blog.softdux.com for Linux or other 
technical stuff, or visit http://www.WebHostingTalk.co.za for Web Hosting stuff


_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.