Category: ZFS

  • ZFS Quick Start

    Images
    ZFS is a filesystem, designed by Sun, and implemented in Solaris 10.
    Unlike traditional filesystems, which reside on single disk devices and
    thus require a volume manager to use more than one device, ZFS
    filesystems are built on top of virtual storage pools called zpools, which elimiate the need to create individuall volumes.
    When creating a filesystem, you do not need to specify a size, as filesystems will grow automatically withing the zpool . When new storage is added, all file systems within the pool can immediately
    use the additional space without additional work. Most importantly ZFS is simple and pretty easy to administer. See my simple notes below which outline how to get started.


    1. First create your pool. I called mine database_pool

    -bash-3.00# zpool create database_pool c1t14d0s6 c1t13d0s6 c1t12d0s6

    2. Now admire your new pool. Yours may differ in size 🙂

    -bash-3.00# zpool list

    NAME                    SIZE    USED   AVAIL    CAP  HEALTH     ALTROOT


    database_pool          50.2G   60.5K   50.2G     0%  ONLINE     –

    3. Create your volumes. In this example I create two similar to what we will be doing in Philly.
    -bash-3.00# zfs create database_pool/apdru
    -bash-3.00# zfs create database_pool/apdi2

    4. Take a look at your new mounts
    -bash-3.00# df -k

    Filesystem            kbytes    used   avail capacity  Mounted on


    database_pool        51867648      25 51867511     1%    /database_pool


    database_pool/db1  51867648      24 51867511     1%    /database_pool/db1


    database_pool/db2 51867648      24 51867511     1%    /database_pool/db2

    5. Make the directory structure for your new volumes if the above path is not where you want them mounted.
    -bash-3.00# mkdir -p /db1/v1

    -bash-3.00# mkdir -p /db2/v1

    6. Mount your new volumes where you want them to go using zfs set. Note there is no leading / on the pool name


    -bash-3.00# zfs set mountpoint=
    /db1/v1 database_pool/db1
    -bash-3.00# zfs set mountpoint=
    /db2/v1/apdru database_pool/db2

    7. Admire your work. You do not have to create a filesystem, its
    already there and each mount point/volume will grow as needed up to the
    total capacity of the pool. So no need to worry about sizing each
    volume for each database.

    bash-3.00# df -k

    Filesystem            kbytes    used   avail capacity  Mounted on


    database_pool        51867648      25 51867498     1%    /database_pool


    database_pool/apdi2  51867648      24 51867498     1%    /db1/v1


    database_pool/apdru  51867648      24 51867498     1%    /db2/v1