Resizing a Linux disk image file

Here’s a quick how-to on creating a larger Linux disk image file and transferring the contents of an existing image to it.  For example, most of the Xen images on this site are 1 GB – but you probably would want them to be much larger if you were going to actually *use* them.  Here’s what to do:

  1. Create a new disk image fileUsing the dd command, create a blank image file of whatever size you need (I’ll use 5 GB as an example here):
    dd if=/dev/zero of=new_image.img bs=1 count=1 seek=5G
  2. Format the disk image

    In this case, I’ll use the ext4 filesystem.  You’ll get a warning because you are formatting something that is not a block device (disk).  Just say yes when it asks you to proceed anyway.
    Continue reading this post »



Tuning Solid State Drives in Linux

There are a few guides out there with tweaks on how to make your solid-state drive (SSD) run faster or last longer in Linux.  While researching TRIM support in SSD firmware and the Linux kernel, I wasn’t able to find all the information I needed in one place.  Here is a guide I put together based on my experiences, which will hopefully be helpful to some other people in the same situation

1. Filesystem Choice – ext4 without journaling

A lot of the older SSD+Linux guides recommend using the ext2 filesystem because it avoids the extra writes of a journaling filesystem like ext3 or ext4, which will extend the life of your drive.  With the advent of TRIM support (see below), ext2 is probably not the best choice.  Yes, TRIM commands can be run on ext2 filesystems, but with two drawbacks:

Continue reading this post »