Less Known Solaris features: SamFS - Part 5: Configuring a SamFS filesystem

Okay, now we can configure our first filesystem with SamFS.

Prerequisites

Before we can configure SamFS, i want to describe the prerequisites for this task: We need some harddisks for this task. I made my example a little bit more complex, thus i used iSCSI volumes for this task. I created for this tutorial:

I assume that you already know the tasks to creating them from the iSCSI tutorial. The first and the second volume will be used by SamFS directly. You have to use the format command to put a label and a partition table on it. For the both archive volumes, we will use ZFS. Thus i´ve created a zpool for both:

# zpool create samfs_archive_1 c1t0100001C42E9F21A00002A0047E54035d0<br />
# zpool create samfs_archive_2 c1t0100001C42E9F21A00002A0047E54036d0

The configuration itself

Okay, let´s start to create a filesystem. We have to tell SamFS the structure of our filesystem. This is done in the file </code>/etc/opt/SUNWsamfs/mcf</code>.

samfs1             10    ma   samfs1  -<br />
/dev/dsk/c1t0100001C42E9F21A00002A0047E6642Bd0s0  11    mm   samfs1  -<br />
/dev/dsk/c1t0100001C42E9F21A00002A0047E54033d0s0  12    md   samfs1  -

Okay, let´s dissect this file. At first i want to explain the general meaning of the columns.

Okay, what did we describe with our mcf file: We defined an filesystem with the name samfs1. The name of the family set is samfs1 as well. The filesystem is of the type “SamFS disk cache with dedicated metadevices. In the next row we´ve defined that the device /dev/dsk/c1t0100001C42E9F21A00002A0047E6642Bd0s0 is a device solely for metadata. We gave it the ordinal number 11 and it´s part of the samfs1 family, thus a part of the filesystem defined before. The third line configures the /dev/dsk/c1t0100001C42E9F21A00002A0047E54033d0s0 as the data disk for this filesystem (as the family name is samfs1 as well. Yes, you have read it correctly. SamFS is capable to seperating the metadata and the data of the files on different disks. The idea behind this concept is to use fast disks for the metadata (eg. solid state disks) with short access times and slower disks for the data. By this seperation the filesystem has doesn´t have to step between the position of the metadata and the position of the data when it´s updata. The effect: Much better scaling when you use a large amount of disks. Okay, now we have fully configured the filesystem. Now we modify the /etc/vfstab to enable simpler mounting/auto mounting at start. The device name is the name of the filesystem, in your case samfs1. It don´t sset a raw device. The mountpoint is /samfs1, the type samfs and we want to mount it at the start. The options are SamFS specific. They mean: Start to release files (thus freeing space in the cache) when the cache is 80 percent full. Release until the cache is filled only 60 percent.

samfs1     -        /samfs1 samfs  -    yes      high=80,low=60

Okay, we have to tell SamFS that ere is a new configuration:

bash-3.00# samd config<br />
Configuring SAM-FS<br />
bash-3.00# 

Looks good. Now we are able to format the filesystem:

# sammkfs samfs1<br />
Building 'samfs1' will destroy the contents of devices:<br />
                /dev/dsk/c1t0100001C42E9F21A00002A0047E6642Bd0s0<br />
                /dev/dsk/c1t0100001C42E9F21A00002A0047E54033d0s0<br />
Do you wish to continue? [y/N]y<br />
total data kilobytes       = 520192<br />
total data kilobytes free  = 520128<br />
total meta kilobytes       = 61440<br />
total meta kilobytes free  = 61024

Let´s try to mount it.

# mkdir /samfs1<br />
# mount /samfs1<br />
# cd /samfs1

You should see the obligatory lost+found now. But let´s do an deeper check of the filesystem:

bash-3.00# samfsinfo samfs1<br />
samfsinfo: filesystem samfs1 is mounted.<br />
name:     samfs1       version:     2<br />
time:     Sun Mar 23 15:46:40 CET 2008<br />
count:    2<br />
capacity:      000000000007f000          DAU:         64<br />
space:         0000000000070c40<br />
meta capacity: 000000000000f000          meta DAU:    16<br />
meta space:    000000000000aa80<br />
ord  eq           capacity              space   device<br />
  0  11   000000000000f000   000000000000aa80   /dev/dsk/c1t0100001C42E9F21A00002A0047E6642Bd0s0<br />
  1  12   000000000007f000   000000000007efc0   /dev/dsk/c1t0100001C42E9F21A00002A0047E54033d0s0

Et voila, your first SamFS filesystem.