差異處
這裏顯示兩個版本的差異處。
下次修改 | 前次修改 | ||
zfs [2016/09/30 02:37] 127.0.0.1 建立 |
zfs [2018/12/27 00:41] (目前版本) jz |
||
---|---|---|---|
行 1: | 行 1: | ||
- | ====== qouta ====== | + | ====== ZFS ====== |
+ | |||
+ | ====== Format ====== | ||
+ | <code> | ||
+ | ls -l /dev/disk/by-id | ||
+ | # mirror (advanced format disks: ashift=12) | ||
+ | zpool create -f -o ashift=12 -m /mnt/data POOL_NAME mirror [disk-ID] | ||
+ | zpool status | ||
+ | zpool status -v | ||
+ | </code> | ||
+ | |||
+ | ====== Dataset ====== | ||
+ | <code> | ||
+ | # enable encryption feature | ||
+ | zpool set feature@encryption=enabled POOL_NAME | ||
+ | |||
+ | # encrypted dataset with passphrase | ||
+ | zfs create -o encryption=aes-256-gcm -o keyformat=passphrase POOL_NAME/DATASET_NAME | ||
+ | |||
+ | # encrypted dataset with key | ||
+ | dd if=/dev/urandom of=/tmp/key bs=1 count=32 | ||
+ | zfs create -o encryption=aes-256-gcm -o keyformat=raw -o keylocation=file:///tmp/key POOL_NAME/DATASET_NAME | ||
+ | |||
+ | # load key | ||
+ | zfs load-key POOL_NAME/DATASET_NAME | ||
+ | |||
+ | # mount all | ||
+ | zpool import -a -f | ||
+ | zfs mount -a | ||
+ | |||
+ | # get property | ||
+ | zfs get -p encryption,keylocation | ||
+ | |||
+ | # delete dataset | ||
+ | zfs destroy POOL_NAME/DATASET_NAME | ||
+ | </code> | ||
+ | |||
+ | ====== Scrub ====== | ||
+ | <code> | ||
+ | zpool scrub POOL_NAME | ||
+ | |||
+ | # scrub once a week | ||
+ | crontab -e | ||
+ | 0 6 * * 1 zpool scrub POOL_NAME | ||
+ | </code> | ||
+ | |||
+ | ====== Qouta ====== | ||
+ | <code> | ||
zfs set quota=100M zroot/usr/home/username | zfs set quota=100M zroot/usr/home/username | ||
zfs list | zfs list | ||
zfs get quota zroot/usr/home/username | zfs get quota zroot/usr/home/username | ||
+ | </code> | ||
+ | |||
+ | ====== Snapshot ====== | ||
+ | |||
+ | ===== Manual ===== | ||
+ | <code> | ||
+ | zfs snapshot tank/pool@snapshot | ||
+ | zfs rename tank/pool@snapshot tank/pool@snapshot-renamed | ||
+ | zfs rollback tank/pool@snapshot-renamed | ||
+ | zfs destroy tank/pool@snapshot-renamed | ||
+ | </code> | ||
+ | |||
+ | ===== Scheduled ===== | ||
+ | <code> | ||
+ | yaourt znapzend | ||
+ | znapzendzetup create --recursive SRC '7d=>1h,30d=>6h,60d=>1d' tank/pool | ||
+ | znapzend --debug --runonce tank/pool | ||
+ | zfs list -t snapshot | ||
+ | systemctl enable znapzend | ||
+ | systemctl start znapzend | ||
+ | </code> | ||
+ | |||
+ | Ref | ||
+ | * https://docs.oracle.com/cd/E23823_01/html/819-5461/gazvb.html | ||
+ | * https://lildude.co.uk/zfs-cheatsheet | ||
+ | * https://wiki.archlinux.org/index.php/ZFS | ||
+ | * https://blog.heckel.xyz/2017/01/08/zfs-encryption-openzfs-zfs-on-linux/ | ||
- | 參考 | ||
- | * 無序列表項目https://docs.oracle.com/cd/E23823_01/html/819-5461/gazvb.html |