In association with heise online

Moving day

We could now simply share all the home directories in one go:

zfs set sharesmb=on rpool/export/home

However, this doesn't make much sense on our self-built NAS: The rpool storage pool containing the system files and the home directories in various file systems was created on the 4-GByte SSD during installation – not much room for storage left there.

The content of a ZFS file system can easily be transferred to a different storage pool. We first need to take a snapshot to determine the current state of the file system to be transferred:

zfs snapshot -r rpool/export/home@transfer

The snapshot can be placed in another file system which is created at the same time:

zfs send rpool/export/home@transfer | zfs receive daten/home

In this case, the zfs tool's send command generates an image of the "transfer" snapshot of the rpool/export/home file system, which is written to the standard output (and can be diverted and saved in a file). "zfs receive" accepts the image and uses it to create the new daten/public/home file system.

The same needs to be done for the home directory of the primary user account created during installation. The primary user account receives a dedicated file system for its home directory in OpenSolaris 2008/11. The -r option we added when taking the snapshot of rpool/export/home has already made sure this snapshot exists:

zfs send rpool/export/home/test@transfer | zfs receive daten/public/home/test

To replace the old home directory with the new one, the old one first needs to be unmounted; no applications that keep any files open should be running during this process:

zfs umount -f rpool/export/home/test
zfs umount -f rpool/export/home

Now we set the correct mount points for the newly created directories using

zfs set mountpoint=/export/home daten/public/home
zfs set mountpoint=/export/home/test daten/public/home/test

and delete the old home directory by entering

zfs destroy -r rpool/export/home

Automatic sharing

The CIFS/SMB server of OpenSolaris supports a useful feature called "autohome": Creating a file called smbautohome in /etc which would contain

* /export/home/&

This allows users to access their respective home directories via SMB after logging in – until they log out again. This way, the home directories on the server are only accessible when they're actually needed. The disadvantage: They don't show up in the network environment.

A more convenient solution is to simply use

zfs set sharesmb=name=Home daten/home

for sharing the complete file system including all the home directories. The default access privileges in OpenSolaris allow users to read any home directory, but not to write into them. To hide the content of the home directories from other users, the

chmod go-r /export/home/*

command withdraws the read privileges for all users except the owner of the respective directory.

Quotas can be set to prevent individual users from claiming all the storage available within a storage pool:

zfs set quota=600GB daten/home zfs set quota=600GB daten/public

This command makes sure that neither of the RAID array's two file systems can claim more than 600 GBytes.

The reward for our efforts

A few more tips about what else is possible with OpenSolaris and ZFS before we close. Regular snapshots ensure that files that were accidentally deleted or overwritten can easily be restored. A snapshot can be created in a fraction of a second and requires next to no resources: It only starts to fill when files are edited or deleted. The

zfs list -t snapshot

command lists the existing snapshots; use

zfs rollback daten@snapshot

to revert the file system to the state it was in when the snapshot was taken. A more elegant way is to use the

zfs set snapdir=visible daten

command to make the snapshots and all the files they contain accessible via the /daten/.zfs subdirectory. OpenSolaris 2008/11 comes with a service for automatically taking snapshots on a regular basis. It can be activated via the "Time Slider Setup" tool.

OpenSolaris can regularly generate snapshots if required
Zoom OpenSolaris can regularly generate snapshots if required

As already mentioned, scrubbing can be used to check the health of the system's hardware at regular intervals.

Those who run Linux and Unix clients in their LANs may wish to add an NFS server; this can simply be done by entering

zfs set sharenfs=on daten

  • Twitter
  • Facebook
  • submit to slashdot
  • StumbleUpon
  • submit to reddit


  • May's Community Calendar






The H Open

The H Security

The H Developer

The H Internet Toolkit