Standalone OpenBSD Partitioning


If you're installing a dedicated OpenBSD machine, you don't have to worry about sharing the hard drive with another operating system. This simplifies the partitioning process — you only have to worry about OpenBSD's requirements.

The main partitions you'll need to consider are / (root), swap space, /tmp, /var, /usr, and /home. If you forget to create any of these partitions, the installer will put the files that should go in the partitions into your root partition. This will quickly fill up your root partition!

Root

The root partition holds the main system configuration files and the most essential UNIX utilities needed to get a computer into single-user mode. Your system should have fast access to its root file system, so put it first on the disk. Because it holds only these basic utilities and configuration files it doesn't need to be large; on a modern hard drive, I find a 500MB root partition comfortably roomy. I would recommend no smaller than 50MB for a root partition. (You could scrape by with a few megabytes smaller; the exact minimum size varies with the version of OpenBSD.)

If you're familiar with other some other UNIX-like operating systems, such as some distributions of Linux, you might be used to simply using a single large root partition and putting everything on it. This is a bad idea for a variety of reasons. With a partition safely constraining your log files, a process or user gone amok cannot fill your entire drive; while it could fill a partition, you would still be able to create and edit files on other partitions, giving you the flexibility you need to address the actual problem. Also, with a single partition, you cannot control where files are put on the disk. This hurts performance. Damage to the disk is probably spread across many different files in unrelated parts of the system, which means that your chances of recovering from a damaged disk or file system problems drop dramatically.

Root Limitations

Over the years, i386 systems have been expanded time and time again to surpass their own limits. They're based upon an architecture that could originally handle a maximum of 640KB of RAM, after all! The OpenBSD kernel — indeed, all modern operating system kernels — work around these limits in a manner mostly transparent to the user, but when the system is first booting you're trapped with the BIOS limitations.

Many old i386 systems have a 504MB limit on hard drives, on which the BIOS cannot get at anything beyond the first 504MB of data on a disk. If your BIOS cannot find your operating system kernel in that first 504MB, it cannot boot the system. Check your hardware manual; if it makes any references to a 504MB limit, this affects you. You absolutely must place your entire root partition within the first 504MB of disk.

Additionally, for some time i386 systems had a similar (not identical) 8GB limit. OpenBSD still obeys that 8GB limit. Even if your system is not susceptible to the 504MB limit, your entire root partition must be completely contained within the first 8GB of disk.

Of course, if you follow my advice and make your root partition 500MB you will never have to worry about either of these restrictions and the potential damage that they can inflict.

If you break these rules, your system will probably appear to work. The second you upgrade your system, or move the file /bsd, the computer will quite probably refuse to boot. Save yourself much pain; make the root partition 500MB, and the first partition on the disk, and this problem will never affect you.

Swap Space

The next partition on your drive should be swap space, the disk space used by virtual memory. When your computer fills its physical memory, it will start to move information that has been sitting idle in memory into swap. If things go well, your system will almost never need swap space, but if you do need it, it needs to be fast.

So, how much swap space do you need? This is a matter of long debates between sysadmins. The short answer is, "It depends on the system." General wisdom says that you should have at least twice as much swap as you have physical memory. This isn't a bad rule, so long as you understand that it's very general. More won't hurt. Less might, if your system runs out of RAM.

If you find that you need more swap space, you should probably buy more memory instead. If that's not an option, you can use a regular file as a swap file. Still, if you have a reasonable amount of disk space, simply assigning an amount of swap equal to twice the amount of RAM you have is sensible.

You should also consider possible future upgrades. If a computer has 500MB of RAM today, but you plan to upgrade it to 3GB of RAM in a couple of months, perhaps assigning 6GB of disk space to swap is a good idea. After all, if you can afford three gigs of RAM and you have the hardware to manage it, certainly that much disk is not an issue!

Swap Splitting

If you have multiple disks, you can vastly improve the efficiency of your swap space by splitting it among multiple drives. Put the first swap partition on the second-outermost ring of the drive with your root partition, and other swap space on the outermost edge of their drives. This splits reads and writes among multiple disk controllers.

