UN1X


ZFS

Solaris NFS Server for Home use
This small example shows the power and ease of ZFS - the new
Solaris File system introduced with version 10.  I configured my
Home Server in a similar way for some Linux Clients.

The Hardware used is a old Compaq AP550 with 2x 1GHZ , 1.5 GB RAM, 2x
18GB U160 Disks and 2 160 GB IDE Disks for Data (ZFS).

1 Mirror with 2 disk

Both disk are identical formated - 3 slices one for system data (/opt)
and two for Home Dirs /home/xxx and other data. Creating a mirrored
Pool allocates the storage for File systems. Bore something can be
mounted under /home the automounter has to be disabled or configured
without /home.  Changes take effect after restarting the
automounter (see man svadm): 

svcadm restart svc:/system/filesystem/autofs:default
Creating a mirrored pool is just one line:

# zpool create datapool mirror c1d0p1 c2d1p1
c1d0p1 is mirrored by c2d1p1 - the storage is available in pool
datapool.

bash-3.00# zpool list

NAME                   
SIZE    USED   AVAIL   
CAP  HEALTH     ALTROOT

datapool              
74,5G    544K   74,5G    
0%  ONLINE     -

optpool               
5,81G   2,19G   3,62G    37% 
ONLINE     -

mpool                 
....



2 File System and export

zfs create datapool/home
zfs create datapool/home/user1
zfs set sharenfs=rw datapool/home
  1. allocate space for home
  2. for users
  3. export rw
bash-3.00# zfs get all datapool
NAME      PROPERTY       VALUE                  SOURCE
datapool  type           filesystem             -
datapool  creation       Sat Oct  7 15:27 2006  -
datapool  used           536K                   -
datapool  available      73,3G                  -
datapool  referenced     24,5K                  -
datapool  compressratio  1.00x                  -
datapool  mounted        no                     -
datapool  quota          none                   default
datapool  reservation    none                   default
datapool  recordsize     128K                   default
datapool  mountpoint     /home                  local
datapool  sharenfs       off                    default
datapool  checksum       on                     default
datapool  compression    off                    default
datapool  atime          on                     default
datapool  devices        on                     default
datapool  exec           on                     default
datapool  setuid         on                     default
datapool  readonly       off                    default
datapool  zoned          off                    default
datapool  snapdir        hidden                 default
datapool  aclmode        groupmask              default
datapool  aclinherit     secure                 default
datapool  canmount       on                     default

3 Users and Groups


Users and Groups identical to the Linux Boxes (uid / gid). No Nameservice used.

groupadd -g 500 user1
useradd -d /home/user1 -g user1 -s /bin/bash -u 500 user1

4 Mounting from Linux

mkdir -p /home/user1
mount -t nfs sun1:/home/user1 /home/user1

df -k
.....
/dev/mapper/VolGroup00-LogVol02
                       4031680    505788   3321092  14% /var
/dev/mapper/vg-vopt   38188544  26273040   9975640  73% /opt
/dev/hdi3             38471460   7998248  28518952  22% /space
sun1:/home/user1     76898304         0  76898304   0% /home/user1



Its also possible to automount the Home dirs at boot.

5 Features

With ZFS its possible to take snapshots from a filesystem , use several raidlevels, add additinal disks or replace a disk. No obscure syntax or complicated procdures as with traditional volume managers.
Metatdata is stored on the ZFS Volumes, so even a complete reinstall which does not touch the ZFS controlled storage is no problem.

With zpool import ZFS volumes are searched and listed. zpool import -f <pool> brings them right back.

Links