Skip to content

Configuring fstab

Archie L. Cobbs edited this page Jun 13, 2021 · 1 revision

Using systemd it's easy to setup s3backer to startup automatically on boot and mount both your "lower" and "upper" filesystems.

Step 1

First, put all of your various s3backer options into a config file, e.g., /etc/s3backer-options.conf:

# s3backer config

# Geometry
--size=1t
--blockSize=256k

# Credentials
--accessFile=/etc/s3b-creds

# List blocks on startup
--listBlocks
--listBlocksThreads=50

# Encryption
--ssl
--encrypt
--passwordFile=/etc/s3b-passwd

# Block cache
--blockCacheSize=20000
--blockCacheFile=/opt/s3backer/cachefile
--blockCacheWriteDelay=15000
--blockCacheThreads=4
--blockCacheRecoverDirtyBlocks
--blockCacheNumProtected=1000

# Misc
--timeout=90

Note that this file does not contain the S3 bucket or mount point.

Step 2

Next, add the following to /etc/fstab:

s3backer#mybucket  /opt/s3b/mnt1  fuse  configFile=/etc/s3backer-options.conf,_netdev 0 0
/opt/s3b/mnt1/file /opt/s3b/mnt2  ext4  _netdev,loop,discard,x-systemd.requires=opt-s3b-mnt1.mount 0 0

Some details on what's going on in this example:

  • The S3 bucket is mybucket; replace with your actual bucket name
  • The s3backer lower layer filesystem will be mounted on /opt/s3b/mnt1
  • The EXT4 upper layer filesystem will be mounted on /opt/s3b/mnt2
  • The _netdev flags tell systemd that these mounts are network-dependent
  • The x-systemd.requires=opt-s3b-mnt1.mount creates a dependency from the upper layer to the lower layer
  • Options in /etc/fstab have the double dash removed and are jammed together separated by commas

Caveat: Due to a bug in versions prior to 1.6.2, using a separate s3backer-options.conf config file doesn't work. Instead, put the options directly into /etc/fstab, e.g.:

s3backer#mybucket  /opt/s3b/mnt1  fuse  size=1t,blockSize=256k,accessFile=/etc/s3b-creds,listBlocks,listBlocksThreads=50,ssl,encrypt,passwordFile=/etc/s3b-passwd,blockCacheSize=20000,blockCacheFile=/opt/s3backer/cachefile,blockCacheWriteDelay=15000,blockCacheThreads=4,blockCacheRecoverDirtyBlocks,blockCacheNumProtected=1000,timeout=90,_netdev 0 0
/opt/s3b/mnt1/file /opt/s3b/mnt2  ext4  _netdev,loop,discard,x-systemd.requires=opt-s3b-mnt1.mount 0 0