TL;DR

My Yunohost server that hosts Nextcloud, FreshRSS, Mantis, Navidrome, Uptime Kuma, Wireguard and some other misc. apps, ran out of space. Here are my notes how to increase disk size. Writing it down because I’ll forget until the next time.

Resizing process

My Yunohost runs as a virtual machine that runs on Proxmox server. I noticed it is out of space because I couldn’t update apps.

The procedure for increasing the disksize:

1. I increased the disk size of the VM from Proxmox UI

    Proxmox VM UI –> Hardware –> Hard disk –> Disk Action menu –> Resize –> Size increment –> entered a number.

    proxmox VM disk resize menu

    VM is unaware of this change. If I type df -h from within the VM, it still shows the same size as before.

    2. Messing with partitions using parted command

    Checking the disk’s mount points:

    >findmnt /

    This returns partition mount point.

    and

    >lsblk -o NAME,SIZE,FSTYPE,MOUNTPOINTS

    NAME SIZE FSTYPE MOUNTPOINTS
    sda 42G
    └─sda1 42G ext4 /
    sr0 670M iso9660

    this returns partitions.

    3. Then I entered the parted tool:

    >parted /dev/sda
    >print
    
    parted /dev/sda
    GNU Parted 3.5
    Using /dev/sda
    Welcome to GNU Parted! Type 'help' to view a list of commands.
    (parted) print                                                            
    Model: QEMU QEMU HARDDISK (scsi)
    Disk /dev/sda: 45.1GB
    Sector size (logical/physical): 512B/512B
    Partition Table: msdos
    Disk Flags: 
    
    Number  Start   End     Size    Type     File system  Flags
     1      1049kB  45.1GB  45.1GB  primary  ext4         boot
    
    (parted)        

    (This shows already a final state. Previously, I had also one extended partition (2) and swap partition(5)).

    4. Before resizing I had to delete extended partition and swap1:

    I left parted (q), then turned off swap partiton:

    >sudo swapoff /dev/sda5
    >swapon --show

    5. Deleted extended and swap:

    Entered parted again and:

    >sudo parted /dev/sda
    >print
    >rm <extended part. number>
    
    > resizepart <primary part number>
    

    6. Then I resized the filesystem:

    Left parted and :

    >sudo resize2fs /dev/sda1

    7. Checked disk space:

    >df -h /

    Now it shows the correct disk space.

    8. Then I made swap file instead of swap partition:

    >sudo fallocate -l 1G /swapfile
    >sudo chmod 600 /swapfile
    >sudo mkswap /swapfile
    >sudo swapon /swapfile
    >swapon --show
    

    9. Edited fstab to remove swap partition mount:

    >sudo nano /etc/fstab

    Fstab file/system commands what gets mounted at the startup:

    # ....excerpt:
    
    # swap was on /dev/sda5 during installation
    #UUID=2060684a-.. none            swap    sw              0       0 #<-- commented this line from UUID on
    
    /swapfile none swap sw 0 0 # <-- added this line
    
    #...

    Save, exit (ctrl-s, ctrl-x).

    10. Then I checked what consumes disk space in a norton commander style2:

    ncdu / -x
    ncdu command showing disk space consumed by directories

    I like it because I can move through directories and sub-directories using arrow keys.

    I did everything on a live, running machine which didn’t complain.

    Lastly, I restarted the Yunohost from its web UI.

    I can install updates and new apps again.

    Footnotes

    1. From: https://forum.yunohost.org/t/how-to-resize-the-root-partition-after-disk-upgrade/17131/3 ↩︎
    2. From: https://forum.yunohost.org/t/how-to-check-each-app-disk-ssd-usage/29619/6 ↩︎