Friday, August 22, 2008

Simple start with ZFS

Here is very simple steps to start with zfs


1. Create ZFS filesystem wih single disk.

bash-3.00# zpool create tank c0t9d0s0
invalid vdev specification
use '-f' to override the following errors:
/dev/dsk/c0t9d0s0 contains a ufs filesystem.
/dev/dsk/c0t9d0s0 overlaps with /dev/dsk/c0t9d0s3

If you face above error just add -f option as following.

bash-3.00# zpool create -f tank c0t9d0s0

2. How see zfs details?

Following command shows details of pool fs we just created.

bash-3.00# zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
tank 16.9G 83.5K 16.9G 0% ONLINE

3. Now we need to create partitions in it. Let's create 5 Gb parttion.

bash-3.00# zfs set quota=5G tank/vol1
bash-3.00# zfs list
NAME USED AVAIL REFER MOUNTPOINT
tank 104K 16.6G 25.5K /tank
tank/vol1 24.5K 5.00G 24.5K /tank/vol1

4. How can extend it ?

Very simple. See fire following command.

bash-3.00# zfs set quota=10G tank/vol1

5. Again do zfs list see what is happended.

bash-3.00# zfs list
NAME USED AVAIL REFER MOUNTPOINT
tank 104K 16.6G 25.5K /tank
tank/vol1 24.5K 10.0G 24.5K /tank/vol1


bash-3.00# df -h
Filesystem size used avail capacity Mounted on

tank 17G 25K 17G 1% /tank
tank/vol1 13G 24K 13G 1% /tank/vol1

bash-3.00#

6. How to see statistics ?

bash-3.00# zpool iostat tank

capacity operations bandwidth
pool used avail read write read write
---------- ----- ----- ----- ----- ----- -----
tank 108K 16.9G 0 0 0 10

7. How to mount zfs partition at your desired mountpoint?

#
# zfs set mountpoint=/export/zfs tank/vol1

Effect will be shown as following if df -h command

tank/vol1 10G 24K 10G 1% /export/zfs


8. Finding zfs status


bash-3.00# zpool status
pool: tank
state: ONLINE
scrub: none requested
config:

NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
c0t9d0s0 ONLINE 0 0 0

errors: No known data errors

=====================================================================================

For further study visit here:

1. http://www.solarisinternals.com/wiki/index.php/ZFS_Best_Practices_Guide
2. http://docs.sun.com/app/docs/doc/819-5461

No comments: