ZFS: Create a new filesystem from an existing pool

Contributor Icon Contributed by qmchenry Date Icon June 3, 2006  
Tag Icon Tagged: Solaris system administration

A previous recipe showed the command to create a ZFS pool using zpool. While this created a mounted filesystem, the fun doesn’t stop there. The pool can be used in additional ways. This recipe shows how to create more filesystems out of an existing pool.


Filesystems with ZFS are fundamentally different than those using UFS. The analagous structure to a UFS filesystem (configured on a disk slice) is a ZFS pool which can occupy a slice of a disk, but can also be used with a whole disk. Multiple ZFS filesystems can then be created within a single ZFS pool. Why? Attributes such as encryption, quotas, and space reservations can be set on individual filesystems or filesystem trees in a ZFS pool providing flexibility impossible with UFS.

Given the pool techrx (mounted at /techrx), a new filesystem ‘logs’ can be created using the command :

zfs create techrx/logs

At this point, there is now a new filesystem mounted at /techrx/logs which we can see with a df -h command:

# df -h /techrx/logs
Filesystem size used avail capacity Mounted on
techrx/logs 19G 24K 19G 1% /techrx/logs

Additional filesystems can be created under the new logs filesystem:

zfs create techrx/logs/httpd
zfs create techrx/logs/mail

These newly created filesystems share the same space as techrx/logs as seen in this df output:

# df -h /techrx/logs/*
Filesystem size used avail capacity Mounted on
techrx/logs/httpd 19G 24K 19G 1% /techrx/logs/httpd
techrx/logs/mail 19G 24K 19G 1% /techrx/logs/mail
techrx/logs 19G 24K 19G 1% /techrx/logs

Previous recipe | Next recipe |
 
  • sethunath
    How to create a specific size file system, rather than a default size one in ZFS
blog comments powered by Disqus