Monday, 12 October 2009

Adding More Disk Space to a Virtual Machine

This was something I didn't know and as the main function of this blog is to save this sort of stuff for myself for later reference, here's how it can be done when using kvm virtualisation.

There are at least two ways:

  1. Start off by creating a an extended partition of any free space you have (with fdisk) OR create a a file to act as the disk with something like "dd if=/dev/zero of=/path/to/file bs=1024 count=$((10*1024*1024))" (this would create a 10 gigabyte file).
  2. Open virt-manager and go to the virtual machine's Details page. Click the "Add Hardware" button.
  3. Select "Storage" as the hardware type.
  4. If you created the extended partition, enter the device name in the block device text box, or if you created the file, select the file in the disk image box. In both cases, use "IDE disk" as the target.
  5. Start up the virtual machine and create the partition(s) using fdisk.

No comments:

Post a comment