Sunday, December 15, 2024
HomeSolarisSolaris system administrationZFS: Create a New Filesystem from an Existing Pool

ZFS: Create a New Filesystem from an Existing Pool

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


Filesystems with ZFS are fundamentally different from those using UFS. The analogous structure to a UFS filesystem (configured on a disk slice) is a ZFS pool which can occupy a slice of a disk, but it can also be used with a whole disk. Multiple ZFS filesystems can then be created within a single ZFS pool. This is possible because 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

Quinn McHenry
Quinn McHenry
Quinn was one of the original co-founders of Tech-Recipes. He is currently crafting iOS applications as a senior developer at Small Planet Digital in Brooklyn, New York.
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

LATEST REVIEWS

Recent Comments

error: Content is protected !!