Disk space issue

Started by gmartin, January 26, 2026, 03:27:57 AM

Previous topic - Next topic
I'm running 25.1.12 in a VM on proxmox v9. It's been running about 9 months without issue.  I noticed today the drive was full.  In the proxmox console, I increased the disk space to 50GB.  I was prompted in the console to run a command to accept the growth but it did not expand the file system. 
The system is showing a discrepancy between gpart and df.

I assume there is something I need to do inside to grow the fs, but growpart isn't available. Is there another tool?

(BTW, I deleted some logs to alleviate the immediate issue.)

Thanks!

root@oprouter:~ # df -h
Filesystem                   Size    Used   Avail Capacity  Mounted on
/dev/gpt/rootfs               23G     11G     10G    50%    /
devfs                        1.0K      0B    1.0K     0%    /dev
/dev/gpt/efifs               260M    1.3M    259M     1%    /boot/efi
devfs                        1.0K      0B    1.0K     0%    /var/dhcpd/dev
devfs                        1.0K      0B    1.0K     0%    /var/unbound/dev
/usr/local/lib/python3.11     23G     11G     10G    50%    /var/unbound/usr/local/lib/python3.11
/lib                          23G     11G     10G    50%    /var/unbound/lib

and
root@oprouter:~ # gpart show
=>       40  113246128  da0  GPT  (54G)
         40     532480    1  efi  (260M)
     532520       1024    2  freebsd-boot  (512K)
     533544   49798144    3  freebsd-ufs  (24G)
   50331688   16777136    4  freebsd-swap  (8.0G)
   67108824   46137344       - free -  (22G)


Have a look at a similar thread from about a week ago: https://forum.opnsense.org/index.php?topic=50436.0, the post from Maurice.
Deciso DEC740

But the instructions given there will not work for this specific setup, because the ufs partition is not the last one on the disk. The swap partition is in the way for the enlargement and has to be deleted first.
Intel N100, 4* I226-V, 2* 82559, 16 GByte, 500 GByte NVME, ZTE F6005

1100 down / 800 up, Bufferbloat A+

Good point @meyergru, I didn't notice that.
Deciso DEC740

@gmartin but do not (!) just go ahead and remove the swap partition, then use the procedure outlined by @Maurice. This will lead to a system with no swap at all. Bad idea.

Quoteroot@oprouter:~ # gpart show
=>       40  113246128  da0  GPT  (54G)
         40     532480    1  efi  (260M)
     532520       1024    2  freebsd-boot  (512K)
     533544   49798144    3  freebsd-ufs  (24G)
   50331688   16777136    4  freebsd-swap  (8.0G)
   67108824   46137344       - free -  (22G)

So from the top of my head without any guarantee it will work - go step by step and check the results before proceeding to the next one, please:

# make sure secondary GPT header is present
gpart recover da0

# disable swap - take note of the device name, e.g. "/dev/da0p4" or "/dev/gpt/swap"
swapoff -a

# remove swap partition
gpart delete -i 4 da0

# resize UFS partition
gpart resize -i 3 -s 36g da0

# recreate swap partiton - if the device in the first step was "/dev/da0p4" use this:
gpart add -i 4 -t freebsd-swap da0

# recreate swap partition - if the device in the first step was "/dev/gpt/SOMELABEL" use this:
gpart add -i 4 -t freebsd-swap -l SOMELABEL da0

# re-enable swap
swapon -a

If that worked you should have a system with 8 G of swap like before and a resized UFS partition. The last step is to resize the UFS proper.

Connect a console and reboot into single user mode. Do not mount the root partition read/write, just leave it read only (this is the normal state after entering single user mode).

fsck -y /
growfs /
df
shutdown -r now

HTH,
Patrick
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

Thanks, all. I had read the aforementioned thread and had no luck - so I posted. And now I understand why.  I'm sure there are many repeats here, so I get it.

I'll walk through @patrick's instructions and follow-up when I'm done.

\\Greg

Quote from: Patrick M. Hausen on January 26, 2026, 11:31:24 AM@gmartin but do not (!) just go ahead and remove the swap partition, then use the procedure outlined by @Maurice. This will lead to a system with no swap at all. Bad idea.

Quoteroot@oprouter:~ # gpart show
=>       40  113246128  da0  GPT  (54G)
         40     532480    1  efi  (260M)
     532520       1024    2  freebsd-boot  (512K)
     533544   49798144    3  freebsd-ufs  (24G)
   50331688   16777136    4  freebsd-swap  (8.0G)
   67108824   46137344       - free -  (22G)

So from the top of my head without any guarantee it will work - go step by step and check the results before proceeding to the next one, please:

# make sure secondary GPT header is present
gpart recover da0

# disable swap - take note of the device name, e.g. "/dev/da0p4" or "/dev/gpt/swap"
swapoff -a

# remove swap partition
gpart delete -i 4 da0

# resize UFS partition
gpart resize -i 3 -s 36g da0

# recreate swap partiton - if the device in the first step was "/dev/da0p4" use this:
gpart add -i 4 -t freebsd-swap da0

# recreate swap partition - if the device in the first step was "/dev/gpt/SOMELABEL" use this:
gpart add -i 4 -t freebsd-swap -l SOMELABEL da0

# re-enable swap
swapon -a

If that worked you should have a system with 8 G of swap like before and a resized UFS partition. The last step is to resize the UFS proper.

Connect a console and reboot into single user mode. Do not mount the root partition read/write, just leave it read only (this is the normal state after entering single user mode).

fsck -y /
growfs /
df
shutdown -r now

HTH,
Patrick

This is resolved.  Instructions above worked at every step. At first, swapoff -a failed with a "cannot allocste memory" error.  I added memory to the vm and rebooted - then ran swapoff immediately.

Here are the results.

root@oprouter:~ # gpart show
=>       40  113246128  da0  GPT  (54G)
         40     532480    1  efi  (260M)
     532520       1024    2  freebsd-boot  (512K)
     533544   96468992    3  freebsd-ufs  (46G)
   97002536   16243632    4  freebsd-swap  (7.7G)

root@oprouter:~ # df
Filesystem                1K-blocks     Used    Avail Capacity  Mounted on
/dev/gpt/rootfs            46707100 11819180 31151352    28%    /
devfs                             1        0        1     0%    /dev
/dev/gpt/efifs               266144     1360   264784     1%    /boot/efi
devfs                             1        0        1     0%    /var/dhcpd/dev
devfs                             1        0        1     0%    /var/unbound/dev
/usr/local/lib/python3.11  46707100 11819180 31151352    28%    /var/unbound/usr/local/lib/python3.11
/lib                       46707100 11819180 31151352    28%    /var/unbound/lib


My only remaining issue is why it filled up to start with. I'll look into log retention config.

Thanks again all.  Happy snow day! (if you live in the US northeast!