Google-code-prettify

2007/08/10

ZFSスナップショットの実験

こちらを参考にZFSの実験をしました。


・snapshotテスト領域(share/share/snapshot_test3)を作成
root@julie:~# ls /share/share/snapshot_test3/
Hayate file01 file02 file03 kuraki

root@julie:~# du -sh /share/share/snapshot_test3/
6.2M  /share/share/snapshot_test3


・snapshotの取得と保存
root@julie:~# zfs snapshot share/share/snapshot_test3@big

root@julie:~# zfs send share/share/snapshot_test3@big > \
~/snapshot_test3_big


root@julie:~# ls -l ~/snapshot_test*
-rw-r--r-- 1 root root 6543960 Aug 10 08:51 /root/snapshot_test3_big


・ZFSファイルシステム(share/share/snapshot_test3)を破棄
root@julie:~# zfs destroy -r share/share/snapshot_test3

root@julie:~# zfs list
NAME             USED AVAIL REFER MOUNTPOINT
share            74.4G  154G  21K /share
share/mail          184M  154G  184M /share/mail
share/share         74.2G  154G  22K /share/share
share/share/important    20.2M  154G 20.2M /share/share/important
share/share/important@today  29K   - 20.2M -
share/share/pub       74.2G  154G 74.2G /share/share/pub


・新しいファイルシステムにsnapshotを復元
root@julie:~# zfs receive share/share/snapshot_test4 < ~/snapshot_test3_big  

root@julie:~# zfs list
NAME               USED AVAIL REFER MOUNTPOINT
share             74.4G  154G  21K /share

〜略〜

share/share/snapshot_test4   6.24M  154G 6.24M /share/share/snapshot_test4
share/share/snapshot_test4@big   0   - 6.24M -


root@julie:~# ls -l /share/share/snapshot_test4/
total 5
drwx------ 2 xxx staff 10 Aug 10 08:47 Hayate
-rw-r--r-- 1 root   root  0 Aug 10 08:06 file01
-rw-r--r-- 1 root   root  0 Aug 10 08:06 file02
-rw-r--r-- 1 root   root  0 Aug 10 08:06 file03
drwx------ 2 xxx staff 29 Aug 10 08:48 kuraki
root@julie:~# du -sh /share/share/snapshot_test4/
6.2M  /share/share/snapshot_test4


・ファイルを追加
root@julie:~# ls -l /share/share/snapshot_test4/
total 6
drwx------ 2 xxx staff 10 Aug 10 08:47 Hayate
drwx------ 2 xxx staff 24 Aug 10 11:31 Mai_K
-rw-r--r-- 1 root   root  0 Aug 10 08:06 file01
-rw-r--r-- 1 root   root  0 Aug 10 08:06 file02
-rw-r--r-- 1 root   root  0 Aug 10 08:06 file03
drwx------ 2 xxx staff 29 Aug 10 08:48 kuraki
root@julie:~# du -sh /share/share/snapshot_test4/
9.9M  /share/share/snapshot_test4


新しいスナップショットを作成し、古いスナップショットとの増分データを保存
新しいスナップショット(share/share/snapshot_test4@big2)を作成し、share/share/snapshot_test4@bigとの増分データ(差分)を保存する。
比較のため、スナップショットのコピーも保存する。

root@julie:~# zfs list
NAME               USED AVAIL REFER MOUNTPOINT
share              74.4G  154G  21K /share
〜略〜
share/share/snapshot_test4   9.91M  154G 9.88M /share/share/snapshot_test4
share/share/snapshot_test4@big  26K   - 6.24M -


root@julie:~# zfs snapshot share/share/snapshot_test4@big2

root@julie:~# zfs list
NAME                USED AVAIL REFER MOUNTPOINT
share               74.4G  154G  21K /share

〜略〜

share/share/snapshot_test4    9.91M  154G 9.88M /share/share/snapshot_test4
share/share/snapshot_test4@big   26K   - 6.24M -
share/share/snapshot_test4@big2   0   - 9.88M -


root@julie:~# zfs send -i share/share/snapshot_test4@big \
share/share/snapshot_test4@big2 >
~/snapshot_test4_big-big2

root@julie:~# zfs send share/share/snapshot_test4@big2 > \
~/snapshot_test4_big2


・作成したスナップショットのサイズを比較
root@julie:~# ls -l ~/snapshot_test*
-rw-r--r-- 1 root root 6543960 Aug 10 08:51 /root/snapshot_test3_big
 (share/share/snapshot_test4@bigの元となったスナップショット)

-rw-r--r-- 1 root root 3867496 Aug 10 11:38 /root/snapshot_test4_big-big2
 (share/share/snapshot_test4@bigとshare/share/snapshot_test4@big2の増分データ)

-rw-r--r-- 1 root root 10364864 Aug 10 11:47 /root/snapshot_test4_big2
 (share/share/snapshot_test4@big2のスナップショット)

0 件のコメント: