Page 1 of 1

single drive pool with copies=2

PostPosted: Wed Dec 06, 2017 11:28 pm
by e8vww
Can I get protection against corruption in a single disk by using copies=2? What terminal command would I use to create it?

Re: single drive pool with copies=2

PostPosted: Thu Dec 07, 2017 4:42 pm
by Sharko
Well, I believe that you can just use:

Code: Select all
sudo zfs set copies=2 tank/dataset

Where tank is the name of original pool you set up, and dataset is the name of the dataset you want to start making redundant copies of data. Note that this doesn't affect data already written to the dataset; it only tells ZFS to make a second copy of data blocks that are new as they come into the dataset. To convert a dataset with existing data to a dataset that has redundant data you would presumably have to copy the data off the existing dataset to a backup drive, destroy the original dataset, re-create the dataset (with "-o copies=2" in the dataset creation process), and then copy the data back from the backup onto the new dataset.

To answer your first question, will you get protection... you get some protection, at a price. You are still at risk if the disk catastrophically fails and can't return any data. But you are better protected against the scenario where the disk starts to gradually degrade. It comes with a price, however; I believe that ZFS tries to store the redundant copies far from each other on the disk, and thus writing to disk is going to be extra slow: first because of the two copies, and secondly because of the copies being at greatly different locations (requiring a seek, the slowest operation of a spinning disk).

So, if you have gobs of space on your disk, and you don't have a need for speed, then perhaps the "copies=2" property is worth using. I could see using it on a big backup disk that only has to complete its backup overnight, or something like that.