# Partition layout.



## sixtydoses (Mar 19, 2010)

I know this is up to one's preference, but anyhoo, I'm planning to reinstall my FreeBSD (8.0-RELEASE) and redo the partition layout because the current one is beyond comprehension of one's mind. This gives me an opportunity to play with zfs for the first time as well. I have several partition layouts in mind, 3 of them listed below. Haven't decided yet on which option to go for though (tmpfs? mdmfs?). I'm still reading about zfs and preparing for backups, so in the meantime, if you have suggestions on better layout, or which option I should root for, or if you just simply want to share your own, do throw them in. Machine is for personal use.

Machine specs:
CPU: AMD Athlon(tm) 64 Processor 3200+ (2010.31-MHz K8-class CPU)
Real memory  = 3221225472 (3072 MB)
Hard disks = 2 units * 500 GB



```
ad4 [500 GB]                                ad6 [500 GB]		

Option A)

	+	/		512 MB	               +
SLICE 1	+	/tmp	UFS	1 GB           SLICE 1 +     [swap]     UFS     512MB
	+	[swap]		512 MB                 +
---------------------------------------        --------------------------------------
	+	/usr			               +     /backup
SLICE 2	+	/var		ZFS	       SLICE 2 +     /movies    ZFS
	+	...                                    +     ...
```


```
ad4 [500 GB]                                ad6 [500 GB]

Option B)

	+	/		512 MB	               +
SLICE 1	+	[swap]	UFS	2 GB                   +    
	+	/tmp	mdmfs	1 GB                   +     /backup
---------------------------------------        SLICE 1 +     /movies    ZFS
	+	/usr			               +     ...
SLICE 2	+	/var		ZFS	               +  
	+	...                                    +
```


```
Option C)

	+	/		512 MB	               +
SLICE 1	+	[swap]	UFS	1 GB                   +     
	+	/tmp		1 GB                   +     /backup
---------------------------------------        SLICE 1 +     /movies    ZFS
	+	/usr			               +     ...     
SLICE 2	+	/var		ZFS	               +   
	+	...                                    +
```


----------



## phoenix (Mar 19, 2010)

Option D:  Install to a USB stick, and use the entirety of both drives as part of a ZFS mirror.  Then move /home, /var, /usr/local, /usr/ports, /usr/src, /usr/obj, basically everything except / and /usr itself.

If you have the ports, use 2 USB sticks in a gmirror for / and /usr, and a 3rd one as an L2ARC for ZFS and for swap.


----------



## sixtydoses (Mar 19, 2010)

I saw that coming (someone would suggest to use the whole disks as ZFS mirror). Hmmm.. but then I only have 500 GB space instead of 1 TB.  But yea I can always add more disks later.. and not bothered about backing up stuff.

So..

2 drives with ZFS mirror.
2 USB sticks with gmirror.
1 USB stick as an L2ARC for ZFS and swap.

Interesting, and intriguing. Gotta read up on L2ARC.

Thanks much for the suggestion, phoenix .


----------



## atomicplayboy (Mar 20, 2010)

This thread got me thinking about my own partition layout. Currently I've got one 250G disk divided into reasonably sized (actually probably a little overkill) /, /var, /tmp, /usr, and swap partitions. Then I've got two 300G disks in a gmirror configuration for my /home dir. After reading up more on ZFS, I've been considering swapping my gmirror for a zfs mirror. While zfs has some obvious advantages, I'm wondering how it compares performance wise to gmirror. This would be using a 4G usb flash drive exclusively as an L2ARC device and primarily used as a desktop (slightly multimedia oriented) system. What's been people's experiences using ZFS on the desktop?

System:
1800 MHz AMD Opteron (dual core)
2 GB of ram (possibly 4 in the near future)
FreeBSD 8-STABLE

And, while we're at it, are there considerable advantages to using a swap partition on a usb flash drive over a disk?  Would there be anything to be gained by, say, gstriping two 4G flash drives and dividing it between a swap and L2ARC device? Sorry if I hijacked your thread, I thought my questions might help you too.


----------



## sixtydoses (Mar 20, 2010)

