[TUTORIAL] How to effectively increase OMV system disk space in PROXMOX [HOW TO]

roycordero

New Member
Jun 25, 2022
13
4
3
I have read to many OMV users that, like me, one day their sda system disk began to run out of space and despite increasing the space in proxmox, that space is not reflected in OMV

So I made this guide of what has always worked for me hoping that someone will help and at the same time can help me to be able to do the same from the console

increase the disk from 25gb to 40gb in proxmox and the change is immediately reflected in omv

DTEyQIf.jpg




however, in the image it can be seen that despite the fact that the disk is now 40, the partition is still 25gb (or rather 24gb)

laCcxuj.jpg
WCxZJaq.jpg




The next thing I did was see the partitions and since I am not much or hardly at all console or commands, install the kernel plugin and then install the gparted iso to be able to enter gparted from grub and graphically see the omv partitions



ta8HW7x.jpeg




inside gparted i saw the problem

Q5eSXuC.jpeg




the only way to put the swap partition at the end and thus be able to use the 15gb space that I added on the disk in proxmox (unallocated) was, 1 by deleting the swap partition and extended partition and creating them again at the end of the free (unallocated) space for later extend the sda partition to all free space (unallocated) leaving the end like this

vL7gcJ3.jpg



in the end just reboot into the correct system and voila! the 25gb partition is now 40gb,

I should notice that now this always appears at the start
EuorpmO.jpeg




However, it has not affected the operation of omv at all, I imagine that it is due to something that is corrupted when editing the partitions manually, but it is the only way I have found to increase the omv sda partition in proxmox, so if anyone knows how eliminate this error or how to increase the sda partition without doing so much explaining it to be able to recreate it

final results

ZT89SEN.jpeg
2076gEu.jpeg


KUHJejm.jpg




ok now it works, the problem I have is that for some reason in my production omv GPARTED DOES NOT RUN, it gives an error when choosing it in grub and it only stays in the middle of the operation as 'loading' and never opens gparted for I haven't been able to do that in my production OMV because I don't know of any other way to do it...



If someone knows or can help me on how to fix the partitions through the console without having to enter graphically through gparted to do this, I would add it because the sda partition of my production OMV is currently at 89%, I would greatly appreciate it really!

I hope this guide will help people
 
Hi,

thanks for your contribution! Just as a heads-up, you can mark your thread as [Tutorial], this makes it even easier to find and filter for people that want to achieve the same thing. You can change this by editing your Thread and selecting the corresponding title prefix. Thanks!
 
  • Like
Reactions: roycordero
I had to do something slightly different. I had to copy the swap and paste it into the unallocated on the right.
I then was able to delete the swap partition and extend the primary partition.
 
Hey,

i took your tutorial as an example but recreated this in the terminal. I thought i may share my steps, so i could help others to recreate this. I want to point out that situations ca differ, pls always make a backup before you do any of this!

My Case:
I had a 11GB system drive and wanted to extend to 22GB.

