ZFS 常用指令 (FREEBSD)

ZFS常用指令

ZFS 的 zpool 指令

#zpool create storage1 ad1 # 建立storage1 這個 pool。

#zpool create storage2 mirror ad2 ad3 # 建立 Raid1(1+1=1) Mirror 格式,資料會同時寫入兩棵 HD。

#df -h # 查看 storage1 pool 是有已經建立

#zpool status # 查看本機 ZFS 的狀態

#zpool list # 查看 pool 的空間使用狀態

#zpool offline storage1 ad1 # 讓 storage1 這個 pool 的 ad1 硬碟暫時離線

#zpool online storage1 ad1 # 讓 storage1 這個 pool 的 ad1 硬碟重新上線

#zpool import storage1 # 掛載(mount) storage1 這個 pool

ZFS 的 zfs 指令

#zfs create storage1/files1 # 在 storage1 這個 pool 中建立一個檔案目錄 files1

#zfs list # 查看 ZFS 檔案狀態

#zfs mount # 查看所有 ZFS 掛載的磁區

#zfs create storage1/files2 # 於 storage pool 中再建立一個 files2 檔案目錄

#zfs set mountpoint=/storage2/data1 storage1/data1 # 設定真實掛載點由原來的 /storage1/data1 改為 /storage2/data1

#zfs destroy storage1/data1 # 刪除 storage1/data1 檔案目錄