ZFS On Debian 9

aptitude install linux-headers-$(uname -r) zfs-dkms zfsutils-linux libkmod-dev
modprobe zfs
aptitude install gdisk
sgdisk --zap-all /dev/disk/by-id/...    ## remove existing partition table
sgdisk -a1 -n2:34:2047 -t2:EF02 /dev/disk/by-id/     ## create GPT entries
## never use /dev/sd* for pool creation use instead /dev/disk/by-id/*
zpool create -o ashift=12 pool1 mirror -R /mnt/zfs /dev/disk/by-id/... /dev/disk/by-id/...
zpool status
zpool list
zfs set compression=lz4 pool1    ## enable compression for this pool
zfs get compressratio pool1
zfs create pool1/dataset1    ## create new filesystem in pool which is mounted on the fly

Using Snapshots

zfs set snapdir=visible pool1/dataset1
zfs snap pool1/dataset1@first-snapshot ## create first snapshot
zfs snap pool1/dataset1@second-snapshot ##  create secodn snapshot
zfs rollback pool1/dataset1@first-snapshot ## rollback first snapshot
zfs destroy pool1/dataset1@second-snapshot ## delete second snapshot
zfs clone pool1/dataset1@first-snapshot pool1/firstclone ## create clone

aptitude install zfs-auto-snapshot
zfs-auto-snapshot --quiet --syslog --label=daily --keep=31 pool1/dataset1 ## make daily snapshots, keep for 31 days
zfs-auto-snapshot --quiet --syslog --label=monthly --keep=12 pool1/dataset1

Transfer ZFS Snapshot Over Network

zfs send mypool/testarea@first-snapshot | gzip > /mnt/backup/snapshot.img.gz ## save snapshot as image
zfs send mypool/testarea@first-snapshot | ssh host "zfs receive remotepool/blabla" ## send snaphsot to remote host
zfs send -p -R ... ## transmit settings like compression
zfs send mypool/testarea@first-snapshot mypool/testarea@second-snapshot ... ## send just incremental changes
## speedup receive
zfs send -i mypool/testarea@first-snapshotman s | ssh host "mbuffer -s 128k -m 1G | zfs receive -F tank/pool
## speedup send & receive:
# Start the receiver first. This listens on port 9090, has a 1GB buffer,
    and uses 128kb chunks (same as zfs):
mbuffer -s 128k -m 1G -I 9090 | zfs receive data/filesystem
# Now we send the data, also sending it through mbuffer:
zfs send -i data/filesystem@1 data/filesystem@2 | mbuffer -s
    128k -m 1G -O 10.0.0.1:9090

ZFS on Debian (zuletzt geändert am 2017-10-13 08:33:10 durch anonym)


Creative Commons Lizenzvertrag
This page is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.