Fuse is a program to mount ‘foreign’ filesystems to your computer. This is how I got an Amazon S3 (simple storage service) bucket mounted on my Ubuntu server as if it were a local folder:
Install the necessary libraries:
sudo aptitude install build-essential libcurl4-openssl-dev libxml2-dev libfuse-dev comerr-dev libfuse2 libidn11-dev libkadm55 libkrb5-dev libldap2-dev libselinux1-dev libsepol1-dev pkg-config fuse-utils sshfs
We also installed the sshfs (SSH File System) in order to test out FUSE. Go ahead and create a mount folder and mount a remote drive to it:
sudo mkdir -p /mnt/sshfs
sudo chown user:fuse /mnt/sshfs
sudo sshfs user@hostname:/path/on/remote/server /mnt/sshfs
You should now be able to browse files on /path/on/remote/server, locally from /mnt/sshfs. Please note that you will need to set the ownership of the mount before you’ll be able to use it. The fuse group was created automatically and is a good place to start.
To unmount the drive:
fusermount -u /mnt/sshfs
Download the s3fs source (Revision 177 as of this writing) from the Google Code project:
wget http://s3fs.googlecode.com/files/s3fs-r177-source.tar.gz
Untar and install the s3fs binary:
tar xzvf s3fs-r177-source.tar.gz
cd ./s3fs
sudo make
sudo make install
In order to use the allow_other option (see below) you will need to modify the fuse configuration:
sudo vi /etc/fuse.conf
And uncomment the following line in the conf file:
...
#user_allow_other
Now you can mount an S3 bucket like this:
sudo mkdir -p /mnt/s3
s3fs bucketname -o accessKeyId=XXX -o secretAccessKey=YYY -o use_cache=/tmp -o allow_other /mnt/s3
You will need to replace the XXX above with your real Amazon Access Key and YYY with your real Secret Key. I’ve also told it to cache the bucket’s files locally (in /tmp) and to Allow other users to be able to manipulate files in the mount. Check the wiki documentation for more options available to s3fs, including how to save your Access Key and Secret Key in /etc/passwd-s3fs.
Now any files written to /mnt/s3 will be replicated to your Amazon S3 bucket.
Thank you, Eric. I will be experimenting with this shortly.
Hello Eric, and thank you for your instructions.
I am having problems with both sshfs and s3fs and would like to know if you’ve encountered similar problems.
Everyting is fine and dandy until I attempt to mount something using FUSE, which is when I get an error message:
# sshfs user@server:/path/ /tmp/fuse/
fuse: device not found, try ‘modprobe fuse’ first
Running “modprobe fuse” does nothing whatsoever, no error messages, no output at all.
Ideas?
Did you try
sudo modprobe fuse?Thank, yes, I was root.
mans,
I was running into this problem on Ubuntu 9.04 EC2 instance, apparently there is a defect of sorts wrt fuse module. Only solution I found was upgrading to 9.10, where the problem disappears.
I’ve used fuse+s3fs successfully on 9.04, but this was a Slicehost image. Thanks for the heads up.
What’s interesting is that with the 9.04 ec2 image I had the same problem but with local 9.04 installs and internal servers it works fine. I’m assuming it’s a problem with the ec2 9.04 ami. Something to look into.
Also, you may want to try mounting it in your /mnt folder, which is intended for such things: http://www.linfo.org/mnt.html
Thank you,
unfortunately there was no difference.
Did you create an empty folder in the spot you want to mount first, and chown it to fuse:fuse before trying to mount it?
Nifty trick, thanks for sharing it!
It works amazingly well.
That it does. However you don’t need to mount and unmount using sudo.
Yeah, probably not. I just realized I’ve been overusing sudo and have started to curb my own use of it. Haven’t gone back and updated any of HOWTOs to reflect that.
Good job! It may be helpful in the process of studying ubuntu so I’ve scrape it using scrapebook(firefox addon). Can you recommend any books about ubuntu for me? yeah, I am a noob of ubuntu.
thanks in advance!
Great blog I’ve actually bookmarked it for learning ubuntu. Can you recommend any books about ubuntu for me? yep, I am a beginner of ubuntu. :] thanks in advance.