For swap splitting to work best, however, the drives must be SCSI. If you have IDE drives, the drives need to be on different IDE controllers. Remember, each IDE controller splits its total data throughput among all the connected hard drives. If you have two hard drives on the same IDE controller and you're accessing both drives simultaneously, each disk will average half as fast as it would if you were running it alone. The major bottleneck in using swap space is data throughput speed, and you won't gain speed by creating contention on your IDE bus.

/tmp

The /tmp directory is system-wide temporary space. If you do not create a separate /tmp partition, it will be included on your root partition. This means that your system-wide temporary space will be subject to the same conditions as the rest of your root drive. This probably isn't what you want, especially if you plan to mount your root partition read-only!

Requirements for a /tmp directory are generally a matter of opinion — after all, you can always just use a chunk of space in your home directory as temporary space. On a modern hard drive, I like to have at least 500MB in a /tmp directory. Automated software installers frequently want to extract files in /tmp, and having to work around these installers when /tmp fills up is possible but tedious.

/var

The /var partition contains frequently changing logs, mail spools, temporary run files, the default website, and so on. If your server is a Web server, your website logs will go to this partition, and you may need to make it 1GB or more. On a small "generic Internet mail/Web server," I'll frequently give /var 20 percent of my remaining disk space. If the server handles only email or databases, I'll kick this up to 70 percent or more, or just assign a space to the remaining partitions and throw everything else I have on /var. If you're really cramped for space, you might assign as little as 30MB to /var. (Again, actual minimum requirements vary depending on your version of OpenBSD.)

/usr

The /usr partition holds the operating system programs, system source code, compilers and libraries, and other little details like that. Much of this changes only when you upgrade your system.

On a modern hard drive, I recommend using about 6GB on your /usr partition. This should be more than sufficient for all the contents of /usr and just about any add-on packages you might desire, and should also leave room for any OpenBSD source you might want to install. Without the X Window System, you could make /usr as small as 200MB. If you need X, you should assign /usr at least 350MB.

/home

The /home partition is where users keep their files. If you have more disk space than is good for you, assign it here. Your home directory will quickly fill up with all sorts of stuff that you'll be tripping across years from now.

The /home partition can easily be the last on your disk; it doesn't need to be fast. It also doesn't need to be large; the only files on the drive will be the ones that you need.

Note

If you've been adding this up, you should notice that it's entirely possible to have a complete OpenBSD system (without the X Window System) in less than 300MB. Just for kicks, compare that to the amount of space a minimal install of Windows XP requires or the size of an minimal Solaris 9 box installation. Your complete install, with all your user programs, may be far larger than 300MB — but all that space is used up because of things you specifically want, not OS overhead.

Multiple Hard Drives

If you have a second hard drive of comparable quality to your main drive, you can make excellent use of it with proper planning. First, use the outer edge of the drive for swap, as discussed earlier in the "Swap Splitting" section. Use the rest of the drive to segregate your data from your operating system. Do this by assigning the remainder of the drive to the partition that stores files for whatever your server does the most of. If it's a Web server, make the second drive /www or /home. If it's a mail server, use it for /var or /var/mail. If it's a network logging host, assign the second drive to /var/log.

In general, segregating your operating system from the data you're serving increases system efficiency. Like all rules of thumb, this is debatable. But no sysadmin will tell you that this is an actively bad idea, while one can argue endlessly about what the "absolute best" idea is.

If you have no idea what your system will be for, make your second drive /usr and split your first hard drive amongst /var, /tmp, /, and swap space.

If your second drive is much slower than your main system drive, don't bother using it. Not only will its performance be poor, chances are that it is much older than your main drive and far more likely to fail.

If you need to install more than one operating system on your computer, an extra hard drive is an excellent and easy way to do that.




Absolute Openbsd(c) Unix for the Practical Paranoid
Absolute OpenBSD: Unix for the Practical Paranoid
ISBN: 1886411999
EAN: 2147483647
Year: 2005
Pages: 298

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net