zfsquickstartguide

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
zfsquickstartguide [2007/04/25 21:31] – PawelJakubDawidekzfsquickstartguide [2021/05/04 10:51] (current) – Fix 1 broken link. SashaVigole
Line 1: Line 1:
-Ok, ZFS is now in the tree, what's now? Below you'll find some +<callout type="warning"> 
-instructions how to quickly make it up and running.+**Warning** 
 +This document is outdated, start with the %%FreeBSD%% Handbook's [[https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/zfs-quickstart.html|ZFS Quick Start Guide]] if you have not read it yet. 
 +</callout> 
 + 
 +Ok, [[ZFS]] is now in the tree, what's now? Below you'll find some 
 +instructions how to quickly get it up and running. 
 + 
 +April 8, 2008: **Just because ZFS is in 7.0-RELEASE does *not* mean it works with the default GENERIC kernel!**  In fact, you are highly likely to experience kernel panics under any kind of load with ZFS and a GENERIC kernel.  If you skipped reading [[ZFSTuningGuide|Tuning Guide for ZFS]], go back and do that before trying anything else in this document!  While "tuning" may sound like something that is optional or perhaps only for performance, it is a **requirement** for stable %%FreeBSD%% 7.0-RELEASE ZFS. 
 + 
 +December 2009: It is probably best to use ZFS only with %%FreeBSD%% 7.3 and newer versions. 
 + 
 +With that said, on to getting started...
  
 First of all you need some disks. Let's assume you have three spare SCSI First of all you need some disks. Let's assume you have three spare SCSI
 disks: da0, da1, da2. disks: da0, da1, da2.
  
-Add a line to your /etc/rc.conf to start ZFS automatically on boot:+Add a line to your /etc/rc.conf to start [[ZFS]] automatically on boot:
  
-<code> 
 # echo 'zfs_enable="YES"' >> /etc/rc.conf # echo 'zfs_enable="YES"' >> /etc/rc.conf
-</code> 
  
 Now, setup one pool using RAIDZ: Now, setup one pool using RAIDZ:
  
-<code> 
 # zpool create tank raidz da0 da1 da2 # zpool create tank raidz da0 da1 da2
-</code> 
  
 It should automatically mount /tank/ for you. It should automatically mount /tank/ for you.
  
-Ok, now we want to put /usr/ on ZFS and use some nifty file systems layout.+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 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. directory and once we are ready, we will just change the mountpoint to /usr.
  
-<code> 
 # zfs create tank/usr # zfs create tank/usr
-</code> 
  
 Create ports/ file system and enable gzip compression on it, because Create ports/ file system and enable gzip compression on it, because
Line 32: Line 37:
 directory are already compressed: directory are already compressed:
  
-<code> +# zfs create tank/usr/ports\\  
-# zfs create tank/usr/ports +# zfs set compression=gzip tank/usr/ports\\  
-# zfs set compression=gzip tank/usr/ports +# zfs create tank/usr/ports/distfiles\\  
-# zfs create tank/usr/ports/distfiles +# zfs set compression=off tank/usr/ports/distfiles\\ 
-# zfs set compression=off tank/usr/ports/distfiles +
-</code>+
  
 (You do see how your life is changing, don't you?:%%))%% (You do see how your life is changing, don't you?:%%))%%
Line 45: Line 48:
 stuff, so I'll define that each block has to be stored in three copies: stuff, so I'll define that each block has to be stored in three copies:
  
-<code> +# zfs create tank/usr/home\\  
-# zfs create tank/usr/home +# zfs create tank/usr/home/pjd\\  
-# zfs create tank/usr/home/pjd +# zfs create tank/usr/home/pjd/important\\  
-# zfs create tank/usr/home/pjd/important +# zfs set copies=3 tank/usr/home/pjd/important\\ 
-# zfs set copies=3 tank/usr/home/pjd/important +
-</code>+
  
 I'd like to have directory with music, etc. that I NFS share. I don't I'd like to have directory with music, etc. that I NFS share. I don't
