From owner-freebsd-fs@FreeBSD.ORG Fri Apr 6 21:43:39 2007 Return-Path: X-Original-To: freebsd-fs@FreeBSD.org Delivered-To: freebsd-fs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 60B0516A405; Fri, 6 Apr 2007 21:43:39 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (arm132.internetdsl.tpnet.pl [83.17.198.132]) by mx1.freebsd.org (Postfix) with ESMTP id AD55013C483; Fri, 6 Apr 2007 21:43:38 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id C8795487FB; Fri, 6 Apr 2007 23:43:36 +0200 (CEST) Received: from localhost (154.81.datacomsa.pl [195.34.81.154]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id E9B3F45681; Fri, 6 Apr 2007 23:43:30 +0200 (CEST) Date: Fri, 6 Apr 2007 23:43:25 +0200 From: Pawel Jakub Dawidek To: freebsd-current@FreeBSD.org Message-ID: <20070406214325.GB61039@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="bg08WKrSYDhXBjb5" Content-Disposition: inline X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 7.0-CURRENT i386 User-Agent: mutt-ng/devel-r804 (FreeBSD) X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-2.6 required=3.0 tests=BAYES_00 autolearn=ham version=3.0.4 Cc: freebsd-fs@FreeBSD.org Subject: ZFS - quick start. X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2007 21:43:39 -0000 --bg08WKrSYDhXBjb5 Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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=3D"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=3Dgzip tank/usr/ports # zfs create tank/usr/ports/distfiles # zfs set compression=3Doff 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=3D3 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=3Doff tank/music # zfs set sharenfs=3Don tank/music Oh, I almost forget. Who cares about access time updates? # zfs set atime=3Doff 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=3D"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: # 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=3D/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 --=20 Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --bg08WKrSYDhXBjb5 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (FreeBSD) iD8DBQFGFr79ForvXbEpPzQRAhBXAJ0TF5dJ7v+K2MesPZQim5P+HM9apwCg4Uqt 8pqudyaAa/M1rwcvs6829xI= =QFnZ -----END PGP SIGNATURE----- --bg08WKrSYDhXBjb5--