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

By: abahuh

May 16, 2008 4:24 pm





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)

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


./configure –without-readline
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….
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 … 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

0 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 5 (0 votes, average: 0.00 out of 5)
You need to be a registered member to rate this post.

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

Disclaimer: As with everything else in the SUSE Blog, 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.


  1. By:leraly

    Hi Daniel,

    You could also install parted from the OpenSuSE Build Service.

    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.


  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.