# NAS with RAID, ZFS, GELI etc.



## eyebone (Jan 15, 2010)

hi folks,

i'm looking for building myself a NAS, mainly using zfs + geli. the base system is running on an external disk, so / does not change anymore and i've got a recent freebsd 8.0 running.

now, i've 4 hdd's per 2T i want to build together as:



> 1) raid10 with zfs + geli



or 



> 2) raid1 with zfs + geli



now i wonder, what freebsd tools i could use to achieve my goal for the raid in the first place. is it possible to use zfs to build my raid? in which order should i attach the disc's, first zfs or first the geli encryption?

currently i'm experimenting with zfs by reading the tutorial here:

http://forums.freebsd.org/showthread.php?t=2775&highlight=zfs+geli

but so far i miss the point with raid. on one of my earlier systems i used ccd, but i guess this is not necessary today anymore and i could use a fancy zfs feature.

if u have any suggestions or links, please post them,
thx eyebone


----------



## phoenix (Jan 15, 2010)

ZFS includes RAID functionality.

You create virtual devs (vdev) out of physical disks.  These vdevs can be single disks (no redundancy), mirrors (RAID1), raidz1 (RAID5), or raidz2 (RAID6).

These vdevs are then added to the storage pool.  By default, ZFS creates a RAID0 stripeset out of the vdevs, in effect creating RAID0, RAID10, RAID50, or RAID60 pools.

For example, to create a pool named "storage" with a single mirror vdev out of two physical disks:
`# zpool create storage mirror ad4 ad6`

You can later add another mirror vdev to that pool (thus creating a RAID10):
`# zpool add storage mirror ad8 ad10`

Or, you can go for RAID5 using all 4 disks:
`# zpool create storage raidz1 ad4 ad6 ad8 ad10`

Later, you can add another raidz1 vdev to the pool (thus creating a RAID50):
`# zpool add storage raidz1 ad12 ad14 ad16 ad18`

IOW, ZFS has everything built in that you need to manage lots of disks, and lots of diskspace.


----------



## eyebone (Jan 15, 2010)

yeah, i've to admit, i like zfs. it seems to be pretty straightforward and whats even better it works so far. i get some kernel panics because of kmem_map allocation problems, so i had to resize vm.kmem, but besides, i like it.

also i wonder, on solaris iirc there is a special zfs crypto support, is this also working at freebsd? or is there a way to container/encrypt special paths without binding a file to the mountpoint?


----------



## phoenix (Jan 16, 2010)

FreeBSD 7.2 uses ZFSv6.  FreeBSD 7.3 will include ZFSv13.

FreeBSD 8.0 includes ZFSv13.  FreeBSD 8.1 will include ZFSv14, which is the same version of ZFS as in Solaris 10.

OpenSolaris is where are all current ZFS development occurs.  New features are released into OpenSolaris builds (which happens every 2 weeks I think?) first.  Sometimes, they get backported to Solaris.  Every year or so, FreeBSD syncs with a known-good version of ZFS (or something like that).

New features go into OpenSolaris first, the bugs are worked out, and then eventually make their way into Solaris and FreeBSD.

IOW, you may have to wait up to a year before a new feature like deduplication or crypto or raidz3 will show up in FreeBSD.


----------



## Floyd (Jan 16, 2010)

Solaris 10 10/09
http://docs.sun.com/app/docs/doc/821-0382/gijtg?l=en&a=view
 brings ZFS pool version 15:
http://hub.opensolaris.org/bin/view/Community+Group+zfs/15



> Setting ZFS user and group quotas â€“ In previous Solaris releases, you could apply quotas and reservations to ZFS file systems to manage and reserve space. In this Solaris release, you can set a quota on the amount of space consumed by files that are owned by a particular user or group. You might consider setting user and group quotas in an environment with a large number of users or groups.



Without that feature one has to create one ZFS per user to limit their disk space...


----------

