On top of a storage pool sits a file system that uses the ZFS file format. It is possible to dynamically create and destroy file systems without being required to allocate or format any underlying space. This allows for greater flexibility. For example, you will likely build many file systems when using ZFS because file systems are very lightweight and also the primary point of administration in ZFS.
1. To Create A Simple Zpool
- # zpool create szpool c1t3d0
- # zpool list szpool
- NAME SIZE ALLOC FREE CAP HEALTH ALTROOT
- szpool 89M 97K 88.9M 0% ONLINE –
2. To Create A Raidz Zpool
- # zpool create rzpool raidz c1t2d0 c1t1d0 c1t8d0
- # zpool list rzpool
- NAME SIZE ALLOC FREE CAP HEALTH ALTROOT
- rzpool 266M 176K 266M 0% ONLINE –
3. To Create A Mirror Zpool
- # zpool create mzpool mirror c1t5d0 c1t6d0
- # zpool list mzpool
- NAME SIZE ALLOC FREE CAP HEALTH ALTROOT
- mzpool 89M 97K 88.9M 0% ONLINE –
4. To Share Dataset Through NFS
- bash-3.00# zfs get sharenfs szpool/vol1
- NAME PROPERTY VALUE SOURCE
- szpool/vol1 sharenfs off default
- bash-3.00# zfs set sharenfs=on szpool/vol1
- bash-3.00# zfs get sharenfs szpool/vol1
- NAME PROPERTY VALUE SOURCE
- szpool/vol1 sharenfs on local
5. To Manually Set The Mount Point
If you wish to specify the mount point for a zfs dataset, use the command below.
- bash-3.00# zfs set mountpoint=/ora_vol1 szpool/vol1
- bash-3.00# zfs list |grep szpool
- szpool 115K 56.9M 22K /szpool
- szpool/vol1 21K 56.9M 21K /ora_vol1
- bash-3.00# df -h /ora_vol1
- Filesystem size used avail capacity Mounted on
- szpool/vol1 57M 21K 57M 1% /ora_vol1
6. To Compress The Dataset
Utilizing the zfs set command will allow you to activate it.
- bash-3.00# zfs get compression szpool/vol1
- NAME PROPERTY VALUE SOURCE
- szpool/vol1 compression off default
- bash-3.00# zfs set compression=on szpool/vol1
- bash-3.00# zfs get compression szpool/vol1
- NAME PROPERTY VALUE SOURCE
- szpool/vol1 compression on local
7. Setting Reservation To A Dataset
- bash-3.00# zfs set reservation=20M szpool/vol1/oraarch
- bash-3.00# zfs get reservation szpool/vol1/oraarch
- NAME PROPERTY VALUE SOURCE
- szpool/vol1/oraarch reservation 20M local
- bash-3.00# zfs list |grep ora
- szpool/vol1 20.0M 36.9M 23K /ora_vol1
- szpool/vol1/oraarch 21K 56.9M 21K /ora_vol1/oraarch
8. To Build Dataset Under Dataset
- bash-3.00# zfs create szpool/vol1/oraarch
- bash-3.00# zfs list |grep ora
- szpool/vol1 42K 56.9M 21K /ora_vol1
- szpool/vol1/oraarch 21K 56.9M 21K /ora_vol1/oraarch
9. To Delete A Dataset
# zfs destroy datapool/home/tabriz
10. To Rename The Dataset
# zfs rename datapool/home/kustarz datapool/home/kustarz_old