免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1839 | 回复: 0
打印 上一主题 下一主题

ZFS - quick start. [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-04-10 09:18 |只看该作者 |倒序浏览
Pawel Jakub Dawidek
[email=freebsd-current%40freebsd.org?Subject=ZFS%20-%20quick%20start.&In-Reply-To=]pjd at FreeBSD.org [/email]

Ok, ZFS is now in the tree, what's now? Below you'll find some
instructions how to quickly make 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
Load ZFS kernel module, for the first time by hand:
        # kldload zfs.ko
Now, setup one pool using RAIDZ:
        # zpool create tank raidz da0 da1 da2
It should automatically mount /tank/ for you.
Ok, now put /usr/ on ZFS and propose some file systems layout.  I know
you probably have some files already, so we will work on /tank/usr
directory and once we 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 we keep compressed
stuff already in-there:
        # 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, my own home/pjd/ file system. I know we
use RAIDZ, but I want to have directory where I put extremly important
stuff, you I'll define that each block has to be stored in tree 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.
Will 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 at 20070406
        # mount -r /dev/zvol/tank/
ufs at 20070406
/ufs20070406
        # zfs clone tank/
ufs at 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:
        # 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 at justincase
Turns out it was more stupid than risky? Rollback your snapshot!
        # zfs rollback tank/home/
pjd at justincase
        # zfs destroy tank/home/
pjd at 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:
       
http://www.opensolaris.org/os/community/zfs/docs/zfsadmin.pdf
--
Pawel Jakub Dawidek                       
http://www.wheel.pl
pjd at FreeBSD.org
                           
http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url :
http://lists.freebsd.org/pipermail/freebsd-current/attachments/20070406/d16eb0ea/attachment.pgp


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/10543/showart_274551.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP