5

I use an Amazon S3 bucket to deliver some of my server's content. I was able to mount it successfully, and grant Apache rights over it, but can't get it mounted properly at reboot.

I updated my /etc/fstab with this line, but nothing happens when I boot

s3fs#my-bucket-name /mnt/s3_bucket fuse allow_other,umask=227,uid=33,gid=33,use_cache=/root/cache 0 0

So, I tried another way, commented said line, and just put my command line in /etc/init.d/local :

#!/usr/bin/env bash
s3fs -o allow_other,uid=33,gid=33,umask=227,use_cache=/root/cache my-bucket-name /mnt/s3_bucket

... didn't work either.

I ended up putting a cron, and now, it works, but it feels terribly hacky to me, and I wonder why mounting it at start doesn't work.

//Crontab
*/10 * * * * ~/mountBucket.sh 1>/dev/null

//Mount script
#!/usr/bin/env bash
if [[ -d /mnt/s3_bucket/someBucketVirtualDirectoryName ]] ; then echo 'Bucket already mounted' ; else s3fs -o allow_other,uid=33,gid=33,umask=227,use_cache=/root/cache my-bucket-name /mnt/s3_bucket ; fi 1>/dev/null

Is there something I missed ?
I'm Using Ubuntu 14.04.4 LTS, with Fuse 2.9.2


EDIT : Here is another unrelated, yet important performance issue I had to figure out by myself:

If your system includes locate and/or mlocate (and Ubuntu 14.04 does), you may want to add an exception, so that it does NOT scan your bucket. I had to modify both my /etc/updatedb.conf and /etc/cron.daily/locate, adding " /mnt/my-bucket-name" to PRUNEPATHS and " fuse.s3fs" to PRUNEFS I suppose adding fuse.s3fs should be enough, but... no time to take risks right now :)

Balmipour
  • 294
  • 1
  • 3
  • 10

2 Answers2

5

You want to add _netdev to your fstab:

s3fs#my-bucket-name /mnt/s3_bucket fuse _netdev,allow_other,umask=227,uid=33,gid=33,use_cache=/root/cache 0 0

khc
  • 306
  • 2
  • 2
  • Looks like it's as simple as this. Too bad this option was hardly ever mentioned, and nowhere explained in any of the tutorials or articles I found, while it seems absolutely necessary. Big thanks. – Balmipour Apr 05 '17 at 08:36
  • 2
    it's actually in s3fs's README https://github.com/s3fs-fuse/s3fs-fuse – khc Apr 05 '17 at 19:36
  • I noticed it _after_, but it's not explained on that page. There's one answer about it in the FAQ, which is quite clear, but I'm not used to Github enough to know pages include a FAQ. Half of the other blog/tutorial/forums pages I browsed didn't include the _netdev option when showing a fstab line, and for the other half, it's here among other stuff, but without explaination (while allow_other is often higlighted). Therefore, I had no idea of how important it could be. IMO, simple questions like this should be answered on SE anyway. Immediate google answers to basics helps going further – Balmipour Apr 06 '17 at 07:59
0

for me, using Amazon Linux 2 this worked:

s3fs#my.bucket.name  /mount/path fuse _netdev,allow_other,iam_role,url=http://s3.amazonaws.com 0 0

From: https://github.com/s3fs-fuse/s3fs-fuse/issues/1138

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 30 '21 at 18:14