No worries, you're not hijacking. This thread is an open discussion on laying out your partitions. To be honest I know zilch about L2ARC, and not much about about ZFS, gmirror and the gang.


----------



## graudeejs (Mar 20, 2010)

I have 1x 250GB and 1x 160GB 
I created pool, that covers them both, and I have ~410GB
here's my layout

```
a                     178G   197G    88K  none
a/files               156G   197G   228K  /files
a/files/archive      11,0G   197G  11,0G  /files/archive
a/files/download     4,28G   197G  4,28G  /files/download
a/files/music         108G   197G   106G  /files/music
a/files/share         443M   197G   443M  /files/share
a/files/torrents      412K   197G   412K  /files/torrents
a/files/users        3,12G  26,9G  3,12G  /files/users
a/files/video        4,60G   197G  4,60G  /files/video
a/files/vm           24,8G   197G  24,8G  /files/vm
a/home               1,79G   197G   136K  /home
a/home/killasmurf86  1,79G   197G   796M  /home/killasmurf86
a/sys                20,2G   197G    88K  none
a/sys/Root           1,42M   197G  1,42M  /root
a/sys/ccache         6,85G   197G  6,85G  /var/db/ccache
a/sys/dbports        15,5M   197G  11,5M  /var/db/ports
a/sys/distfiles      2,63G   197G  2,63G  /usr/ports/distfiles
a/sys/obj             862M   197G   862M  /usr/obj
a/sys/packages       43,1M   197G  43,1M  /usr/ports/packages
a/sys/ports          1,12G   197G  1,03G  /usr/ports
a/sys/portsnap        140M   197G   140M  /var/db/portsnap
a/sys/root           5,95G   197G  4,92G  legacy
a/sys/src             632M   197G   632M  /usr/src
a/sys/swap              2G   199G   186M  -
```

One thing I suggest is, do not install system on zpools root
http://forums.freebsd.org/showthread.php?t=6230

I use similar layout on my server


----------



## phoenix (Mar 21, 2010)

atomicplayboy said:
			
		

> This thread got me thinking about my own partition layout. Currently I've got one 250G disk divided into reasonably sized (actually probably a little overkill) /, /var, /tmp, /usr, and swap partitions. Then I've got two 300G disks in a gmirror configuration for my /home dir. After reading up more on ZFS, I've been considering swapping my gmirror for a zfs mirror. While zfs has some obvious advantages, I'm wondering how it compares performance wise to gmirror.



Performance may be slower than gmirror, or it may be faster.  Depends on the workload.  ZFS does a lot more processing than gmirror (compression, checksums, scrubs, etc) but also does a lot more caching (ARC, L2ARC) and prefetching.



> This would be using a 4G usb flash drive exclusively as an L2ARC device and primarily used as a desktop (slightly multimedia oriented) system. What's been people's experiences using ZFS on the desktop?



I use it my desktop at home, which also doubles as the media server, file server, and print server.  No real complaints.  It's fairly low-end hardware (3.0 GHz P4, 2 GB RAM), but it runs KDE 4.4.1 nice enough.



> And, while we're at it, are there considerable advantages to using a swap partition on a usb flash drive over a disk?  Would there be anything to be gained by, say, gstriping two 4G flash drives and dividing it between a swap and L2ARC device? Sorry if I hijacked your thread, I thought my questions might help you too.



Why gstripe them together?  The kernel automatically stripes swap partitions, and you can have multiple cache devices.  Either dedicate 1 as a swap and the other as L2ARC, or split them both into 2 GB pieces and add them separately.


----------



## sixtydoses (Mar 23, 2010)

Been doing some reading on L2ARC. Couple of links that I stumbled on:
http://blogs.sun.com/brendan/entry/test
http://www.leidinger.net/blog/2010/02/10/making-zfs-faster/

Questions:

Is there a general rule on L2ARC sizing? Or simply 'the more, the merrier'?
So you were saying install on the USB stick, then move everything except for / and /usr to my drive. I was wondering if there is any reason for keeping /usr instead of moving the entire /usr to the drive, leaving only / on the USB stick.

