sunnuntaina, marraskuuta 01, 2020

How to increase unraid VM HDD size

First you need to locate vmdisk.img file.

Then run this command: qemu-img resize vdisk1.img +5G. This add 5gb more space.

Then inside that virtual machine...

  • Extend the physical drive partition:
    • sudo fdisk /dev/vda – Enter the fdisk tool to modify /dev/vda
      NOTE: End each one letter command by pressing [Enter]; if the instructions do not specify a specific response to a question, just press [Enter] to accept the default
    • p – p command prints the disk info, same as running fdisk -l /dev/vda
    • d – d command delete the last partition (in this case, /dev/vda1)
    • n e n command creates a new partition; e makes that an extended partition
    • t – t changes the type of partition
      8e – Enter 8e (lvm) as the partition type
      NOTE: In some cases the disk uses GPT signature rather than DOS. In that case, use the 31 (lvm) as the partition type
    • w – w writes the changes to disk and exits fdisk
  • Modify (extend) the LVM:
    • Tell LVM the physical partition size has changed: sudo pvresize /dev/vda1
    • Find the actual path of the LVM logical volume: sudo lvdisplay – The LV Path is value needed
    • Tell LVM to extend the logical volume to use all of the new partition size: sudo lvextend -l +100%FREE /dev/COMPbase-vg/root – Using the LV Path from above
  • Resize the file system:
    sudo resize2fs /dev/COMPbase-vg/root