My Steps:

  1. BACKUP YOUR VM
    • Please make sure you have a back up before you do anything!
  2. Expand the Disk in Proxmox:
    • As described before, go to the Proxmox UI and extend the size of the disk
    • Server > VM > Hadware > Hard Disk > Disk Action > Resize
  3. Login to your OpenMediaVault VM:
    • SSH into the VM or access its terminal directly.
  4. Turn Swap off:
    Bash:
    sudo swapoff -a
  5. Check Current Disk and Partition Status:
    Bash:
    sudo fdisk -l /dev/vda
    • You may say your system partion, a swap and an extended partition as for me:
    • Bash:
      $ lsblk
      NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
      sr0     11:0    1 1024M  0 rom
      vda    254:0    0   22G  0 disk
      ├─vda1 254:1    0   11G  0 part /
      ├─vda2 254:2    0    1K  0 part
      └─vda5 254:5    0  975M  0 part [SWAP]
      vdb    254:16   0  1,5T  0 disk
      └─vdb1 254:17   0  1,5T  0 part /srv/dev-disk-by-uuid-3821a19b-2c31-4f86-b7ae-2602c57074c8
    • We see that `vda1` is our system that we want to keep, while `vda2` is an extended portion and `vda5` the swap
  6. Delete the Swap and Extended Partition:
    • Enter fdisk:
      Bash:
      sudo fdisk /dev/vda
    • Inside fdisk(in my case, adapt the numbers for your case):
      • Type d to delete a partition.
      • Select the swap partition number (often 5).
      • Type d to delete another partition.
      • Delete the extended partition (often 2).
      • Type w to write changes and exit.
      • My Output:
        Bash:
        Command (m for help): dPartition number (1,2,5, default 5): 5
        
        Partition 5 has been deleted.
        
        Command (m for help): d
        Partition number (1,2, default 2): 2
        
        Partition 2 has been deleted.
        
        Command (m for help): w
        The partition table has been altered.
        Syncing disks.
  7. Extend the existing partition (/dev/vda1):
    • Enter fdisk again:
      Bash:
      sudo fdisk /dev/vda
    • In fdisk:
      • Type d to delete a partition (this might sound scary, but we're going to recreate it immediately and no data will be lost).
      • Choose 1 for `vda1`.
      • Type n for a new partition.
      • Choose p for a primary partition.
      • Accept the default partition number (it should be 1).
      • Set the starting sector to the default (Enter).
      • Define the last sector so you leave enough space for swap. (Swap size can be equivalent to RAM or half, depending on your needs and disk space). If you have 2GB of RAM, you might want to leave 2GB or 1GB for swap.
      • When asked if you want to remove the signature, say No.
      • Type a to make the partition bootable again.
      • Type w to write changes and exit.
      • My Output
        Bash:
        Command (m for help): dSelected partition 1
        Partition 1 has been deleted.
        
        Command (m for help): n
        Partition type
           p   primary (0 primary, 0 extended, 4 free)
           e   extended (container for logical partitions)
        Select (default p): p
        Partition number (1-4, default 1): 1
        First sector (2048-46137343, default 2048):
        Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-46137343, default 46137343): 44165391
        
        Created a new partition 1 of type 'Linux' and of size 21,1 GiB.
        Partition #1 contains a ext4 signature.
        
        Do you want to remove the signature? [Y]es/[N]o: no
        
        Command (m for help): a
        
        Selected partition 1
        The bootable flag on partition 1 is enabled now.
        
        Command (m for help): w
        The partition table has been altered.
        Syncing disks.
  8. Resize the filesystem:
    • Now, resize the filesystem to fill the extended partition:
      Bash:
      sudo resize2fs /dev/vda1
    • My Output:
      Bash:
      $ sudo resize2fs /dev/vda1resize2fs 1.46.2 (28-Feb-2021)
      Filesystem at /dev/vda1 is mounted on /; on-line resizing required
      old_desc_blocks = 2, new_desc_blocks = 3
      The filesystem on /dev/vda1 is now 5520418 (4k) blocks long.
  9. Create a new swap partition:
    • Start fdisk for the disk:
      Bash:
      sudo fdisk /dev/vda
    • Inside fdisk:
      • Type n for a new partition.
      • Choose p for primary partition.
      • Partition number should default to 2 (since vda1 is already in use). Accept the default.
      • For the first sector, use the default (it should automatically be the sector right after vda1 ends).
      • For the last sector, just press Enter to use the remaining space on the disk.
      • Set the partition type to swap:
        • Type t, then select partition 2, and then type 82 for the Linux swap code.
      • Finally, type w to write the changes and exit.
      • My Output:
        Bash:
        Command (m for help): nPartition type
           p   primary (1 primary, 0 extended, 3 free)
           e   extended (container for logical partitions)
        Select (default p): p
        Partition number (2-4, default 2): 2
        First sector (44165392-46137343, default 44167168):
        Last sector, +/-sectors or +/-size{K,M,G,T,P} (44167168-46137343, default 46137343):
        
        Created a new partition 2 of type 'Linux' and of size 962 MiB.
        
        Command (m for help): t
        Partition number (1,2, default 2): 2
        Hex code (type L to list all codes): 82
        
        Changed type of partition 'Linux' to 'Linux swap / Solaris'.
        
        Command (m for help): w
        The partition table has been altered.
        Syncing disks.
  10. Format the new partition as swap:
    Bash:
    sudo mkswap /dev/vda2
    • My Output:
      Bash:
      $ sudo mkswap /dev/vda2
      Setting up swapspace version 1, size = 962 MiB (1008726016 bytes)
      no label, UUID=31320752-79f1-4adb-8bd4-fd841c8d12a1
  11. Activate the swap:
    Bash:
    sudo swapon /dev/vda2
  12. Update /etc/fstab to make the swap partition mount on boot:
    • First, backup your current fstab (safety first):
      Bash:
      sudo cp /etc/fstab /etc/fstab.backup
    • Then, edit the fstab:
      Bash:
      sudo nano /etc/fstab
    • Add the following line to the file, while commenting out the old one with 'swap'
      /dev/vda2 none swap sw 0 0
      • While we're using the direct partition path /dev/vda2 for the swap in /etc/fstab in this guide, be aware that in some systems, this path might change upon rebooting, especially if you modify your disk setup later. The most robust way to reference partitions is by their UUID (Universally Unique Identifier), as these remain constant regardless of the disk order or other changes. For most virtualized environments like Proxmox, /dev/vda2 should remain consistent, but if you're looking for an approach that's resilient to potential future changes, consider using the UUID instead.
    • File should look something like this:
      Bash:
      ......
      # swap was on /dev/vda5 during installation
      #UUID=7755d0e9-6b0f-44ef-bca9-e9f0facfbe06 none            swap    sw              0       0
      /dev/sr0        /media/cdrom0   udf,iso9660 user,noauto     0       0
      # >>> [openmediavault]
      /dev/disk/by-uuid/3821a19b-2c31-4f86-b7ae-2602c57074c8          /srv/dev-disk-by-uuid-3821a19b-2c31-4f86-b7ae-2602c57074c8      ext4    defa$
      # <<< [openmediavault]
      # Updated swap partition
      /dev/vda2 none swap sw 0 0
    • Save and close the file (in nano, you can do this by pressing Ctrl + O to write changes, and then Ctrl + X to exit).
  13. Reboot the system:
    • Ensuring that all changes take effect and to verify that the swap partition is used on boot:
      Bash:
      sudo reboot
  14. Verify the swap is active:
    • After rebooting, run:
      Bash:
      free -h
    • It should output something like this:

      Bash:
      $ free -h
                    total        used        free      shared  buff/cache   available
      Mem:          1,9Gi       728Mi       262Mi        23Mi       993Mi       1,0Gi
      Swap:         961Mi          0B       961Mi
