VirtualFileSystem

Revision 5 as of 2008-12-02 13:28:16

Clear message

Zettabyte File System

Summary

Within ZFS, file system creation and manipulation within zpool storage is closer to that of making a new directory than it is to volume manipulation in a traditional file system sense. This wiki article will attempt to cover some of the finer points of creating, manipulating, and managing zfs virtual file systems within a zpool.

If you haven't already done so please read the wiki section on creating ZFS ZPools before continuing. The rest of the wiki article will assume that you have ZFS, via Fuse, installed and one or more ZPools created.

Creating File Systems Within a ZPool

Why create a virtual file system within a ZFS ZPool?

The purpose of creating virtual file systems on a zpool is to segment data or create administrative control points. Say you've created a ZPool but you want to encrypt part of the file system structure but not the rest of the ZPool. You want to put home directories in a ZPool but you want to have the ability to create individual block level snapshots of the users home directory or set quota's. Compress a section of a ZPool but not the rest. These are only a few reasons to create virtual file systems on a ZPool. Listed below are some of the options available to zfs file systems.

From the zfs man page

zfs create filesystem
zfs create [-s] [-b blocksize] -V size volume
zfs destroy [-rRf] filesystem|volume|snapshot
zfs clone snapshot filesystem|volume
zfs rename  filesystem|volume|snapshot filesystem|volume|snapshot
zfs snapshot  filesystem@name|volume@name
zfs rollback [-rRf] snapshot
zfs list [-rH] [-o property[,property]...] [ -t type[,type]...] 
        [filesystem|volume|snapshot] ...
zfs set property=value filesystem|volume...
zfs get [-rHp] [-o field[,field]...] [-s source[,source]...] all | 
        property[,property]... filesystem|volume|snapshot...
zfs inherit [-r] property filesystem|volume...
zfs mount
zfs mount [-o options] [-O] -a
zfs mount [-o options] [-O] filesystem
zfs unmount [-f] -a
zfs unmount [-f] [filesystem|mountpoint]
zfs share -a
zfs share filesystem
zfs unshare [-f] -a
zfs unshare [-f] [filesystem|mountpoint]
zfs backup [-i snapshot] snapshot
zfs restore [-vn ] filesystem|volume|snapshot
zfs restore [-vn ] -d filesystem

Creating ZFS file systems

So let setup a couple zfs file systems but lets first look at our ZPool(s).

zpool status

For this example the zpool will be called vol0 and look like:

root@ubuntu:~# zpool status
  pool: vol0
 state: ONLINE
 scrub: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        vol0        ONLINE       0     0     0
          raidz1    ONLINE       0     0     0
            sdb     ONLINE       0     0     0
            sdc     ONLINE       0     0     0
            sdd     ONLINE       0     0     0
            sde     ONLINE       0     0     0
        spares
          sdf       AVAIL   
          sdg       AVAIL   

errors: No known data errors

And the base file system layout looks like:

root@ubuntu:~# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             7.5G  1.3G  5.9G  18% /
tmpfs                 125M     0  125M   0% /lib/init/rw
varrun                125M   56K  125M   1% /var/run
varlock               125M     0  125M   0% /var/lock
udev                  125M  2.7M  122M   3% /dev
tmpfs                 125M     0  125M   0% /dev/shm
vol0                   30G   27K   30G   1% /vol0

ZFS Best Practices