Article

abahuh's picture

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

article
Reads:

8445

Score:
3.8
3.8
5
 
Comments:

2

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





User Comments

leraly's picture

Parted packages

Submitted by leraly on 17 May 2008 - 1:44am.

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

Bambid's picture

Parted and EXT3

Submitted by Bambid on 19 May 2008 - 3:45pm.

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

© 2010 Novell