3

There are many tutorials on ZFS but I couldn't find a single one which covers the changes in commands when one uses only a single drive. I know by now that the parameter copies=2 is used but what changes in the other commands and how do the workflow commands looks like when I want to sync my data to the ZFS drive?

I understand that when the singe drive breaks (not only one block, since this could still be repaired because the data is twice there) but the whole drive), all data is lost, even if the data is twice there (copies=2), but this way ZFS's features still work so I want to try it. I also understand that the capacity of the drive is of course halved because of copies=2.

At the moment I use ext4 and want change to use ZFS, what do the commands look like? Do I need like delete the data in a special way, or at all, first? Also as I understand it, no rsync is needed and ZFS provides its own tools?

-- edit --

Ok, it looks like this works, just tested it:

  1. Find/view drive: # fdisk -l or $ mount
  2. Create pool: # zpool create -f YOURPOOLNAME /dev/sdX

  3. Create filesystem and set features:

# zfs create YOURPOOLNAME/YOURNAME
# zfs set compression=off YOURPOOLNAME/YOURNAME
# zfs set copies=2 YOURPOOLNAME/YOURNAME

(to turn compression on: .. compression=gzip ..)

  1. Use filesystem. It should be located in /YOURPOOLNAME/YOURNAME when mounted (when you excuted these commands, it should already be mounted there).

4.1 The typical tools like rsync can be used on it.

zfsoot
  • 31
  • 1
  • 3

1 Answers1

3

You cannot convert an ext4 file system to a zfs one, you need to backup the data stored on the ext4 fs somewhere else, unmount the ext4 fs and create a zfs pool on the disk. This will overwrite anything.

You'll likely need to use the -f option (force) if zpool detects something else was previously there.

After that, you can use the automatically created file system just like any other, and rsync can certainly be used to sync your data on the disk.

jlliagre
  • 8,691
  • 16
  • 36
  • Thanks so far. I need the commands in regard with, if any, changes in them when copies=2 is used. So far it looks like only copies=2 needs to be set on a certain filesystem. So first a zpool needs to be created, then a filesystem (let's call it "data") (there can be many filesystems in a zpool, with different settings) and then that filesystem "data" needs a copies=2 setting. – zfsoot Nov 16 '15 at 21:21
  • 1
    `copies=2` never "needs" to be set, that's up to you to decide. You might want to set `copies=2` to a file system containing the files you want to be more protected against media corruption and let the default to another file system with files not requiring it. If some files are really critical, beware that `copies=2` is less robust that real redundancy, and that in any case, raid doesn't substitute with backups. – jlliagre Nov 16 '15 at 21:55
  • Yes, but as mentioned, one needs to set it to test ZFS's checksum based data integrity feature (wikipedia states that this is "One major feature that distinguishes ZFS from other file systems ..."). Of course, as also mentioned, two drives or more are better than one. – zfsoot Nov 16 '15 at 22:30
  • Data integrity is verified by zfs even when `copies=2` is not set. The difference is that there will be no self healing in that case and the read operation will fail with an error. – jlliagre Nov 17 '15 at 11:08