Contents...
s3fs is a file system in User Space (FUSE) based which is used to mount the Amazon s3 buckets. You can use the Linux/Unix command same as another Hard Drive on your server. After mounting the s3 buckets on your system you can simply use the basic Linux commands similar to run on locally attached disks.
In this article I will explain how you can mount the s3 bucket on your Linux system.
If fuse-s3fs and fuse is already install on your system remove it using below command:
# yum remove fuse fuse-s3fs
Install Fuse and fuse-s3fs Packages
To install the fuse and fuse-s3fs you will need to install it dependencies first, type the below command to install its dependencies:
# yum install gcc gcc-c++ openssl-devel libstdc++-devel curl-devel libxml2-devel mailcap
Now download and compile the latest version of fuse.
# cd /tmp/ # wget http://downloads.sourceforge.net/project/fuse/fuse-2.X/2.9.3/fuse-2.9.3.tar.gz # tar -xzf fuse-2.9.3.tar.gz # cd fuse-2.9.3 # ./configure --prefix=/usr/local # make # make install # export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig # ldconfig # modprobe fuse
Compile The s3fs From Source Code
# cd /usr # wget https://s3fs.googlecode.com/files/s3fs-1.74.tar.gz # tar -xzf s3fs-1.74.tar.gz # cd s3fs-1.74 # ./configure --prefix=/usr/local # make # make install
Setup Access Key
Now create a file in /etc/ called “passwd-s3fs” and paste your access key and secret key in it.
# vi /etc/.passwd-s3fs {access_key}:{secret_key}
Save and close the file.
Alternatively
# echo AWS_ACCESS_KEY_ID:AWS_SECRET_ACCESS_KEY > /etc/.passwd-s3fs
Set the permission on passwd-s3fs file.
# chmod 600 /etc/.passwd-s3fs
Mount The S3 Bucket
Now mount the s3 bucket typing below command:
# mkdir /s3mount < crate a directory # chmod 777 /s3mount
Let’s mount s3 bucket temporary using below command:
Example:
# s3fs s3bucket-name /path/to/mountpoint -o passwd_file=/etc/.passwd-s3fs
$ s3fs s3bucket-name /s3mount -o passwd_file=/etc/.passwd-s3fs
Now check the s3 mounted bucket using below command:
# df -TH /s3mount
Or list the file on mounted directory :
# ls -l /s3mount
During system reboot mount the s3 bucket editing /etc/fstab.
# vim /etc/fstab ........ ...... #s3fs#s3bucket-name /s3mount fuse defaults,uid=root,gid=root,use_cache=/tmp/s3cache,passwd_file=/etc/.passwd-s3fs 0 0
Save and close.
Mount all the file systems listed in /etc/fstab.
# mount -a
Check mounted bucket using below command:
# df -Th Filesystem Type Size Used Avail Use% Mounted on /dev/xvde ext4 100.9G 69.5G 0 59% / tmpfs tmpfs 1.8G 0 1.8G 0% /dev/shm s3fs fuse.s3fs 256T 0 256T 0% /s3mount
Thanks:)
If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at LookLinux Submit Article. Stay connected to Facebook.
s3fs: Failed to access bucket.
in centos 5.5 32bit OS