--- title: Increase the disksize of a VM (on Unraid) summary: > 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. The thumbnail was created with Google AI (Imagen 3). date: 2024-12-05T22:11:24+01:00 lastmod: 2024-12-08T12:39:55+0000 categories: - computerstuff tags: - command-line - linux - selfhost - 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) ```console $ qemu-img info -f raw vdisk1.img ``` - Resize the image (add 40 gigabytes) ```console $ 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% ```console $ sudo parted /dev/vda resizepart 2 100% ``` - Extend the filesystem on the resized partition (I use btrfs here) ```console $ sudo btrfs filesystem resize max / ``` {{< alert "circle-info" >}} **Additional information for other filesystems** For the classic ext4 filesystem it should be (not tested yet): ```console $ sudo resize2fs /dev/vda2 ``` {{< /alert >}} - Reboot the VM That's it. Following a few sources: - https://gist.github.com/zakkak/ab08672ff9d137bbc0b2d0792a73b7d2 - https://linuxiac.com/how-to-resize-extend-kvm-virtual-disk-size/ - https://unix.stackexchange.com/questions/373063/auto-expand-last-partition-to-use-all-unallocated-space-using-parted-in-batch-m