After Install and first reboot, I get "Using partition
3 id 0"
How do I handle a large hard disk?
How should I partition my disk?
How big should I make my swap?
How do I resize a partition?
How can I do RAID on OpenBSD?
Can I boot from a software RAID partition?
Will that Promise IDE RAID board work on OpenBSD?
Why is 'df' showing my disk more than 100% full?
This section has been completely replaced by an updated official FAQ. Please see:
A fix for this problem has gone into OpenBSD v3.1!
Swap is used when you run out of real RAM. For some applications, you want to avoid swap as much as possible, others, swapping is just fine. A firewall system should not swap in normal use, however if it swaps when building a port or editing a configuration file, no problem. You don't want to run out of RAM+swap ever...the system will tend to come to a screeching halt. It is very difficult to enlarge a swap partition (see next), however, you can add swap-to-file, should you want more later.
For a basic firewall, 16M RAM and 50M swap is very sufficient, and in fact, the swap is just there for "other things" -- I have never caught a 16M firewall swapping in normal operation. In this case, I want to have enough RAM available to rebuild a kernel if desired, so my swap is bigger than the 2x rule, but then, I have never even pushed that near the limit. If I have a >2G drive, I usually put a (minimum) 100M swap in place, just because I can. Too much swap doesn't hurt anything other than chewing up your disk space.
That being said...
Brian Kifiak reminded me that there is more to a swap partition that just swapping. Many thanks for his assistance (and prodding) on this section!
The swap partition is also used as a storage place for a 'crash dump' in the event of a system panic. For this reason, your swap size should always be a little larger than you ever expect to have RAM in the system. Don't forget, as pointed out above, you can't easily enlarge swap, and you can't crash dump to a file, so if you are concerned about crash dumps, planning ahead makes sense.
One significant difference between swap-to-file and a swap partition is the swap partition is available at boot time, whereas the swap file is not available until AFTER a successful mount of its "host" partition in a read/write mode. If you have a need to run fsck on a large partition, you may find that fsck requires a lot of memory to execute -- if this amount exceeds physical RAM, the system has to swap. This sometimes causes problems where a huge partition is created and used on a rather old computer with limited RAM and swapping done to file.
Gory Details about crash dumps and swap...
Upon panic, the system will drop you to a debugger prompt, "ddb>". At this point, you will be able to do things like trace or ps to find out what died. When you are done, you can reboot the system from ddb, by using one of the several "boot" commands ("boot sync", "boot crash", "boot dump", "boot halt") from the ddb> prompt. Either the "boot crash" or "boot dump" options will copy the entire contents of RAM to the swap partition for later analysis.
When the system reboots, OpenBSD looks for a crash dump on the swap partition. If found, it is copied to /var/crash using savecore. This indicates that your /var partition should also have enough free disk space available to hold at least one core dump! If you don't have (or don't make) space in /var for a dump, don't worry about the size of your swap...it won't help anyway.
Once you have a core dump, you will want to analyze it, but this is a bit outside the scope of this document (and my skills!). See man crash (is this cool, or what? How many commercial OSs have a section in the documentation on what to do when a fatal OS crash takes place?).
Do I need to worry about crash dumps?
Hopefully, no. You can ignore all this, make your swap the size you need, and live a very happy, productive life...
...unless your machine crashes, you cry for help, and a developer says "tell me about your core dump". Don't come running with a problem for others to solve if you haven't left the tools in place to help them solve it. Keep in mind, AFTER a crash is the wrong time to worry about leaving space (in both swap and /var) for a crash dump.
That being said, OpenBSD is a very reliable system, and that is possibly why you chose it. If you run a basic system, using dull, boring, stable hardware, and the thing panics on you, you can probably guess it is a hardware problem. But if it isn't, being prepared to help make sure it never happens again is a good thing.
man 8 swapctl
man 8 crash
man 4 ddb
man 8 savecore
See the above about partitioning.
Also see: http://www.openbsd.org/faq/faq14.html#14.9
Basically, you are going to end up backing up your existing data on
an existing partition and dumping it to a new partition someplace.
You will also wish you had planned a little better.
A FAQ needs to be written on this, when I or someone else does it, it won't be on this page, though...
For more details, see man
OpenBSD Common Problems
Holland Consulting home page
Contact Holland Consulting
since September 10, 2001
(C)opyright 2001, Nick Holland, Holland Consulting