SUSE Conversations


How to Resize Xen File Based Disk VMs (EXT3 or REISER) on SLES 10 SP1



By: abahuh

May 16, 2008 4:24 pm

Reads:935

Comments:3

Rating:4.0

I’ve been looking to find a posting online into resizing XEN file based VMs with no luck. I was playing around this weekend and was finally able to get them resized!!!!!!! Finally.

I thought I’ll post it here if anyone is interested.

My Setup:
DOM0 = SLES 10 SP1.
VM1 = 5GIG file (non-sparse). It has 2 partitions. SWAP and REISER
VM2 = 5 GIG file (non sparse) …2 partitions SWAP and EXT3

If you have the standard SLES 10 SP1, then you most likely have parted 1.6

Download a new version of parted from their website (1.8)
http://www.gnu.org/software/parted/download.shtml

To install parted you will need to have the following programs installed in YaST (The reiser stuff is just to resize the reiser partitions)………….

gcc
E2fsprogs
E2fsprogs-devel
Libreiserfs-devel
Libresierfs
reiserfs

INSTALL PARTED………..
./configure –without-readline
Make
Make install

Add size to the disks…………
Dd if=/dev/zero bs=1G count=5 >> disk0 (this adds 5 gigs)
Mount filesystem to local xen…………..
Xm block-attach 0 ‘file:/xen/images/disk0’ xvda w
Find partitions…………..
Fdisk –ul /dev/xvda
Should show partitions now (eg xvda1 xvda2 with sizes and type etc etc)

DO filesystem check
If ext2 or ext3 then
E2fsck –f /dev/xvda2
If reiser
Reiserfsck /dev/xvda2

Run parted now…………..
You already have the old RPM parted installed on your system. So to use the new parted type….
/usr/local/sbin/parted
To check version……..
/usr/local/sbin/parted -v

Resize Disk ………………….
/usr/local/sbin/parted /dev/xvda
Type -> Print
Select partition to resize
Pick start and stop ….usually default start
Pick stop to match new size …..eg 19000MB
Type -> q (quit)

Run another check …..check above ….depending on filesystem

Do expansion ……………
If ext2/ext3 do ………
Resize2fs /dev/xvda2
If Reiser do …….
Resize_reiser /dev/xvda2

Then detach device………
Xm block-list 0 (Look to see the ID eg 51729 )
Xm block-detach 0 “51729” –f

………..
Start your machine …check size with df –h

Daniel Seales
Novell CLP

VN:F [1.9.22_1171]
Rating: 4.0/5 (1 vote cast)
How to Resize Xen File Based Disk VMs (EXT3 or REISER) on SLES 10 SP1, 4.0 out of 5 based on 1 rating

Tags: ,
Categories: SUSE Linux Enterprise Server, Technical Solutions, Virtualization

Disclaimer: As with everything else at SUSE Conversations, this content is definitely not supported by SUSE (so don't even think of calling Support if you try something and it blows up).  It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.

3 Comments

  1. By:leraly

    Hi Daniel,

    You could also install parted from the OpenSuSE Build Service.

    http://software.opensuse.org/search

    If you search for parted on SLES/SLED10 you’ll see someone already made a package of the 1.8 release

  2. By:Bambid

    Bad for me, I was to slow, have same idea to post on Cool Solutions about resizing of XEN image files :o(.

    In my solution I use fdisk for changing partition size, you get same result as with parted.

    I don´t tried to resize Reiser, but EXT3.

    When you resize EXT3, you should disable journaling :

    tune2fs -O ^has_journal /dev/...

    before you do resize. And after that enable it :

    tune2fs -j /dev/...

    It´s safer.

    David

  3. By:lovance

    While working on this I noticed the command was wrong it errored out when I typed resize_reiser /dev/xvda2. It worked fine with resize_reiserfs /dev/xvda2.

    Also this command Xm block-attach 0 ‘file:/xen/images/disk0’ xvda w when I ran the command from the pathway and just the file name it failed. Just fyi even in the directory with the disk0 I had to use the full pathway.

Comment

RSS