Thanks much.


----------



## atomicplayboy (Mar 23, 2010)

I'm pretty new to some of these concepts myself, but my own research has led me to believe that, with L2ARC, the more the merrier. I ran some tests and my 4G USB flash drive was pretty quickly filled up as a cache device on a pair of zstriped drives. Mind you, the throughput on flash memory isn't very fast (especially with writes), but it's my understanding that the L2ARC devices can only help. So some is better than none.

The reason why you'd want to put both / and /usr on the USB stick would be to keep the main operating system off the zfs pool. That way if you have a problem and need to boot into single user mode, you don't have to worry about your zfs pool not being loaded.


----------



## sixtydoses (Mar 23, 2010)

atomicplayboy said:
			
		

> The reason why you'd want to put both / and /usr on the USB stick would be to keep the main operating system off the zfs pool. That way if you have a problem and need to boot into single user mode, you don't have to worry about your zfs pool not being loaded.



Well yea, but with the whole subdirs of /usr moved to zfs, / alone is enough for that purpose, is it not?

Thanks.


----------



## phoenix (Mar 23, 2010)

sixtydoses said:
			
		

> Been doing some reading on L2ARC. Couple of links that I stumbled on:
> http://blogs.sun.com/brendan/entry/test
> http://www.leidinger.net/blog/2010/02/10/making-zfs-faster/
> 
> ...



The more the merrier ... to a point.  It takes something like 200 KB of RAM for every MB  of L2ARC (or something like that ... there's a thread on the zfs-discuss with a real calculation).  So you don't want to have a 1 TB of L2ARC on a system with 2 GB of RAM.  



> So you were saying install on the USB stick, then move everything except for / and /usr to my drive. I was wondering if there is any reason for keeping /usr instead of moving the entire /usr to the drive, leaving only / on the USB stick.



Easier, better, safer system recovery.  If something happens to the pool and you can't mount any of the filesystems for whatever reason, you'll want to have /usr/sbin and /usr/bin around to troubleshoot.  Having just /bin and /sbin makes things a *LOT* harder.

Plus, it keeps the OS (/ and /usr) together and separate from the apps/data (/usr/local and /home).

Thus you get:
	
	



```
USB stick (either 1 UFS filesystem for / and /usr, or 2 separate UFS filesystems for / and /usr):
  /
  /bin
  /boot
  /dev
  /etc
  /lib
  /libexec
  /rescue
  /root
  /sbin
  /usr/bin
  /usr/sbin
  /usr/lib
  /usr/libexec
  /usr/share

ZFS Pool (separate ZFS filesystems for each):
  /usr/obj
  /usr/src
  /usr/ports
  /usr/local
  /tmp
  /var
  /home
```
All the things that change a lot are on ZFS.  All the things that rarely change are on the USB stick.

All the things you need for single-user mode are on UFS.  All the things you need for multi-user are on ZFS.

Keeps things clean, (fairly) simple, and usable.


----------



## sixtydoses (Mar 30, 2010)

phoenix said:
			
		

> Thus you get:
> 
> 
> 
> ...



Thanks for the explanation, phoenix. I understand your example, in fact, that's what triggered me to say that / alone is enough (all above are under / ). By saying / and /usr, I was under the impression that the directory structure is like this:

```
/
  /bin
  /boot
  /dev
  /etc
  /lib
  /libexec
  /rescue
  /root
  /sbin
  /usr
```

Oh well, not trying to be meticulously accurate here, just somewhat confused, somewhere.

Am gonna go ahead and try with this layout ( your option D). For the L2ARC, guess am just gonna use my existing 8GB usb stick for both L2ARC and swap with 7GB:1GB ratio, and 2 2GB usb sticks for gmirror.


----------



## phoenix (Mar 30, 2010)

Sorry, forgot to add the stuff under /usr in my directory listing above.  I've fixed it.


----------



## sixtydoses (Mar 30, 2010)

phoenix said:
			
		

> Sorry, forgot to add the stuff under /usr in my directory listing above.  I've fixed it.



Yay, thanks it's all clear now :e


----------

