Wednesday, 24 April 2013

ZFS : Basic administration guide


ZFS is a combined file system and logical volume manager designed by Sun Microsystems. The features of ZFS include support for high storage capacities, integration of the concepts of filesystem and volume management, snapshots and copy-on-write clones, continuous integrity checking and automatic repair, RAID-Z and native NFSv4 ACLs. 
Watch this video about ZFS overview and demo. A good one..



This ZFS guide provides an overview of ZFS and its administration commands that will be helpful for beginners.

ZFS Pool: 

ZFS organizes physical devices into logical pools called storage pools. Both individual disks and array logical unit numbers (LUNs) that are visible to the operating system can be included in a ZFS pools. These pools can be created as disks striped together with no redundancy (RAID 0), mirrored disks (RAID 1), striped mirror sets (RAID 1 + 0), or striped with parity (RAID Z). Additional disks can be added to pools at any time but they must be added with the same RAID level.

ZFS Filesystem : 

ZFS offers a POSIX-compliant file system interface to the Solaris/OpenSolaris operating system. ZFS file systems must be built in one and only one storage pool, but a storage pool may have more than one defined file system. ZFS file systems are managed & mounted through /etc/vfstab file. The common way to mount a ZFS file system is to simply define it against a pool. All defined ZFS file systems automatically mount at boot time unless otherwise configured.

Here are the basic commands for getting started with ZFS.

Creating Storage pool using "zpool create" :

bash-3.00# zpool create demovol raidz c2t1d0 c2t2d0
bash-3.00# zpool status
  pool: demovol
state: ONLINE
scrub: none requested
config:

        NAME         STATE     READ WRITE CKSUM
        demovol      ONLINE       0     0     0
          raidz1     ONLINE       0     0     0
            c2t1d0   ONLINE       0     0     0
            c2t2d0   ONLINE       0     0     0

errors: No known data errors
bash-3.00#

"zfs list" will give the details of the pool and other zfs filesytems.

bash-3.00# zfs list
NAME                   USED  AVAIL  REFER  MOUNTPOINT
demovol               1.00G  900G  38.1K  /demovol
bash-3.00#

Creating File Systems : "zfs create" is used to create zfs filesytem.

bash-3.00# zfs create demovol/testing
bash-3.00# zfs list
NAME                   USED  AVAIL  REFER  MOUNTPOINT
demovol               1.00G  900G  38.1K  /demovol
demovol/testing       32.6K  900G  32.6K  /demovol/testing
bash-3.00#

bash-3.00# ls /dev/zvol/dsk/demovol -- This should show you the disk file.

Setting Quota for the filesytem : Until Quota is set, the filesytem shows the total available space of the containter zfs pool.

bash-3.00# zfs set quota=10G emspool3/testing
bash-3.00# zfs list
NAME                     USED  AVAIL  REFER  MOUNTPOINT
demovol                 1.00G  900G   39.9K  /demovol
demovol/testing         32.6K  10.0G  32.6K  /demovol/testing

Creating a snapshot : 

bash-3.00# zfs snapshot demovol/testing@snap21
bash-3.00# zfs list
NAME                     USED  AVAIL  REFER  MOUNTPOINT
demovol                 1.00G  900G   39.9K  /demovol
demovol/testing         32.6K  10.0G  32.6K  /demovol/testing
demovol/testing@snap21      0      -  32.6K  -
bash-3.00#

Get all properties of a ZFS filesytem :

bash-3.00# zfs get all demovol/testing
NAME             PROPERTY         VALUE                  SOURCE
demovol/testing  type             filesystem             -
demovol/testing  creation         Mon Feb  9  9:05 2009  -
demovol/testing  used             32.6K                  -
demovol/testing  available        10.0G                  -
demovol/testing  referenced       32.6K                  -
demovol/testing  compressratio    1.00x                  -
demovol/testing  mounted          yes                    -
demovol/testing  quota            10G                    local
demovol/testing  reservation      none                   default
demovol/testing  recordsize       128K                   default
demovol/testing  mountpoint       /demovol/testing       default

Cloning a ZFS filesystem from a snapshot : 

bash-3.00# zfs clone demovol/testing@snap21 demovol/clone22
bash-3.00# zfs list
NAME                     USED  AVAIL  REFER  MOUNTPOINT
demovol                 1.00G  900G   39.9K  /demovol
demovol/clone22             0  900G   32.6K  /demovol/clone22
demovol/testing         32.6K  10.0G  32.6K  /demovol/testing
demovol/testing@snap21      0      -  32.6K  -
bash-3.00#

Performance IO Monitoring the ZFS storage pool: 

bash-3.00# zpool  iostat 1
               capacity     operations    bandwidth
pool         used  avail   read  write   read  write
----------  -----  -----  -----  -----  -----  -----
demovol     4.95M  900G      0      0      0     35
demovol     4.95M  900G      0      0      0      0
demovol     4.95M  900G      0      0      0      0
demovol     4.95M  900G      0      0      0      0

Please refer to the man pages, zfs and zpool, for more detailed information. Additional documentation may be found at docs.sun.com and OpenSolaris ZFS Community. 

0 blogger-disqus:

Post a comment