Line 57: Line 58:
 benchmark before doing it, because it's most likely not worth it!): benchmark before doing it, because it's most likely not worth it!):
  
-<code> +# zfs create tank/music\\  
-# zfs create tank/music +# zfs set checksum=off tank/music\\  
-# zfs set checksum=off tank/music +# zfs set sharenfs=on tank/music\\ 
-# zfs set sharenfs=on tank/music +
-</code>+
  
 Oh, I almost forget. Who cares about access time updates? Oh, I almost forget. Who cares about access time updates?
  
-<code> 
 # zfs set atime=off tank # zfs set atime=off tank
-</code> 
  
 Yes, we set it only on tank and it will be automatically inherited by Yes, we set it only on tank and it will be automatically inherited by
Line 74: Line 71:
 Would be also good to be informed if everything is fine with our pool: Would be also good to be informed if everything is fine with our pool:
  
-<code> 
 # echo 'daily_status_zfs_enable="YES"' >> /etc/periodic.conf # echo 'daily_status_zfs_enable="YES"' >> /etc/periodic.conf
-</code> 
  
 For some reason you still need UFS file system, for example you use ACLs 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, +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+why not just use [[ZFS]] to provide storage? This way we gain cheap UFS
 snapshots, UFS clones, etc. by simply using ZVOLs. snapshots, UFS clones, etc. by simply using ZVOLs.
  
-<code> +# zfs create -V 10g tank/ufs\\  
-# zfs create -V 10g tank/ufs +# newfs /dev/zvol/tank/ufs\\  
-# newfs /dev/zvol/tank/ufs +# mount /dev/zvol/tank/ufs /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\\ 
  
-# zfs snapshot tank/ufs@20070406 +Want to encrypt your swap and still use [[ZFS]]? Nothing more trivial:
-# mount -r /dev/zvol/tank/ufs@20070406 /ufs20070406+
  
-# zfs clone tank/ufs@20070406 tank/ufsok +:!: 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.
-# fsck_ffs -p /dev/zvol/tank/ufsok +
-# mount /dev/zvol/tank/ufsok /ufsok +
-</code>+
  
-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\\  
-<code> +# swapon /dev/zvol/tank/swap.eli\\ 
-# zfs create -V 4g tank/swap +
-# geli onetime -s 4096 /dev/zvol/tank/swap +
-# swapon /dev/zvol/tank/swap.eli +
-</code>+
  
 Trying to do something risky with your home? Snapshot it first! Trying to do something risky with your home? Snapshot it first!
  
-<code> 
 # zfs snapshot tank/home/pjd@justincase # zfs snapshot tank/home/pjd@justincase
-</code> 
  
 Turns out it was more stupid than risky? Rollback your snapshot! Turns out it was more stupid than risky? Rollback your snapshot!
  
-<code> +# zfs rollback tank/home/pjd@justincase\\  
-# zfs rollback tank/home/pjd@justincase +# zfs destroy tank/home/pjd@justincase\\ 
-# zfs destroy tank/home/pjd@justincase +
-</code>+
  
 Ok, everything works, we may set tank/usr as our real /usr: Ok, everything works, we may set tank/usr as our real /usr:
  
-<code> 
 # zfs set mountpoint=/usr tank/usr # zfs set mountpoint=/usr tank/usr
-</code> 
  
-Don't forget to read zfs(8) and zpool(8) manual pages and SUN's [http://www.opensolaris.org/os/community/zfs/docs/zfsadmin.pdf ZFS administration guide].+Don't forget to read zfs(8) and zpool(8) manual pages and SUN's [[https://web.archive.org/web/20090206093230/http://opensolaris.org:80/os/community/zfs/docs/zfsadmin.pdf|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 
 + 
 +---- 
 + 
 +{{tag>Stale}}
  
  • zfsquickstartguide.1177536717.txt.gz
  • Last modified: 2007/04/25 21:31
  • by PawelJakubDawidek