Help with partitioning and allocating disk space

I have been reading The Handbook regarding how to partition a disk when installing FreeBSD (https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/bsdinstall-partitioning.html) and I am confused as to how to split up the installation on a disk - I'm still not sure what goes where.

Do I need this layout?
  • freebsd-boot - Holds the FreeBSD boot code.
  • freebsd-ufs - A FreeBSD UFS file system.
  • freebsd-swap - FreeBSD swap space.
Or this?

Example 2.1. Creating Traditional Split File System Partitions
For a traditional partition layout where the /, /var, /tmp, and /usr directories are separate file systems on their own partitions, create a GPTpartitioning scheme, then create the partitions as shown. Partition sizes shown are typical for a 20G target disk. If more space is available on the target disk, larger swap or /var partitions may be useful. Labels shown here are prefixed with ex for “example”, but readers should use other unique label values as described above.

By default, FreeBSD's gptboot expects the first UFS partition to be the / partition.

Partition Type Size Mountpoint Label
freebsd-boot 512K
freebsd-ufs 2G / exrootfs
freebsd-swap 4G exswap
freebsd-ufs 2G /var exvarfs
freebsd-ufs 1G /tmp extmpfs
freebsd-ufs accept the default (remainder of the disk) /usr exusrfs

And how do I go about splitting the installation over two disks where one of them is SSD?

I assume freebsd-boot should be on SSD, but what about freebsd-swap?
 
These are two variations. The first is the one used by bsdinstall(8) by default. The second is a more traditional layout where several subdirectories are separated out into different filesystems.

Having it all in one filesystem can use space more efficiently. That is particularly important on smaller drives, like typical SSDs. Having it split up can make management easier. It's up to you to decide which is more suited to your purposes.
 
how do I go about splitting the installation over two disks where one of them is SSD?
If you tell us what kind of disks you have, how large they are, what speeds you get (if you know that) and what the computer is going to be used for, we might be able to give you some more specific advice.
 
If you tell us what kind of disks you have, how large they are, what speeds you get (if you know that) and what the computer is going to be used for, we might be able to give you some more specific advice.

There are two disks, one 150 GB SSD and the other 1 TB SATA. The machine will be used as a light web server as well as an Internet gateway for a small LAN. Also as a tool for understanding FreeBSD. FreeBSD was originally installed on the SSD and the other disk was added later and is only mounted under /mnt/disk. I assume I should move /var to that disk.

I would also like to install Squid as a proxy server and am not sure where its cache should be located.
 
I would definitely suggest that you don't split up the main OS. It'll work and most likely you won't have any issues with the setup at all, but it's also risky.

It's best to keep your base OS on one single disk for the simple reason that if something happens to the other disk you may end up seeing those problems affect the way in which your OS runs. For example; if you put /var onto a separate HDD and then this HDD starts to produce errors then your whole system could be affected because the OS can now no longer write logfiles reliably, the cache system becomes an issue and then there's all the obvious others such as databases (the package manager also stores its data into /var for example).

Of course one can also argue that if the main disk starts to produce errors you'll be in trouble either way, completely true, but in my opinion it's still best practice not to spread things out too much.

There are definitely not too many issues with moving data areas such as /home or others out of the way.

And you might also be able to use ZFS, see chapter 20 of the handbook. It more or less gives you options to create file systems on the fly while all of them still use your entire disk space (all file systems use a so-called ZFS pool which can easily use your entire disk space).

But that does depend on the amount of memory you got and the specifications of the machine. It's not specifically lightweight.
 
There are two disks, one 150 GB SSD and the other 1 TB SATA. The machine will be used as a light web server as well as an Internet gateway for a small LAN. Also as a tool for understanding FreeBSD. FreeBSD was originally installed on the SSD and the other disk was added later and is only mounted under /mnt/disk. I assume I should move /var to that disk.

Unless you have a funny system, /var is lightly used and there is no reason to move it.

I stopped fighting with Squid years ago and have no desire to run it again, but if I did, I would probably put the cache on SSD for speed. Systems that I use interactively generally have SSDs for the main disk and hard drives are only used for large file storage.
 
Please keep in mind that everybody has their own ideas about partitioning. Therefore I recommend that you think about my suggestions as well as those of others who weigh(ed) in and then decide for yourself.
  • Whether or not you'll need swap depends on how much physical memory you have available. The rule of thumb used to be: always use a swap partition and make it twice the size of your physical RAM. However, nowadays this guideline is way less accurate. Considering that you wish to build a web server and gateway, I'd be inclined to say:
    • If you have over 4 G(i)B of physical RAM, you probably won't need a swap partition anyway but creating one that's 1 or 2 G(i)B large just in case won't hurt. I'd put it on the HDD because it's not likely to be used in the first place and you have more space there.
    • If you have between 2 and 4 G(i)B of physical RAM you could create a swap partition of equal size. On which disk to put it is a bit borderline, but I'd choose the SSD because it's likely to be faster.
    • If you have less than 2 G(i)B of physical RAM a swap partition of at least 2 G(i)B of RAM is probably a good idea and I'd put it on the SSD.
  • I wouldn't create a whole lot of filesystem partitions like /var, /tmp etc. Simply using one disk for the operating system (/) and one for the web server content (probably /usr/local/www or something along those lines) sounds more like it. Edit: I was raised with the idea that one should create those separate partitions in order to prevent a runaway process from filling up everything - and sometimes I still do that - but with today's disk capacities that's less of an issue.
  • The operating system doesn't need a whole lot of space - certainly not a terabyte. My choice probably would be to put the system onto the SSD and to put the web server content onto the HDD. If you wish to use Squid, I think its cache would probably be better off on the SSD for speed.
  • I don't think the gateway has any specific partitioning requirements at all.
All things considered, I'd go for the system on one partition on the SSD, the web server content on the HDD, a Squid cache partition on the SSD and perhaps a swap partition on either, depending on how much physical RAM you have.

Hope this helps.
 
Thanks for everyone's suggestions. All I need to do now is figure out just exactly how I should go about partitioning my disks in terms of actual gpart commands.

One other query is regarding SSDs. Do they have a fixed limit in terms of re-writes after which they are no longer able to write?
 
Back
Top