ObjectiveFS Mount On Boot Guide For Linux

This guide covers the steps to set up your filesystem to mount automatically upon boot on Linux. For macOS, see this guide.

What You Need

Steps

  1. Check that /etc/objectivefs.env/OBJECTIVEFS_PASSPHRASE exists so you can mount your filesystem without needing to enter the passphrase.
    If it doesn’t exist, create the file with your passphrase as the content.

    $ sudo ls /etc/objectivefs.env
    AWS_ACCESS_KEY_ID         OBJECTIVEFS_LICENSE
    AWS_SECRET_ACCESS_KEY     OBJECTIVEFS_PASSPHRASE
    

  2. Add the following line in /etc/fstab

    <filesystem>  <mount dir>  objectivefs  auto,_netdev  0 0 

    Note:
    a. Check that <mount dir> is an existing empty directory
    b. _netdev is used by many Linux distributions to mark the file system as a network file system.
    c. Additional filesystem mount options can be added after _netdev separated by commas.

    Example:

    s3://bucket-name /ofs objectivefs  auto,_netdev,mt,noatime,nodiratime 0 0 

  3. For older RedHat-derived Linux versions (e.g. CentOS 6.5 or older): make sure that network file systems are enabled on boot.

    $ chkconfig --level 3 netfs on
    $ chkconfig --list netfs
    netfs           0:off   1:off   2:off   3:on    4:on    5:on    6:off
    

  4. Verify /etc/fstab is set up correctly to mount on boot.
    This command can be run without needing to reboot your system.

    $ sudo mount -a

Tips

If SELinux is enabled and you get an error during boot, you may need one of the following commands to allow mount on boot.

$ setsebool -P allow_mount_anyfile 1
$ semanage permissive -a mount_t

Examples

All examples below assumes your filesystem is stored in an S3 bucket called myfs and your mount directory is /ofs.

  1. Mount on boot with multithreading and compaction level 3 enabled
    Add this line in /etc/fstab:

    s3://myfs /ofs  objectivefs  auto,_netdev,mt,compact=3  0 0 

  2. Mount on boot with disk cache enabled
    a. Add a file /etc/objectivefs.env/DISKCACHE_SIZE that contains the desired disk cache size, e.g. 500G. (see disk cache user guide for options)

    # echo 500G > /etc/objectivefs.env/DISKCACHE_SIZE
    b. Add this line in /etc/fstab
    s3://myfs /ofs  objectivefs  auto,_netdev  0  0 

  3. Mount on boot using a different environment variable directory, e.g. /etc/ofs.admin
    Add this line in /etc/fstab

    s3://myfs /ofs  objectivefs  auto,_netdev,env=/etc/ofs.admin  0 0

Reference


Last updated by ObjectiveFS staff, May 02, 2020
ObjectiveFS is a shared file system for OS X and Linux that automatically scales and gives you scalable cloud storage. If you have questions or article idea suggestions, please email us at support@objectivefs.com