On 05/14/2010 02:02, Denis Shaposhnikov wrote:

> Does anybody has working examples of using s3fs or s3cmd with bacula for
> using Amazon S3 as bacula storage?
> 
> I've tried s3fs but it seems bacula 5.0.0 doesn't want to use s3 bucket
> mounted into a directory because it doesn't have "." and ".." entries.

Hmm... No answers. OK, I've ended with mounting S3 bucket on system boot
like

  echo "/usr/local/sbin/s3fs -o use_cache=/home/bacula/s3fs-tmp bucket
/var/db/bacula/s3fs" | su -m bacula

Don't forget "use_cache". I've found bacula can't label new volumes
without it. It's trying to label it forever without any luck. Also I've
added

  Run After Job = "/usr/bin/find /home/bacula/s3fs-tmp -type f -exec
/bin/rm -f {} +"
  Run After Failed Job = "/usr/bin/find /home/bacula/s3fs-tmp -type f
-exec /bin/rm -f {} +"

into my JobDefs. Because I don't want keep volumes on local file system.
That's why I use S3. Ideally would be removing cached volume just after
bacula close it, but I don't know how to implement it.

And last, I've patched s3fs using a little modified diff from

  http://code.google.com/p/s3fs/wiki/FuseOverAmazon

  Comment by estabroo,  May 10 (4 days ago)

I'm attaching that diff into this mail.
--- s3fs.cpp.orig       2010-02-05 03:45:59.000000000 +0300
+++ s3fs.cpp    2010-05-14 20:51:44.000000000 +0400
@@ -345,7 +345,7 @@
 static string AWSAccessKeyId;
 static string AWSSecretAccessKey;
 static string host = "http://s3.amazonaws.com";;
-static mode_t root_mode = 0;
+static struct stat root_stat;
 static string service_path = "/";
 
 // if .size()==0 then local file cache is disabled
@@ -807,8 +807,7 @@
        cout << "getattr[path=" << path << "]" << endl;
        memset(stbuf, 0, sizeof(struct stat));
        if (strcmp(path, "/") == 0) {
-               stbuf->st_nlink = 1; // see fuse faq
-               stbuf->st_mode = root_mode | S_IFDIR;
+               *stbuf = root_stat;
                return 0;
        }
 
@@ -1278,6 +1277,10 @@
 s3fs_readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t 
offset, struct fuse_file_info *fi) {
        //cout << "readdir:"<< " path="<< path << endl;
 
+       // add .. and .
+       filler(buf, ".", NULL, 0);
+       filler(buf, "..", NULL, 0);
+
        string NextMarker;
        string IsTruncated("true");
 
@@ -1593,7 +1596,7 @@
                        struct stat buf;
                        // its the mountpoint... what is its mode?
                        if (stat(arg, &buf) != -1) {
-                               root_mode = buf.st_mode;
+                               root_stat = buf;
                        }
                }
        }
------------------------------------------------------------------------------

_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to