Successfully expanded the OpenMediaVault system partition and adjusted the swap space on a Proxmox VM. The process can vary based on individual setups, so always back up before making changes. If anyone has questions or runs into issues, feel free to comment below.
 
Last edited:
thanks aditunoe, great writeup
If you reference swap by UUID instead of by /dev/vda*, then you should also update the UUID in the initramfs resume file:

# change UUID in the resume file to match current swap
% sudo vim /etc/initramfs-tools/conf.d/resume

# update initramfs
% sudo update-initramfs -u -k all

reboot
 
Last edited:
I was looking for a way to increase for my OMV disk and came across this post. I then found a way to do it in a relatively easy graphical way, basically moved the disk to an ubuntu vm and did the resizing there. so i thought about sharing my process since it might help others.

i haven't tested this out that much so do be careful with this.

AGAIN, PLEASE DO BE CAREFUL WHEN AND IF DOING THIS, I HAD NO IMPORTANT DATA ON THERE SO I DIDN'T CARE ABOUT ANY LOSSES.
If you are trying this on your own please practice precaution and backup before trying any of this.


My setup was as follows:
1. System/Main Disk 16GB
2. Media disk 128GB

I don't remember why exactly i made it with 2 disks, but probably in case something like this happened since it might help in resizing the disk in the future. which i think it did since i only had to deal with one main partition and not any swap ones. this might also work if doing this for the system disk but i haven't tried myself.

I'm writing this after i did everything so i don't have exact images or steps.
the steps i took were roughly like this:
  1. Shutdown vm and increase/Resize size of disk in PVE.
    • can be done by going to Disk action > then Resize. You can choose an amount to add to the disk, for example 256GB.
    • xcpzGku.png
  2. I powered on the VM and checked if the size updated. it did in disks but not Filesystems, similar to OP's. (since i can't redo everything with my media disk, i'll continue with an example disk i made thats 32 GB and expanded to 64GB.)
    • ZzioWKg.png
  3. Power off the VM. then move the disk to another vm, I had an ubuntu one and was somewhat familiar with their Disks utility app that lets you change and edit partitions and disks, so that's what i'll be using.
    • Reassigning/Moving the disk was quite easy, from the same menu as in the Resize step.
    • tG11qkj.png
    • Just choose the correct VM, no need to change other settings.
  4. Now it's time to adjust the partition and disk in ubuntu.
    • The disk should show up in the VM's Hardware section. as well as inside ubuntu on the side Dock.
    • qFzNC2d.png
    • Now open the Disks App.
    • qTGgjLc.png
    • You can see the disk now with the free space that was made previously. Make sure to select the correct disk on the left, and also the select the partition. in my case its Partition 1.
    • fSUm8zg.png
    • Now click the gear icon and select resize.
    • t71jhCu.png
    • Move the slider to the maximum position(All the way to the right) to add all free space to our partition. Free Space Following should be at 0. When done just click Resize.
    • LvX5XZg.png
    • Afterwards you should have your disk properly resized and ready! next step would be to move the disk back to OMV.
    • HuCgcPB.png
  5. Moving the disk back is the same as was done in step 3, just remember to Shutdown both VMs to avoid any problems.
    • DQnFecM.png
    • And that's all!

I hope this might be of help to someone else!

(P.S. I accidentally refreshed the page near the end and lost half of what i wrote, and thought about just not posting this. but i had copied the whole thing earlier with most of it there so i pasted what i had and redid the rest.)
(edit: i haven't used forums that much in general so i'm not sure if this would have been better in its own thread, and this is also my first time trying to write something like this.)
 
Last edited: