ZFS

めんどくせーからzfs用メモ晒す

More than 1 year has passed since last update.

ZFSメモ

Pool作成
zpool create tank /dev/da0s1
zpool create tank mirror /dev/da0s1 /dev/da0s2 mirror /dev/da1s1 /dev/da1s2
zpool create tank raidz /dev/da0s1 /dev/da0s2
zpool create tank raidz2 /dev/da0s1 /dev/da0s2 /dev/da0s3
pool add tank raidz1 /dev/da0s4 /dev/da0s5

Mountは自動だけど色々変えたい場合
zfs set mountpoint=none tank
zfs create -o mountpoint=/home tank/home
zfs set quota=10G tank/home
zfs destroy zfs_test/home
zpool destroy tank

Snapshot関連
zfs snapshot tank/home@test3
zfs list -t snapshot
zfs rollback -r tank/home@test3
zfs destroy tank/home@test3
zfs clone tank/home@test3 tank/home3
zfs promote tank/home3

RAID1
zpool create tank mirror /dev/da1s1 /dev/da1s2

RAID10
zpool add tank mirror /dev/da1s3 /dev/da1s4

RAID1[HDDx4]
zpool create tank mirror /dev/da1s1 /dev/da1s2 /dev/da1s3 /dev/da1s4
zpool detach tank /dev/da1s3
zpool detach tank /dev/da1s4

DESTROY
zpool destroy tank
zpool destroy -r tank 再帰でなにもかも消すので注意

DISPLAY
zfs list
zpool list
zpool status [ -v 10 ]とか

zvolとか
zfs rename tank/volumes/v2 tank/volumes/v1
zfs create -V10G z/block
newfs /dev/zvol/block
mount /dev/zvol/block /mnt

簡易速度測定
while true; do dd if=/dev/zero of=./test bs=10m count=5 2>&1 | grep sec | awk '{print $1 / 1024 / 1024 / $5, "MB/sec" }'; done