Less Known Solaris features: SamFS - Part 6: Configuring disk archiving

Okay, we will use the simplest case of archiving. It´s disk archiving. In this configuration SamFS doesn´t use a tape drive for storing data, it simply uses filesystems, or to be more precise, it useses a directory in a filesystem to store it´s data.


Okay, i´ve created two iSCSI-base diskpool at the start to use them as disk archives. Now i will put some further seperation in them by creating directories in it.

# mkdir /samfs_archive_1/dir1<br />
# mkdir /samfs_archive_1/dir2<br />
# mkdir /samfs_archive_2/dir2<br />
# mkdir /samfs_archive_2/dir1

Configuring the archiver

So, we have to start to configure the archive medias. Every archive media has it´s VSN. VSN is a shorthand for Volume Serial Name. The VSN identifies a media of your archive. In this case we assign the VSN disk01 with the directory /samfs_archive_1/dir1/

disk01  /samfs_archive_1/dir1/<br />
disk02  /samfs_archive_1/dir2/<br />
disk03  /samfs_archive_2/dir1/<br />
disk04  /samfs_archive_2/dir2/

Now we have usable devices for archiving. But have to configure the archiving as the next step. In this step we define the policies for archiving, control the behaviour of he archiver and associate VSNs with archive sets. All this configuration takes place in the file /etc/opt/SUNWsamfs/archiver.cmd. Okay, lets create such a config file for our environment.

logfile = /var/opt/SUNWsamfs/archiver/log<br />
interval = 2m

Okay, this is easy: The archiver should log it´s work into the file /var/opt/SUNWsamfs/archiver/log. This file is really interesting. I will show you a nifty trick with it later in this tutorial. The interval directive was responsible for defining the interval between the starts of a process for finding new or updated files (sam-arfind). This behaviour didn´t scaled very well with millions of files in a directory. Today the default is different. The file system itself knows what files have been updated and SamFS stores this information in a list. Today this setting has a similar effect, but with other methods: It´s the default setting for the archive aging. It defines the amount of time between the first file added to the todo list for the archiver and the start of the archive. Thus the archiving would start two minutes after adding the first file to the list. Now we define the archiving policy for the filesystem:

fs = samfs1<br />
arset0 .<br />
      1 30s<br />
      2 1200s

What does this mean? arset0 is a name of a so called archive set. The contents of this set are defined later-on. The . stands for “every file in the filesystem”. Okay, now we tell SamFS to make a first copy to the archiveset arset0.1 after 30 seconds. The second copy is made to the archiveset arset0.1 after 1200 seconds (20 minutes). We have just used the name of some archive sets, now we have to declare them:

vsns<br />
arset0.1 dk disk01<br />
arset0.2 dk disk03<br />
samfs1.1 dk disk02<br />

Okay, The translation is quite simple: The archiveset arset0.1 consists is a disk based set and consists out of the VSN disk01. The same for the archive set arset0.2. But wait, we didn´t used an archiveset samfs1.1 so far. Well, you haven´t defined it explicitly. But it´s implicit when you have an archiver configuration for an filesystem. It´s the default archive set. You can use it for regular archiving, but as we haven´t defined a policy to do so, this archive set is used for storing the meta data of your filesystem. So the assoscation of a VSN to this archive set is mandatory. So we end up with the follwing archiver.cmd

logfile = /var/opt/SUNWsamfs/archiver/log<br />
interval = 2m
fs = samfs1<br />
arset0 .<br />
      1 30s<br />
      2 1200s
vsns<br />
arset0.1 dk disk01<br />
arset0.2 dk disk03<br />
samfs1.1 dk disk02<br />

Okay, we´ve finalized our configuration: Now we have to check the configuration:

<small>bash-3.00# archiver -lv<br />
Reading '/etc/opt/SUNWsamfs/archiver.cmd'.<br />
1: logfile = /var/opt/SUNWsamfs/archiver/log<br />
2: interval = 2m<br />
3:<br />
4: fs = samfs1<br />
5: arset0 .<br />
6:       1 30s<br />
7:       2 1200s<br />
8:<br />
9: vsns<br />
10: arset0.1 dk disk01<br />
11: arset0.2 dk disk03<br />
12: samfs1.1 dk disk02<br />
13: endvsns<br />
No media available for default assignment<br />
Notify file: /etc/opt/SUNWsamfs/scripts/archiver.sh<br />
Read timeout: 60<br />
Request timeout: 15m<br />
Stage timeout: 15m
Archive media:<br />
media:dk bufsize: 4 archmax:  512.0M Write timeout: 15m
Archive libraries:<br />
Device: disk archive_drives: 3<br />
  Dictionary:<br />
  dk.disk01               capacity:    2.0G space:    1.9G<br />
  dk.disk02               capacity:    2.0G space:    1.9G<br />
  dk.disk03               capacity:    2.0G space:    1.9G<br />
  dk.disk04               capacity:    0    space:    0    
Archive file selections:<br />
Filesystem samfs1  Examine: noscan  Interval: 2m<br />
  archivemeta: on  scanlistsquash: off  setarchdone: off<br />
  Logfile: /var/opt/SUNWsamfs/archiver/log<br />
samfs1   Metadata<br />
  copy: 1  arch_age: 4m<br />
arset0   path: .<br />
  copy: 1  arch_age: 30<br />
  copy: 2  arch_age: 20m
Archive sets:<br />
arset0.1<br />
  media: dk<br />
 Volumes:<br />
   disk01 (/samfs_archive_1/dir1/)<br />
 Total space available:    1.9G
arset0.2<br />
  media: dk<br />
 Volumes:<br />
   disk03 (/samfs_archive_2/dir1/)<br />
 Total space available:    1.9G
samfs1.1<br />
  media: dk<br />
 Volumes:<br />
   disk02 (/samfs_archive_1/dir2/)<br />
 Total space available:    1.9G<br />

Now we tell SamFS to reread it´s config-files

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

And now we have a running archiver. So … let´s have some fun with it. Copy some files in it. I tend do test it by makeing a recursive copy of the /var/sadm/pkg directory. Now let´s look onto our archival disks:

bash-3.00# ls -l /samfs_archive_1/dir1<br />
total 40734<br />
-rw-------   1 root     root          56 Mar 23 19:39 diskvols.seqnum<br />
-rw-------   1 root     root     19608576 Mar 23 17:43 f0<br />
-rw-------   1 root     root     1049088 Mar 23 19:39 f1<br />
bash-3.00# ls -l /samfs_archive_1/dir2<br />
total 13593<br />
-rw-------   1 root     root          56 Mar 23 19:42 diskvols.seqnum<br />
-rw-------   1 root     root     6891520 Mar 23 17:42 f0<br />
-rw-------   1 root     root        4608 Mar 23 19:42 f1<br />
bash-3.00# ls -l /samfs_archive_2/dir1<br />
total 40736<br />
-rw-------   1 root     root          56 Mar 23 19:58 diskvols.seqnum<br />
-rw-------   1 root     root     19608576 Mar 23 17:43 f0<br />
-rw-------   1 root     root     1049088 Mar 23 19:58 f1

You see, your archival media starts to populate. But where are your files, and what´s up with this f1. Well, they are written in a very specific, very secret and very closed format: These files are simple tar files. SamFS uses the standard tar format to write the archive file.You can look in it with the standard tar or the tar of SamFS:

bash-3.00# star tfv f1<br />
-rw------T root/root   1048576 2008-03-23 19:28 testfile3

Please notice, that this isn´t a version of Joerg Schillings star despite of the name.