4 Resizing a partition

It is best to resize a partition that is not mounted. As a result, you need to boot the VM with the live CD. You can download the ISO image from http://power.arc.losrios.edu/ auyeunt/debinstaller.iso. Be sure to specify this to be the image to use with the -cdrom option. Also, use -boot d to make the VM boot from the CD drive.

Select “Live” (the first option) from the installer CD. This will start up Linux in the VM without mounting the hard disk image file.

To extend the file system in a partition, we need to first extend the partition. There is no easy way to do this. Following these steps carefully:

The previous command changes the size of the partition to use the entire hard disk. However, the file system still does not “know” about the extra space available. Before we extend the file system, we should first make sure the original file system is intact. You can do this using the following command:

sudo e2fsck -f /dev/hda1  
  

To actually extend the file system to match the size of the partition, you need to use the following command.

sudo resize2fs /dev/hda1  
  

This step may take a little bit of time. However, after a bit of waiting, the whole procedure is done!