MediaWiki:Welcome to the Howto page/FreeBSD/ZFS

From wiki
Jump to: navigation, search

Introduction


Creating a ZFS pool


Start by enabling ZFS in /etc/rc.conf:

zfs_enable="YES"


Create a mount point for the ZFS pool:

mkdir /zfs


Create the pool itself:

Test-BSD# ls /dev
acd0		consolectl	io		random		ttyv5
acd0t01		ctty		iso9660		stderr		ttyv6
acpi		cuau0		kbd0		stdin		ttyv7
ad0		cuau0.init	kbd1		stdout		ttyv8
ad0s1		cuau0.lock	kbdmux0		sysmouse	ttyv9
ad0s1a		cuau1		klog		ttyu0		ttyva
ad0s1b		cuau1.init	kmem		ttyu0.init	ttyvb
ad1		cuau1.lock	log		ttyu0.lock	ttyvc
ad3		dcons		mdctl		ttyu1		ttyvd
ata		devctl		mem		ttyu1.init	ttyve
atkbd0		devstat		nfslock		ttyu1.lock	ttyvf
audit		dgdb		null		ttyv0		ufsid
bpf		fd		pci		ttyv1		urandom
bpf0		fd0		psm0		ttyv2		usbctl
bpsm0		fido		ptmx		ttyv3		xpt0
console		geom.ctl	pts		ttyv4		zero
Test-BSD# zpool create ZPOOL_1 ad1 ad3


Check the pool has been created and that it is working:

Test-BSD# zpool list
NAME      SIZE   USED  AVAIL    CAP  HEALTH  ALTROOT
ZPOOL_1  99.5G    75K  99.5G     0%  ONLINE  -


Create the mountpoint, disable compression, and mount the pool:

Test-BSD# zfs set mountpoint=/zfs ZPOOL_1
Test-BSD# zfs set compression=off ZPOOL_1
Test-BSD# zfs mount
ZPOOL_1                         /zfs


Check the ZFS pool has been mounted and also let's have a look at the ZPOOL status:

Test-BSD# zfs list
NAME      USED  AVAIL  REFER  MOUNTPOINT
ZPOOL_1    81K  97.9G    18K  /zfs

Test-BSD# zpool status
  pool: ZPOOL_1
 state: ONLINE
 scrub: none requested
config:

	NAME        STATE     READ WRITE CKSUM
	ZPOOL_1     ONLINE       0     0     0
	  ad1       ONLINE       0     0     0
	  ad3       ONLINE       0     0     0

errors: No known data errors


Check the system mount points:

Test-BSD# df -h
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/ad0s1a     36G    1.0G     32G     3%    /
devfs          1.0K    1.0K      0B   100%    /dev
ZPOOL_1         98G      0B     98G     0%    /zfs