On Thu, Oct 30, 2008 at 12:13 PM, Sergio Arroutbi <[EMAIL PROTECTED]>wrote:

> My point is that I want to use the same directory in the recorder program.
>
> I get the streaming, and start writing the file in /mnt/streamingDirectory
>
> So I would like to record in the same way, just configuring (via zfs if
> possible), that one file should go to /dev/sda and the other file to the
> /dev/sdb disk (I am using this in Linux via fuse).
>
>
This is interesting to me!  What fuse file system allows you to spread a
single directory (file system) across two disks in a non-redundant manner
but not loose access to the file system if one of the disks fail?

My suggestion:
Create two ZFS pools, and mount them on different directories, for example
/mnt/storage_a
/mnt/storage_b

Then write a script which will do the following:
Start up periodically.
If new files exist in /mnt/streamingDirectory, copy them alternatingly (is
that a word) to /mnt/storage_a and /mnt/storage_b

Something like:
#!/bin/ksh
# use mkdir as a lock/test since the kernel will give us automatic
semaphore, thus we can have mutual-exclusion
mkdir /tmp/task_is_running || exit
# continue where we left off
NEXT_TARGET="$(cat -s /etc/last_target)"
find /mnt/streamingDirectory -type f | while read FILENAME
do
  [ "$NEXT_TARGET" = "/mnt/storage_a/" ] && NEXT_TARGET=/mnt/storage_b/ ||
NEXT_TARGET=/mnt/storage_a/
  cp $FILENAME ${NEXT_TARGET}/ || exit 1
  rm $FILENAME
done
echo $NEXT_TARGET > /etc/last_target
# On exit without errors, remove the lock.
rmdir /tmp/task_is_running

Sorry I did not test this, it is off the cuff, typoes may exist.  Or logic
errors.  Also note the "find ... | read" will not port well to other shells.

  _hartz

-- 
Any sufficiently advanced technology is indistinguishable from magic.
   Arthur C. Clarke

My blog: http://initialprogramload.blogspot.com
_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to