# Some questions about ZFS



## singhsukhwinder (Nov 5, 2012)

Hi All
I have used FreeBSD for quite some time,and have reasonable knowledge about setting up RAID 1 on FreeBSD , But I am new to ZFS, I have some queries about using ZFS :

Where can I find some basic information about ZFS, like terminologies used, eg snapshot, tank, pool etc, because all tutorial available only provide commands to set up ZFS without giving basic information about ZFS.
What is main difference between using RAID 1 with FreeBSD and using ZFS, is there any specific added advantage.
Do I have to use RAID also with ZFS? (My Basic requirement is mirroring data, to prevent data loss against HDD failure.
Is it recommended to use ZFS on my system having following Hardware
Intel Pentium D (Dual Core First Generation)
512 Mb of RAM, (But it will be upgraded to 2GB befor setting up FreeBSD, it is currently running Ubuntu 6.10 LAMP server for intranet, number of hits are not much but MySQL database size is about 2GB
Two Hard Disk drives of 500GB each to be used for mirroring.


Thanks in advance


----------



## throAU (Nov 5, 2012)

I'll answer what I can:


If you are familiar with RAID, you can think of ZFS pools as logical disks.  The filesystems within the pool are sort of like partitions on a RAID logical disk.  "tank" is just a generic name people use for their system's ZFS pool.  You could call the pool "zpool" or "systempool" or "fred" if you wanted to.
with regards to RAID1 vs ZFS - ZFS does checksums on the data as it writes to or reads from disk to verify it was written or read correctly, and to detect corruption that simple disc surface problem detection won't detect.  Also, ZFS has knowledge of which parts of the disk are utilised.  Normal RAID1 has no knowledge of the filesystem so a disk failure means a rebuild of the entire storage capacity for the mirror.  If a ZFS disk is only 10% used and fails, only 10% of the capacity needs to be reconstructed, which is obviously much faster.
You don't NEED to use RAID with ZFS, however without some form of fault tolerance, ZFS will not be able to correct errors - only detect them.  You can store multiple copies of data on a single ZFS disk, but obviously total disk failure would result in loss of data.  However, if the disk was not totally failed, and partial data corruption was detected in one copy of the data, the correct data could be retrieved from one of the other copies.
To get the best out of ZFS, you need plenty of RAM.  You can get it working with 512MB (so long as you run a 64 bit OS), but it won't be fast, and it won't leave much RAM for your applications.  In your case I would recommend to stick with basic mirroring.  I currently run my home NAS with 4gb and ZFS, and 4gb is not enough to enable caching.


----------



## Sfynx (Nov 5, 2012)

With 512 MB RAM it is certainly a no-go, I would then use gmirror. However, with 2 GB of RAM you can run ZFS quite decently if you do not have a heavy workload on your drives, especially with some kernel variable tuning to optimize things for your workload.

For hassle-free non-tuned setups I recommend at least 8 GB RAM though.


----------



## singhsukhwinder (Nov 6, 2012)

Thanks for Reply
I have upgraded RAM to 2.5GB, and this server has to be used as Apache,Mysql,PHP, FTP server. It is Intel Pentium Dual core 2.8Ghz processor, and I m sure it will support Freebsd AMD 64 bit. So with this configuration will it run ZFS with decent speed?

 Currently im running it with(from last 6 years) ubuntu 6.10 32 Bit (Desktop edition having apache,mysql,php, ftp installed along with GNOME). RAM usage is only < 180-200MB , but there are some times  when Cpu usage touching 100% and then falling to ~0% immediately  ( I think these are being caused by MySQL). this cause pages to stop loading halfway for 3-4 seconds, sometimes. other wise it delivers pages very fast.

In RAID 1, if i use 2 HDDs of 500GB+500GB the effective capacity i will get is 500GB, But what if i use ZFS, will it be only 500GB again? if it will be 1TB then i can afford to setup ZFS instead of UFS with RAID.

So kindly advice me to weather to go for ZFS or use UFS with RAID 1.

@throAU : if I dont not misunderstand, NAS means Network Attached Storage? can i configure NAS in this Same server, as currently im using FTP server for providing storage to my office people, if so , what addition package i need to install in this?

Thanks Once Agin


----------



## throAU (Nov 6, 2012)

With ZFS, you place disks into VDEVs (which are like RAID groups - can be single disk VDEVs, mirrors, RAIDZ (like RAID5) or RAIDZ2 (like RAID6)) before adding them to the pool.  The pool will then stripe across all VDEVs (like RAID0).

So, in your case, you have 2 disks, your only options with ZFS are either a single mirror VDEV, or 2 VDEVs of single disk each (no redudnancy, like RAID 0 - which is somewhat pointless).

The only sane ZFS option is a single VDEV pool with a 2 disk mirror.  It will contain 500gb.


Whether the performance will be good enough or not will depend on your workload - unfortunately we don't know what that is.  However it is worth noting that the checksums ZFS does do not come free - they need CPU.  

As far as my NAS goes - I'm simply running FreeNAS (which uses ZFS) as a home-made NAS appliance.


----------

