SPICE | VM Logical Disk Expansion Guide - UMCST/SPICE-user-info GitHub Wiki

Notes

  • To be safe, power off the Guest OS before performing the following steps. Only power the machine back up after everything that needs to be done on the hypervisor side has been done.

  • A logical disk expansion can only be performed on a Virtual Machine without existing snapshots, so ensure that all previous snapshots have been deleted. The steps to do so follow:

    1. Locate your VM in the Library menu on the left side of the panel
    2. Right click the VM and then mouse over to Snapshot > Snapshot Manager
    3. For each of the snapshots displayed in the manager, select them and then click the delete button located at the edge of the menu
      • Repeat until there are no more snapshots and the origin-dot is directly pointing to the "You Are Here" target
  • Lastly, ensure that you follow the series of steps below that correspond with the OS that you are working with.


Expanding VM Disk in Settings

  1. Open up your hypervisor and log into the SPICE VMConsole.
  2. Find your virtual machine by either moving down the Library hierarchy or by searching for it.
  3. Right-click the VM and mouse over to the "Settings" option.
  4. Once in the menu, you should be able to see the various components of the VM including the Hard Disk. Select this option.
  5. Mouse over to "Expand Disk..." and select it, then allocate the appropriate amount of disk space for the VM
    • If this option is greyed-out, you likely still have some snapshots present on the machine, refer to the Notes section of this guide to learn about how to delete these.
  6. Ensure that the Hard Disk component of the VM reflects your change and then exit the menu. Power the VM back on.
  7. Follow the appropriate series of steps below in accordance with your VM's operating system.

Commands

Linux

  1. Add new disk space to partition
    • sudo cfdisk
      1. select the correct partition (probably sda3)
      2. select resize
      3. select write
      4. confirm write
      5. quit
  2. sudo pvresize /dev/\<name of partition\> (probably sda3)
  3. Extend LVM (Command may differ if LVM configuration is not installer default which is unlikely)
    • Ubuntu: sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
    • Oracle Linux: sudo lvextend -l +100%FREE /dev/ol/root
  4. Resize FS
    • Ubuntu: sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
    • Oracle Linux: sudo xfs_growfs /
  5. df -h

Windows

  1. Bring up run prompt with WinKey + R, type "diskmgmt.msc" and press enter
  2. Right-Click on primary volume (Likely C:) and select "Extend Volume..." option
  3. Bring up run prompt again with WinKey + R, type "compmgmt.msc" and press enter
  4. Right-Click "Disk Management" under "Storage" in the Computer Management Panel on the left side of the window
  5. Click "Rescan Disks"