Introduction
This tutorial was written and tested on a Ubuntu12.04 xen server. As always, results may vary if you are using a different distro.
Stop the virtual machine whose storage needs to be enlarged.
Be smart, take a backup before continuing.
cp /path/to/your/image/VM-HOSTNAME-HERE.img /path/to/your/VM-HOSTNAME-HERE-backup.img
Increase the size of the virtual disk image:
dd if=/dev/zero bs=1G count=1 >> /path/to/your/image/VM-HOSTNAME-HERE.img
This example adds 1GB of additional space to the virtual disk image.
If you want to make the image a LOT larger, you may want to wrap that command in a script like I did for adding 500 gigs
for i in `seq 1 $ADDITIONAL-SIZE-IN-GB`
do
dd if=/dev/zero bs=1G count=1 >> /path/to/your/image/VM-HOSTNAME-HERE.img
done
do
dd if=/dev/zero bs=1G count=1 >> /path/to/your/image/VM-HOSTNAME-HERE.img
done
Resize the filesystem on the disk using the filesystem's resizing tools. In order to make sure the filesystem is clean, force a filesystem check first.
Here is an example for the ext3 filesystem:
Here is an example for the ext3 filesystem:
e2fsck -f the_disk_file
resize2fs the_disk_file
resize2fs the_disk_file
Restart the virtual machine
sudo xm create /etc/xen/VM-HOSTNAME-HERE
No comments:
Post a Comment