how to resize a xen image (or any other fs)

Tagged:  

This is a small recipe to resize a disk image. In this case I wanted to make it bigger.

create a sparse file :

dd if=/dev/zero of=xen.img bs=1k count=1 seek=30M

copy the old file system to the sparse file:

dd if=old-xen.img of=xen.img conv=notrunc

now we resize the fs (reiserfs in this case)

resize_reiserfs xen.img

and we can happily mount it.

mount -o loop xen.img test/

now we have a bigger fs !

# df -h
Filesystem Size Used Avail Use% Mounted on
/home/xen.img 30G 338M 30G 2% /home/test

Reply

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.