Howto: Resize Xen Loop Disk Image

Win4lin, KVM, QEMU, Virtualbox and Xen are all widely used technologies, used in virtual servers. Fairly often a virtual server run from within a loop filesystem and generally start with a fairly small file (1GB is big for a normal file, but not when it is pretending to be an entire filesystem!)

However things often grow over time.

Here is a nice simple procedure for increasing the size of a loop filesystem, if the filesystem is ext2 or ext3 (the procedure should work for ext4 too, but I havn’t tested it yet)

1. Stop the virtual server that is using the loop filesystem
2. Add some extra space to your loop filesystem file
# dd if=/dev/zero bs=1024k count=1024 >> loop_image_file

This adds 1GB to the end of a file called loop_image_file (make sure to use the append output redirector >> not a single >, otherwise you’ll have an empty 1GB file!)

3. Force a check on the resized/increased filesystem
# e2fsck -f loop_image_file

4. Resize the filesystem within the loop filesystem file
# resize2fs loop_image_file

5. Start the virtual server again

Comments off

MySQL Optimization and Performance Tips

    • Store IP addresses as INT, not CHAR – by using INET_ATON to convert from a string to an integer and by using INET_NTOA to convert from an integer to a string
    • Use non-persistent connection, since they are light-weight – much faster create than compared Oracle or PostgreSQL
    • Use the right storage engine; this means for example the ARCHIVE-engine for logs and other kind of INSERT-only operations, and the MEMORY-engine for fast in-memory data that should go away on server restart

More general MySQL optimization and performance tips are available in this Slideshow.

Comments off