-->
  • Recent Articles

    How to Mount an ObjectStorage Bucket as Filesystem in Oracle Linux 7

    1. Make sure there is a Bucket created on OCI account.

    2. Enable Following Repository:   ol7_developer_EPEL and ol7_latest

    [ol7_developer_EPEL]

    name=Oracle Linux $releasever EPEL Packages for Development ($basearch)

    baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL7/developer_EPEL/$basearch/

    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle

    gpgcheck=1

    enabled=1

    [ol7_latest]
    name=Oracle Linux $releasever Latest ($basearch)
    baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL7/latest/$basearch/
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
    gpgcheck=1
    enabled=1


    3. Installing directly using yum from Oracle Linux 7 instance:

    # yum install s3fs-fuse -y

    # yum install s3fs-fuse -y ol7_addons | 3.0 kB 00:00:00 ol7_developer_EPEL | 3.6 kB 00:00:00 ol7_latest | 3.6 kB 00:00:00 ol7_optional_latest | 3.0 kB 00:00:00 (1/10): ol7_addons/x86_64/updateinfo | 134 kB 00:00:00 (2/10): ol7_developer_EPEL/x86_64/updateinfo | 594 kB 00:00:00 (3/10): ol7_addons/x86_64/primary_db | 213 kB 00:00:00 (4/10): ol7_developer_EPEL/x86_64/primary_db | 15 MB 00:00:00 (5/10): ol7_developer_EPEL/x86_64/group_gz | 88 kB 00:00:00 (6/10): ol7_latest/x86_64/group_gz | 136 kB 00:00:00 (7/10): ol7_latest/x86_64/updateinfo | 3.4 MB 00:00:00 (8/10): ol7_latest/x86_64/primary_db | 38 MB 00:00:00 (9/10): ol7_optional_latest/x86_64/primary_db | 5.6 MB 00:00:00 (10/10): ol7_optional_latest/x86_64/updateinfo | 1.4 MB 00:00:00 Resolving Dependencies --> Running transaction check ---> Package s3fs-fuse.x86_64 0:1.90-1.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ===================================================================================================================================================================================================================== Package Arch Version Repository Size ===================================================================================================================================================================================================================== Installing: s3fs-fuse x86_64 1.90-1.el7 ol7_developer_EPEL 330 k Transaction Summary ===================================================================================================================================================================================================================== Install 1 Package Total download size: 330 k Installed size: 883 k Downloading packages: s3fs-fuse-1.90-1.el7.x86_64.rpm | 330 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : s3fs-fuse-1.90-1.el7.x86_64 1/1 Verifying : s3fs-fuse-1.90-1.el7.x86_64 1/1 Installed: s3fs-fuse.x86_64 0:1.90-1.el7 Complete!



    4. Go to the Oracle Cloud Infrastructure Web  Console, click the Profile icon in the top-right corner, and select User Settings. Then -Click Customer Secret Keys, and then click Generate Secret Key.

     
    Give the key a meaningful name (for example, s3fs-access), and then click Generate Secret Key.

    Copy and save the secret key because it won't be shown again.

    Customer_secret_keys_OCI
    Customer_secret_keys_OCI

    The S3 credentials are created by using an access key and the secret key. The access key is displayed in the Customer Secret Keys area of the Console.

    5. Enter your credentials in a ${HOME}/.passwd-s3fs file and set owner-only permissions:



    cat ${HOME}/.passwd-s3f

    ACCESS_KEY_ID:SECRET_ACCESS_KEY


    In my case the access_key_id = xxxxxxxxxxxxxxxxxxx

    and the password is =  yyyyyyyyyyyyyyyyyy

    so it should be :   xxxxxxxxxxxxxxxxxxx:yyyyyyyyyyyyyyyyyy


    Example:


    [root@localhost ~]# cat ${HOME}/.passwd-s3fs
    xxxxxxxxxxxxxxxxxxx:yyyyyyyyyyyyyyyyyy
    [root@localhost ~]#

    6. s3fs: credentials file /root/.passwd-s3fs should not have others permissions. Change the credential file permission.

    # chmod 600 ${HOME}/.passwd-s3fs

    7. Run the mount by using the following command:


    s3fs <bucket name> <mount_point> -o url=https://<namespace_name>.compat.objectstorage.<region>.oraclecloud.com -onomultipart -o use_path_request_style -o endpoint=<region>
    Example:

    # s3fs data /data -o passwd_file=${HOME}/.passwd-s3fs -o url=https://support.compat.objectstorage.us-ashburn-1.oraclecloud.com -onomultipart -o use_path_request_style -o endpoint=us-ashburn-1

    8. Verify is mounted:


    [root@localhost yum.repos.d]# df -h /data
    Filesystem      Size  Used Avail Use% Mounted on
    s3fs             16E     0   16E   0% /data
    [root@localhost  yum.repos.d]#

     

    Unmounting the File System

     

    To Unmounting the File System you need to use the "fusermount" command:

    # fusermount -u mountpoint


    No comments