ZFS file system

Intro

According to wikipedia, ZFS stand for Z File System, which is an open source file system and a logical volume manager licensed under the Common Development and Distribution License.

Designed by Sun Microsystems (acquired by Oracle in 2009), and had been developed by Jeff Bonwick.

Main features

Configuration

Installing

Follow instructions for Debian on zfsonlinux website : https://github.com

Commands

Create a ZFS pool

Get disks ids

root@host:~# ls -lah /dev/disk/by-id/

Create mount point

root@host:~# mkdir /zfs

Create RAID 0

root@host:~# zpool create -f -m <mount_point> <pool_name> <type> <ids>
root@host:~# zpool create -f -o ashift=12 -m /zfs raid0_01 mirror scsi-SATA_WDC_WD20EARS-07_WD-WCAZA796741 scsi-SATA_WDC_WD20EARS-07_WD-WCAZB7569258 scsi-SATA_WDC_WD20EARS-07_WD-WCPZB7464217

Add a hot disk spare

root@host:~# zpool add tank spare ada12

List pools

root@host:~# zpool list

Print commands pool history

root@host:~# zpool history raid0_01

Change pool mount point

root@host:~# zfs set mountpoint=/zfs raid0_01

If the zfs volume doesn't mount on new system


root@host:~# zpool export raid0_01
root@host:~# zpool import -a
root@host:~# zpool import -f raid0_01

Disable atime

root@host:~# zfs set atime=off <pool>

Enable lz4 compression

root@host:~# zfs set compression=lz4 <pool>

Maintenance

Datas check (chkdsk equivalent)

root@host:~# zpool scrub raid0_01
root@host:~# zpool status

Print options

root@host:~# zfs get all <pool>

Monitoring

Print every pool informations

root@host:~# zpool get all raid0_01

Print partition state

root@host:~# zpool status -v raid0_01

Print IOs informations

root@host:~# zpool iostat <second rate> <output number>
root@host:~# zpool iostat 5 10

Encryption with dm-crypt

Disks encryption

root@host:~# cryptsetup --cipher aes-xts-plain64 --key-size 512 --hash sha1 --iter-time 1000 --use-urandom -v luksFormat /dev/sdb1
root@host:~# cryptsetup --cipher aes-xts-plain64 --key-size 512 --hash sha1 --iter-time 1000 --use-urandom -v luksFormat /dev/sdc1
root@host:~# cryptsetup --cipher aes-xts-plain64 --key-size 512 --hash sha1 --iter-time 1000 --use-urandom -v luksFormat /dev/sdd1

Open encrypted disks

root@host:~# cryptsetup luksOpen /dev/sdb1 zfs01
root@host:~# cryptsetup luksOpen /dev/sdc1 zfs01
root@host:~# cryptsetup luksOpen /dev/sdd1 zfs01

ZFS pool creation

root@host:~# zpool create -f -m /zfs raid0_01 mirror /dev/mapper/zfs01 /dev/mapper/zfs02 /dev/mapper/zfs03

source : linuxfr.org

Licence Creative Commons
This website http://shebangthedolphins.net is licensed to the public under a licence Creative Commons Attribution licence.
Contact :