# Optimal 9.0 server partitions?



## RagingPenguin (May 3, 2012)

I am returning to freebsd *FreeBSD* after some time away (last used v7) and I have some questions.

First, I am setting up a server machine for personal use. I will be the only one using it.


There will be no other OS on the machine and no VMs. Which mode do I use: BSD, GUID, etc?
I want the following partitions for safety and imaging reasons.
/
/boot
/home
/usr
/tmp
/var
/var/log (yes, I want log to have its own partition since things other than logs go in var)

Do I need to define than in a particular order?
What sizes should I give each? The disk is 918G in size. I have 6GB RAM installed. For things like / and /boot, please state reasoning for the size given, such as: "twice your RAM".

I appreciate any additional advice and insight into proper partitioning.

Thank you!


----------



## RagingPenguin (May 3, 2012)

Forgot /swap. And why is there no 'edit' button for posts?


----------



## Sebulon (May 3, 2012)

@RagingPenguin

In my opinion, the never-ending question about partition-sizing is over. Just use ZFS; problem solved! With ZFS, you take that 1TBish hard drive of yours and turn that into a "pool" of storage. Then when you create different ZFS filesystems- kind of like partitions- except, they share the space that is available in the pool. Plus, you can build the filesystems logical to match your directory structure, like in your case:

```
Filesystem                Mounted on:
pool/root                 /         zfs   rw  0  0
pool/root/usr             /usr      zfs   rw  0  0
pool/root/usr/home        /usr/home zfs   rw  0  0
pool/root/tmp             /tmp  [B][I](or, perhaps even smarter...)[/I][/B]
tmpfs                     /tmp      tmps  rw  0  0
pool/root/var             /var      zfs   rw  0  0
pool/root/var/log         /var/log  zfs   rw  0  0
/dev/zvol/pool/swap       none      swap  sw  0  0
```

You also get cool features like strong checksumming, COW so you don't have to worry about journaling, compression, you can have automatic periodic snapshots so you can retrieve accidentally deleted files from "the past", you can also read the data out from a snapshot and pipe to, say, a tar archive, or a backup pool you have on a USB drive, or an off-site backup server receiving the snapshots through ssh, even incrementals...

And if you feel you should ever want any fault-tolerance on that one, lonely 1TBish hard drive, just *attach* another one to the pool to rebuild it into a mirror(RAID1).

I am never going back, that's for sure

/Sebulon


----------



## wblock@ (May 3, 2012)

RagingPenguin said:
			
		

> 1) There will be no other OS on the machine and no VMs. Which mode do I use: BSD, GUID, etc?



GPT is preferable.  It doesn't have the limit of four partitions that was a problem with MBR.



> 2) I want the following partitions for safety and imaging reasons.
> 
> /
> /boot
> ...



Mostly no.  For GPT, you also need a freebsd-boot partition, which should be first.  Why do you want to split /boot out into a separate partition?



> 2b) What sizes should I give each? The disk is 918G in size. I have 6G RAM installed. For things like / and /boot, please state reasoning for the size given, such as: "twice your ram".



The old twice-your-RAM sizing for swap is kind of obsolete; the more RAM, the less need for swap.  As far as recommending sizes, it's like someone asking "which is the best programming language?"  It depends on what you're doing.  One disadvantage of lots of partitions is that it ties up unused space.  So you might run out of space in /usr even though /var has 3G of empty space.  For that reason in particular, the FreeBSD 9 install sets up just one large partition for the filesystem.

For /tmp, consider using tmpfs(5).


----------



## RagingPenguin (May 4, 2012)

Wow, now I'm even more confused than ever. I have no clue what ZFS is. I guess I have more reading to do. Plus, I got two very different replies! I need more input and discussion before I really understand this. Ap*p*arently things have changed a lot since I last did this. Thank you both for your answers though.


----------



## wblock@ (May 4, 2012)

UFS is the old, traditional file system used by FreeBSD.  ZFS is a new import from Solaris, with lots of features and power.  Those features and power come with some overhead, particularly RAM usage.  It's also not uncommon to add SSDs to a ZFS setup.  Which is faster?  Last I saw, UFS.  But it would be nice to see a good benchmark of UFS versus ZFS on the same hardware.  If I were you, I'd do that on the new machine.  mfsBSD is a live CD version of FreeBSD.  The "special edition" has added features to set up ZFS easily, and of course it can also do UFS.


----------



## RagingPenguin (May 4, 2012)

@Sebulon

Is there any reason you prefixed moust of your mount points with /pool/root? If the entire disk is the pool, do you really need it in the path? Why not have /usr and /home instead of /pool/root/usr and /pool/root/usr/home? I need to know if there an actual reason, or just your preference.


----------



## phoenix (May 4, 2012)

Read his post more carefully. 

The first column is the ZFS filesystem. All ZFS filesystems are part of a pool (named 'pool' in this case), hence all filesystem names start with that (note the lack of / at the start).

The column labelled "mountpoint" is where the filesystems are actually mounted.

Look at that listing more as the contents of an fstab or the output of the mount command.


----------



## SirDice (May 4, 2012)

For starters I'd use a more traditional layout. You're going to change it anyway once you get the hang of the system. Believe me, in the past decade or so, I've changed layouts more often than underwear 

So, use GPT and UFS, these are ballpark figures:

```
/   1GB
swap 6GB (a bit much but space is cheap)
/var 1GB (if you want logging separately that's fine)
/tmp 1GB (you might want to have a look at [man=5]tmpfs[/man])
/usr 20GB
/usr/home *GB (the rest of the disk)
```

Keep at least /usr/home/ separate. That'll make upgrading or reinstalling a little easier. The 20GB for /usr/ should be fine depending on how much you're going to install. If you install a full Gnome, KDE and XFCE it might be a little tight.


----------

