WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-users

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

To: John Haxby <john.haxby@xxxxxxxxxx>
Subject: Re: [Xen-users] what's correct way of shrinking LVM based domU?
From: Rudi Ahlers <Rudi@xxxxxxxxxxx>
Date: Tue, 24 Jun 2008 11:32:28 +0200
Cc: xen-users <xen-users@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Tue, 24 Jun 2008 02:32:53 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <4860BD4C.6050305@xxxxxxxxxx>
List-help: <mailto:xen-users-request@lists.xensource.com?subject=help>
List-id: Xen user discussion <xen-users.lists.xensource.com>
List-post: <mailto:xen-users@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
Organization: SoftDux
References: <4860BACE.8090205@xxxxxxxxxxx> <4860BD4C.6050305@xxxxxxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.14 (Windows/20080421)
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