Install dependencies
sudo apt-get update
sudo apt-get install automake autotools-dev fuse g++ git libcurl4-gnutls-dev libfuse-dev libssl-dev libxml2-dev make pkg-config
Install s3fs
git clone https://github.com/s3fs-fuse/s3fs-fuse.git
cd s3fs-fuse
./autogen.sh
./configure --prefix=/usr --with-openssl
make
sudo make install
which s3fs
Config credentials
echo "Your_accesskey:Your_secretkey" >> /etc/passwd-s3fs
sudo chmod 640 /etc/passwd-s3fs
Create mounting point
mkdir /mys3bucket
s3fs your_bucketname -o use_cache=/tmp -o allow_other -o uid=1001 -o mp_umask=002 -o multireq_max=5 /mys3bucket
Config mount after reboot
Add the following command in /etc/rc.local
:
/usr/local/bin/s3fs your_bucketname -o use_cache=/tmp -o allow_other -o uid=1001 -o mp_umask=002 -o multireq_max=5 /mys3bucket
Reference:
How to Mount S3 bucket on EC2 Linux Instance
Use the lsblk
command to list the block devices attached to the instance
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 30G 0 disk
`-xvda1 202:1 0 8G 0 part /
loop0 7:0 0 91M 1 loop /snap/core/6405
loop1 7:1 0 87.9M 1 loop /snap/core/5742
loop2 7:2 0 17.9M 1 loop /snap/amazon-ssm-agent/1068
loop3 7:3 0 16.5M 1 loop /snap/amazon-ssm-agent/784
loop4 7:4 0 18M 1 loop /snap/amazon-ssm-agent/930
Use the df -h
command to report the existing disk space usage on the file system
$ sudo df -h /dev/xvd*
Filesystem Size Used Avail Use% Mounted on
udev 488M 0 488M 0% /dev
/dev/xvda1 7.7G 7.4G 370M 96% /
Expand the modified partition using growpart
$ sudo growpart /dev/xvda 1
CHANGED: partition=1 start=2048 old: size=16775135 end=16777183 new: size=62912479,end=62914