# ZFS keeping data separate?



## es131245 (Feb 15, 2014)

Migrating from UFS to ZFS. Got some questions.
My server uses many disks
ada0 / 200G
ada1 /usr/www 500G
ada2 /usr/source 1T
ada3 /usr/ftp 80G
ada4 /media/    ### backUp or mirror disk

backUpServer ### dedicated backUp server
ada0 / 2T

Questions are:
1) How to keep data separate? Like keeping ftp data on its own ftp disk?
2) how can ada4 mirror 4 disks?


----------



## ralphbsz (Feb 17, 2014)

*Re: ZFS keeping data seperate?*



			
				es131245 said:
			
		

> 1) How to keep data separate? Like keeping ftp data on its own ftp disk?


Create multiple pools.  One pool for each thing you want to keep separate.  Then put only the disks you want into those pools.

But: May I use why you want to keep things so separate?  And why you want to run with 5 disk drives?  Are all of them full?  Here's why I'm asking.  If your total space usage is less than your total capacity, you could radically simplify your system.  For example, if your space usage is less than 1 TB, I would get rid of 4 of 5 disks, and just one the single 1 TB disk.  Why?  Because simple is generally better (more reliable, less chance for error).  You could even use mirroring (if you worry about disk reliability), and put one copy of the data on the 1 TB disk, and the second copy on the 200 and 500 GB disks.



> 2) how can ada4 mirror 4 disks?


I don't understand what you mean by this question.


----------



## es131245 (Feb 17, 2014)

*Re: ZFS keeping data seperate?*

2) last disk if for backUp, last disk is going to store copies of first 4 disks (ada dev's)
1) Why 4-5 disks? I want to separate load betwen all of the disks. Yes, root and http are empty but source and ftp are almost full. So i can mirror only root and http disks. Moreover there is a backUp disk than can be used as a mirror.


----------



## ralphbsz (Feb 17, 2014)

*Re: ZFS keeping data seperate?*

OK, I think I get it.  You want to do performance isolation: you don't want workload on one disk (for example the root disk) to affect performance on another disk (for example the http disk).  Although I find it unlikely that the root disk has any performance issues (since workload is usually minimal on root), and in most single-server configurations, the performance of a web server is unlikely to be limited by the underlying disk drive.  But you are free to do it.

Now, can you combine that with mirroring, using just the last disk for mirroring?  Absolutely.  Here is one simple way to do it: On the last disk, create partitions, each the same size as one of the other disks.  Then set up ZFS to use mirror pairs as volumes, for example (ada0 and ada4p1), (ada1 and ada4p2), and so on.  But: In doing so, you defeat the purpose of performance isolation.  Anytime you do a write to for example the root file system, ZFS will have to write (simulatenously) to both ada0 and ada4.  And if you read from for example the http file system, ZFS will issue the read to either ada1 or ada4.  So workload on one of these file systems will now compete for performance with the other, on the last disk.  Personally, I don't trust disks, and I would always prefer a reliable system (using RAID, for example mirroring) over some performance, but this is your system.

Another option: Just use the last disk for backups.  For example, create a giant file system on it, and regularly (every hour? every day?), `rsync` the other file systems onto it.  Now you have performance isolation.  But you will regularly run performance-eating backups, and your backups are always slightly out of date, unlike mirrors.

Your other backup disk seems to be on another system (it has the same device name, ada0, as the boot disk of the first system).  That means you can't use it as a mirror.  In theory, you could export it using something like iSCSI or Infiniband, but network RAID is tricky (in particular from a performance point of view), and shouldn't be attempted using file systems that weren't designed for it.

Hope this helps.


----------



## usdmatt (Feb 18, 2014)

*Re: ZFS keeping data seperate?*

You can easily keep the data separate by just creating a single-disk pool on each disk.
If you also make ada4 into a ZPOOL, you can send incremental snapshots of your live data to it using `zfs send`/`zfs recv`, which will be a lot faster than using rsync. You can also use these commands over SSH to send snapshots to your backup server if that is also using ZFS. (You can actually send ZFS snapshots to a file and just store them as files if you backup device isn't ZFS based, but it's not generally recommended. A single error in the snapshot file will make the entire backup useless if you ever try to restore it).

As mentioned though, I would also rather design the system to have a redundant pool (even if it meant possibly buying another disk) than run lots of separate disks for performance reasons. I'm not sure how much better (if any) your system will handle load compared to one built with the disks in something like a RAID10 style layout.


----------

