- Linux Mint 17.2
- LAN直結のscpで110MB/s出て感動した
参考
- HOWTO install Ubuntu 14.04 or Later to a Native ZFS Root Filesystem · zfsonlinux/pkg-zfs Wiki · GitHub
- めんどくせーからzfs用メモ晒す - Qiita
パッケージインストール
add-apt-repository ppa:zfs-native/stable
apt-get update
apt-get install -y build-essential
apt-get install -y spl-dkms zfs-dkms ubuntu-zfs
modprobe zfs
import
zpool import -d /dev/disk/by-id rpool
RAID1作成
zpool create rpool mirror /dev/sdb1 /dev/sdc1
zpool status -v rpool
- /rpool が利用できる。
削除方法
zpool destroy rpool
OS起動時に自動マウント
/etc/init/zpool-import.conf の zfs_autoimport_disable を0にすればいい
/etc/init/zpool-import.conf
- modprobe zfs zfs_autoimport_disable=1
+ modprobe zfs zfs_autoimport_disable=0
zfs set mountpoint=legacy rpool
mkdir /rpool
/etc/fstab
rpool /rpool zfs defaults 0 0
SSDをキャッシュに使う
パーティション確認(今回sda2,sda3を用いる)
# fdisk -l /dev/sda
Disk /dev/sda: 80.0 GB
デバイス ブート 始点 終点 ブロック Id システム
/dev/sda1 * 2048 83888127 41943040 83 Linux
/dev/sda2 83888128 136316927 26214400 83 Linux
/dev/sda3 136316928 156301487 9992280 83 Linux
rwのキャッシュに追加
zpool add rpool log /dev/sda2
zpool add rpool cache /dev/sda3
- log : 書き込みのキャッシュ (そんなに大きくなくていい気がする今回3.5GB)
- cache : 読み込みのキャッシュ (極力大きくしたほうが良い。今回31GB)
確認
# zpool status
pool: rpool
state: ONLINE
scan: none requested
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
ata-ST3500418AS_5VM1S9V7-part1 ONLINE 0 0 0
ata-ST3500413AS_9VMXRFE5-part1 ONLINE 0 0 0
+ logs
+ sda2 ONLINE 0 0 0
+ cache
+ sda3 ONLINE 0 0 0
update-initramfs -u
キャッシュから削除方法
zpool remove rpool /dev/sda2
zpool remove rpool /dev/sda3
homeをzfsにする
zfs create rpool/home/user1
zfs set mountpoint=legacy rpool/home/user1
mkdir -p /rpool/home/user1
/etc/fstab
rpool/home/user1 /rpool/home/user1 zfs defaults 0 0
/rpool/home/user1 /home/user1 none bind
NFSアクセス
iostat
iostatの結果
$ sudo zpool iostat rpool 1
capacity operations bandwidth
pool alloc free read write read write
---------- ----- ----- ----- ----- ----- -----
rpool 10.2G 454G 3 61 389K 3.92M
rpool 10.2G 454G 525 605 65.7M 75.1M
rpool 10.2G 454G 524 396 65.6M 49.2M
...
キャッシュの状況
$ sudo zpool iostat -v rpool
capacity operations bandwidth
pool alloc free read write read write
---------------------------------- ----- ----- ----- ----- ----- -----
rpool 17.3G 447G 11 75 1.38M 5.64M
mirror 17.3G 447G 11 75 1.38M 5.63M
ata-ST3500418AS_5VM1S9V7-part1 - - 6 54 757K 5.64M
ata-ST3500413AS_9VMXRFE5-part1 - - 5 54 657K 5.64M
logs - - - - - -
sda2 0 3.50G 1 14 9.01K 904K
cache - - - - - -
sda3 44.6M 31.0G 0 252 26.1K 8.57M
---------------------------------- ----- ----- ----- ----- ----- -----