oe7drt-website/content/posts/2024/72-increase-disksize-of-a-vm/index.md

1.6 KiB

title summary date lastmod categories tags
Increase the disksize of a VM (on Unraid) Another quick'n'dirty note on how I finally enhanced the diskspace of my local mastodon test-instance placed as a virtual machine on my Unraid server. <small>The thumbnail was created with Google AI (Imagen 3).</small> 2024-12-05T22:11:24+01:00 2024-12-08T12:05:22+0000
computerstuff
command-line
linux
server
unraid

Following these steps should suffice.

  • First of all, shutdown the VM

  • Get some info about the image (I use a raw disk usually)

    $ qemu-img info -f raw vdisk1.img
    
  • Resize the image (add 40 gigabytes)

    $ qemu-img resize -f raw vdisk1.img +40G
    
  • Start the VM and log into a terminal on the VM

  • Resize the filesystems partition up to 100%

    $ sudo parted /dev/vda resizepart 2 100%
    
  • Extend the filesystem on the resized partition (I use btrfs here)

    $ sudo btrfs filesystem resize max /
    

    {{< alert "circle-info" >}} Additional information for other filesystems
    For the classic ext4 filesystem it should be (not tested yet):

    $ sudo resize2fs /dev/vda2
    

    {{< /alert >}}

  • Reboot the VM

That's it. Following a few sources: