update and publish old post about increasing a VMs disk size
This commit is contained in:
parent
10020d8847
commit
abc75877b0
1 changed files with 54 additions and 33 deletions
|
@ -1,42 +1,63 @@
|
||||||
---
|
---
|
||||||
title: 72 increase disksize of a vm
|
title: Increase the disksize of a VM (on Unraid)
|
||||||
summary: >
|
summary: >
|
||||||
Howdy.
|
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>
|
<small>The thumbnail was created with Google AI (Imagen 3).</small>
|
||||||
date: 2024-12-05T22:11:24+01:00
|
date: 2024-12-05T22:11:24+01:00
|
||||||
lastmod: 2024-12-08T11:14:36+0000
|
lastmod: 2024-12-08T12:05:22+0000
|
||||||
categories:
|
categories:
|
||||||
- amateur-radio
|
|
||||||
- computerstuff
|
- computerstuff
|
||||||
tags:
|
tags:
|
||||||
- draft_post
|
- command-line
|
||||||
|
- linux
|
||||||
# showBreadcrumbs: true
|
- server
|
||||||
# showDate: false
|
- unraid
|
||||||
# showReadingTime: false
|
|
||||||
# showWordCount: false
|
|
||||||
# showPagination: false
|
|
||||||
|
|
||||||
# feed_exclude: true
|
|
||||||
# site_exclude: true
|
|
||||||
|
|
||||||
# some help
|
|
||||||
#
|
|
||||||
# highlighting with highlights
|
|
||||||
#
|
|
||||||
# use table, as inline creates a padding around
|
|
||||||
# and it pushes the text more to the right side (end of screen)
|
|
||||||
#
|
|
||||||
# ~~~html {linenos=table,hl_lines="3-6"}
|
|
||||||
# ~~~html {linenos=inline,hl_lines="1,3-6"}
|
|
||||||
|
|
||||||
draft: true
|
|
||||||
---
|
---
|
||||||
|
|
||||||
- shutdown VM
|
Following these steps should suffice.
|
||||||
- `qemu-img info -f raw vdisk1.img`
|
|
||||||
- `qemu-img resize -f raw vdisk1.img +40G`
|
- First of all, shutdown the <abbr title="virtual machine">VM</abbr>
|
||||||
- start Vm and login in terminal
|
- Get some info about the image (I use a raw disk usually)
|
||||||
- `sudo parted /dev/vda resizepart 2 100%`
|
|
||||||
- `sudo btrfs filesystem resize max /`
|
```console
|
||||||
- reboot
|
$ 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
|
||||||
|
|
Loading…
Reference in a new issue