Ok, ZFS is now in the tree, what's now? Below you'll find some instructions how to quickly get it up and running.
First of all you need some disks. Let's assume you have three spare SCSI disks: da0, da1, da2.
Add a line to your /etc/rc.conf to start ZFS automatically on boot:
# echo 'zfs_enable="YES"' >> /etc/rc.conf
Now, setup one pool using RAIDZ:
# zpool create tank raidz da0 da1 da2
It should automatically mount /tank/ for you.
Ok, now we want to put /usr/ on ZFS and use some nifty file systems layout. I know you probably have some files already, so we will work on /tank/usr directory and once we are ready, we will just change the mountpoint to /usr.
# zfs create tank/usr
Create ports/ file system and enable gzip compression on it, because most likely we will have only text files there. On the other hand, we don't want to compress ports/distfiles/, because most files in this directory are already compressed:
# zfs create tank/usr/ports
# zfs set compression=gzip tank/usr/ports
# zfs create tank/usr/ports/distfiles
# zfs set compression=off tank/usr/ports/distfiles
(You do see how your life is changing, don't you?:))
Let's create home file system and my own home/pjd/ file system. I know we use RAIDZ, but I want to have directory where I put extremely important stuff, so I'll define that each block has to be stored in three copies:
# zfs create tank/usr/home
# zfs create tank/usr/home/pjd
# zfs create tank/usr/home/pjd/important
# zfs set copies=3 tank/usr/home/pjd/important
I'd like to have directory with music, etc. that I NFS share. I don't really care about this stuff and my computer is not very fast, so I'll just turn off checksumming (this is only for example purposes! please, benchmark before doing it, because it's most likely not worth it!):
# zfs create tank/music
# zfs set checksum=off tank/music
# zfs set sharenfs=on tank/music
Oh, I almost forget. Who cares about access time updates?
# zfs set atime=off tank
Yes, we set it only on tank and it will be automatically inherited by others.
Would be also good to be informed if everything is fine with our pool:
# echo 'daily_status_zfs_enable="YES"' >> /etc/periodic.conf
For some reason you still need UFS file system, for example you use ACLs or extended attributes which are not yet supported by our ZFS. If so, why not just use ZFS to provide storage? This way we gain cheap UFS snapshots, UFS clones, etc. by simply using ZVOLs.
# zfs create -V 10g tank/ufs
# newfs /dev/zvol/tank/ufs
# mount /dev/zvol/tank/ufs /ufs
# zfs snapshot tank/ufs@20070406
# mount -r /dev/zvol/tank/ufs@20070406 /ufs20070406
# zfs clone tank/ufs@20070406 tank/ufsok
# fsck_ffs -p /dev/zvol/tank/ufsok
# mount /dev/zvol/tank/ufsok /ufsok
Want to encrypt your swap and still use ZFS? Nothing more trivial:
WARNING: Due the way ZFS is currently implemented (also in Solaris), this might not work in low memory conditions (i.e. at those times you really need the swap space). See http://lists.freebsd.org/pipermail/freebsd-current/2007-September/076831.html for more information.
# zfs create -V 4g tank/swap
# geli onetime -s 4096 /dev/zvol/tank/swap
# swapon /dev/zvol/tank/swap.eli
Trying to do something risky with your home? Snapshot it first!
# zfs snapshot tank/home/pjd@justincase
Turns out it was more stupid than risky? Rollback your snapshot!
# zfs rollback tank/home/pjd@justincase
# zfs destroy tank/home/pjd@justincase
Ok, everything works, we may set tank/usr as our real /usr:
# zfs set mountpoint=/usr tank/usr
Don't forget to read zfs(8) and zpool(8) manual pages and SUN's ZFS administration guide.
For a more light-hearted introduction to ZFS' features, see this humorous presentation given by Pawel at EuroBSDCon 2007:
http://youtube.com/watch?v=o3TGM0T1CvE
分享到:
相关推荐
最新的Freebsd中文使用手册,再官网的文档链接里选择中文可下载。
FreeBSD 7.0特性预览胶片,介绍了即将发布的FreeBSD 7.0版本中引入的新特性
FreeBSD 7.0 全程图解安装手册
freebsd中的sctp源码 sctp协议是电信信令的传输协议,以后更可能最为一种普遍使用的协议应用在互联网中
FREEBSD7.0 系统恢复安装图解--摘自系统之家
freebsd7.0安装图解过程_-_unix的应用 freebsd7.0安装图解过程_-_unix的应用
构建基于Freebsd 7.0,postfix,Extmail的邮件服务器,包括垃圾邮件过滤,病毒查杀等配置,包括详细的配置过程和截图。
FreeBSD 7.0 内核源代码,由于上传限制文件为15M,所以就分为两部分了,下载后解压到同一目录SYS下……
FreeBSD 7.0 内核源代码,由于上传限制文件为15M,所以就分为两部分了,下载后解压到同一目录SYS下…… (资源有问题请到http://blog.csdn.net/itufo留言!)
FreeBSD7.0编译安装nginx+php+mysql[定义].pdf
FreeBSD7.0编译安装nginx+php+mysql.pdf
FreeBSD7.0编译安装nginx+php+mysql借鉴.pdf
FreeBSD就是一种运行在Intel平台上、可以自由使用的Unix系统,它可以从Internet上免费获得.而它又具备极其优异的性能,使它得到了计算机研究人员和网络专业人士的认可.因此,不但专业科研人员把它用作个人使用的Unix...
FreeBSD_7.0_全程图解安装手册.doc FreeBSD_7.0_全程图解安装手册.doc FreeBSD_7.0_全程图解安装手册.doc FreeBSD_7.0_全程图解安装手册.doc FreeBSD_7.0_全程图解安装手册.doc