OPNsense Forum

English Forums => General Discussion => Topic started by: verfluchten on May 15, 2025, 04:40:07 PM

Title: Shrink UFS and ZFS to their bare minimum
Post by: verfluchten on May 15, 2025, 04:40:07 PM
By default, OS installs to full disk, which is sub-optimal.
Is there a way to do the opposite of https://forum.opnsense.org/index.php?topic=19250.0 and shrink all of the partitions to their bare minimum?

I have this currently and no faintest idea how to shrink it:


2% / [zfs] (1.1G/64G)
0% /var/log [zfs] (1.8M/63G)
0% /zroot [zfs] (88K/63G)
0% /tmp [tmpfs] (408K/10G)
0% /var/crash [zfs] (88K/63G)
0% /usr/home [zfs] (88K/63G)
0% /var/audit [zfs] (88K/63G)
0% /usr/ports [zfs] (104M/63G)
0% /var/mail [zfs] (112K/63G)
0% /var/tmp [zfs] (88K/63G)
0% /usr/src [zfs] (88K/63G)
0% /tmp [tmpfs] (408K/10G)

What should the procedure be?
Title: Re: Shrink UFS and ZFS to their bare minimum
Post by: meyergru on May 15, 2025, 05:18:25 PM
Most filesystems support growing at best, I know that ZFS does not support shrinking.

You could backup your configuration, reinstall using advanced options and partition to your own liking.

Restore your configuration afterwards and you should be set.
Title: Re: Shrink UFS and ZFS to their bare minimum
Post by: EricPerl on May 15, 2025, 05:35:49 PM
You can actually grab/restore the full content of the /conf directory if you use the importer during install.
This said, configuration for other plugins is another matter... I just moved from virtualized to bare metal.
Title: Re: Shrink UFS and ZFS to their bare minimum
Post by: franco on May 16, 2025, 09:50:14 AM
I'm wondering which part of "the installer will use the entire disk" is unclear, but that's besides the point.

If you have ZFS you can reallocate space to anywhere you like and even clamp down on the existing root file system if you think it uses too much.

Again, you didn't know what you wanted during install (which allows fine-tuning the disk layout and space use in the non-guided variants) and now you also don't say what you want to do with the space. You don't even say if this is HW or a VM. In the latter case maybe you try to salvage host space but then also why not give the host a smaller disk in the first place.

A lot of speculation here, but hopefully an insight into what we're missing here in context.


Cheers,
Franco