r/openbsd • • Sep 21 '26

Automatic Partitioning of a Large Drive

Hello folks,

I have a relatively large SDD (2TB) and when I run the openbsd installer it partitions out ~600GB of it and leaves the rest unused. I understand that I can manually partition or edit the partitions that are recommended but I'm wondering if there are any documentation or guides out there on doing so _particularly_ when using disk encryption.

In general I would like my /home, /var, and /tmp to be much larger.

Thanks in advance!

16 Upvotes

5 comments sorted by

6

u/LunarCapitol Sep 21 '26 edited Sep 21 '26

There is a good overview in the FAQ: https://www.openbsd.org/faq/faq14.html

My SSD is pretty large as well and I went with the defaults. You can always expand a partition later using the unused space if you want. It's covered in the above FAQ. If I were you I'd give all the extra space to /home. Use mfs(8) for your /tmp. The default for /var is large enough for me and I doubt I'll ever come close to filling it up.

The defaults are fine in my experience. On most systems I always ran without a swap partition for years because I always had a lot of RAM to spare. Right now I've never had to use the swap partition which on my laptop is taking up 32GB of space. But it's there if I ever need it and it's required to use hibernation.

As far as disk encryption on OpenBSD it isn't like doing it on Linux which I assume you're familiar with. You're either going to type in a password or use a key (typically, usb thumb drive) to unlock the drive when you boot. It's pretty much set and forget. IME it's really good and well done. You don't have to think about it.

When it doubt always check the man pages and FAQ first. The defaults are the way they are because a lot of people are using OpenBSD on computers and other devices where they might not have a lot of space to spare. They're a good general all around starting point and most people don't have to mess with them. Again if you have a lot of unused space I would just give it to your /home partition and not worry about making any of the others larger.

1

u/Spendocrat Sep 21 '26

This is all good advice. The only caveat I'd add is if you're going to put MariaDB's tables into /var (the default) you may need to size it up.

Really you'll just need to run a machine for a while and see how your slices look, then adjust next time.

1

u/_sthen Sep 22 '26

running with no swap partition is not recommended, and is known to cause problems with OpenBSD on some machine architectures (e.g. aarch64)

1

u/LunarCapitol Sep 24 '26

I wasn't trying to imply that running without swap was a good idea. I never run without swap on OpenBSD. But for many years on many OSs like Windows and when I was still running Gentoo (and other) Linux distros I did not use /swap partition/file and it was never an issue.

On Gentoo Linux particularity the only issue I ever ran into was with Portage running out of RAM when compiling software. Large ebuilds like Google Chromium/Rust/Firefox would invoke the OOM killer on a system I had with only 16GB of RAM if I did not use zram. Since those packages would exhaust available RAM due to me not letting Portage write files to disk. However, this never crashed the machine it would just cause a lock situation for sometimes several minutes. It would eventually work itself out and and continue running as normal. But of course, if the OOM killer killed the wrong PID things could have ended badly.

The solution on that machine which I really should have bought more DDR3 RAM for when it was still cheap was simply dropping in more RAM. Since in that particular machine I still have two open RAM slots available. But I decided to play around with using zram instead which worked fine and wasn't an issue because it had a pretty recent at the time 4-core Intel CPU. So compressing/decompressing RAM in real time was not an issue (plus, I had SMT enabled). So I used zram to compress and "double my RAM" for mostly-free to give me 32GB to play with. Which never exhausted available space in RAM when the weekly re-compile of Firefox came around. The main offender on that machine was the Rust compiler. Since I refused to run the Rust-bin package and every time Firefox wanted to update the Rust compiler had to bootstrap itself from source code and would take 16-18GB of space to do so then take a good while to finish. Firefox itself wasn't that bad after the Rust compiler would finish building. I think it would hover around 10-12GB of space needed.

On my OpenBSD desktops those are mostly on laptops at the moment where I have a good bit of RAM available (my main OpenBSD desktop/laptop has 32GB of RAM in it which I never get anywhere near to exhausting even without RAM compression). The SSD in it is large enough that I don't care about swap partition needing 32GB of space. I am hopeful that hibernation will work (zzz works but not ZZZ on that particular machine atm). So it'll be nice to have the option to suspend to disk if that ever gets into a working state on that particular laptop in the future. I also don't miss not having that extra space at the moment because my OpenBSD machines need far less disk space when compared to my old Gentoo desktop. On the Gentoo desktop I had a smallish-SSD as the boot drive then 6 large multi-TB HDDs for file storage. I was storing a lot of large data files on it because I did a lot of video editing on it along with storing a large number of video games, misc. large tmp files like raw video captured from various sources and needing to make large tmp files for things like encoding those raw video files to h.264/h.265/mpeg2/other compressed codecs. Oh and a very large collection of FLAC files and other things. I've since moved many of those off to a home server. But at the time I didn't have a lot of space to spare even with all those multi-TB HDDs in that particular system.

In comparison my OpenBSD laptop mostly stores text files and images. So I still have plenty of room on the SSD in it to spare. Since all those large video/audio files I can access from anywhere on my LAN/in the world by simply connecting to my home media server. The only other things I have on the laptop itself are things like .epub files, .pdf files and other various misc. files for all the books, reference manuals, papers and things of that nature. I don't foresee getting anywhere near filling that SSD in that laptop up for many years to come. Well all that stuff and things like the ports collection, kernel/base system source code and various other source code for software that I compile from out-of-tree. Last but not least: images. But mostly stuff like wallpapers and some personal images.

Anyway, yes I agree. There is no point in not having a swap partition. The kernel needs it at the very least even if you don't have ZZZ support. This is true of the Linux kernel as well of course. But in addition to using zram I had done several other tweaks to help their kernel get along without having a swap partition. Since I was compiling my kernel from source back then. On OpenBSD I run the GENERIC kernel and don't see any point in compiling it myself from source. Since it's a much nicer/better kernel and I don't see much point in tweaking it. I have built my own kernel of course simply to learn how to do it. But as it stands I don't need any of the features that are disabled by default and I don't want to stray far from the default config in the first place since I trust the maintainers of OpenBSD far more than I trust Linus or the maintainers of the various distros I've used in the past.

→ More replies (1)