最終更新時間:2025年07月09日 18時50分30秒
ZFS の使い方が慣れないので書いておく
状態確認
# zfs list # zpool status # df
プール
プールの作成
まずは HDD 1本で作ってみる
# zpool create samba /dev/ada1
HDD を追加するときは
# zpool add samba /dev/ada2
みる
# zpool status jail
プロパティ
# zpool get all zroot # zpool get readonly
削除
# zpool destroy samba
データセット(ファイルシステム)
データセットを作成
# zfs create samba/home # zfs create samba/public
みる
# zfs list
リネーム
# zfs rename zroot/usr/local zroot/usr/new-local
削除
マウントされているファイルもディレクトリも削除
# zfs destroy zroot/samba/home
プロパティ
みる
# zfs get mounted zroot/ROOT # zfs get -r mounted zroot/ROOT # zfs get compression
容量節約 & 制限
# zfs set compression=gzip samba/home # zfs set quota=2G zroot/usr/home
スナップショット
# zfs snapshot zroot/usr/home@2018-07-21-13:09:00 # zfs list -t snapshot
情報は,.zfs/snapshot 以下にあるが,ls -a で見えない
ごにょごにょしたけど,元に戻したい
# zfs rollback zroot/usr/home@2018-07-21-13:09:00
別のところに復活させたい
# zfs clone zroot/usr/home@2018-07-21-13:09:00 zroot/usr/home2
いらないものは,捨てる
# zfs destroy zroot/usr/home@2018-07-21-13:09:00
ACL関係
NFSv4 ACL が採用されており,getfacl / setfacl コマンドで操作する.
access permissions
short | long | |
---|---|---|
1 | r | read_data |
2 | w | write_data |
3 | x | execute |
4 | p | append_data |
5 | D | delete child |
6 | d | delete |
7 | a | read_attribute |
8 | A | write_attribute |
9 | R | read_xattr |
10 | W | write_xattr |
11 | c | read_acl |
12 | C | write_acl |
13 | o | write_owner |
14 | s | synchronize |
まとめて指定する場合
full_set / modify_set (C と o 除く) / read_set ( r,a,R,c の4つ) / write_set ( w,p,A,W の4つ) が使える
ACL inheritance flags
short | long | |
---|---|---|
1 | f | file_inherit |
2 | d | dir_inherit |
3 | i | inherit_only |
4 | n | no_propagate |
5 | I | inherited |