Skip to content

Advanced Bitifs setup

Save the keys

Save the keys to a file so that you don't have to set environment variables each time.

Write them to C:\Users\username\.aws\credentials. The file has no extension, so do not save it as credentials.txt:

C:\Users\username.aws\credentials
[s4]
aws_access_key_id = YourAccessKey
aws_secret_access_key = YourSecretKey
.\bitifs.exe --profile s4 my-bucket B:

Write them to ~/.aws/credentials:

~/.aws/credentials
[s4]
aws_access_key_id = YourAccessKey
aws_secret_access_key = YourSecretKey
chmod 600 ~/.aws/credentials
./bitifs --profile s4 my-bucket ~/bitiful-mount

Write them to ~/.aws/credentials:

~/.aws/credentials
[s4]
aws_access_key_id = YourAccessKey
aws_secret_access_key = YourSecretKey
chmod 600 ~/.aws/credentials
./bitifs --profile s4 my-bucket ~/bitiful-mount

Use --shared-config path to specify a key file elsewhere.

Mount at startup

Create a task in Task Scheduler: set the trigger to At log on and the action to Start a program. Enter C:\bitifs\bitifs.exe as the program and the following as arguments:

--profile s4 my-bucket B:

On the Settings tab of the task, clear Stop the task if it runs longer than. Before shutting down, press Ctrl+C in the Bitifs window to unmount. Ending the task by force loses pending content.

Put bitifs in /usr/local/bin, then use launchd to run the mount command at login, with -f so that the program runs in the foreground.

/usr/local/bin/bitifs -f --profile s4 my-bucket /Users/username/bitiful-mount

Use systemd:

Install the program and keys

sudo install -m 755 bitifs /usr/local/bin/bitifs
sudo mkdir -p /etc/bitifs /mnt/my-bucket

Create the key file:

/etc/bitifs/credentials
[default]
aws_access_key_id = YourAccessKey
aws_secret_access_key = YourSecretKey
sudo chmod 600 /etc/bitifs/credentials

Create the service

/etc/systemd/system/bitifs-my-bucket.service
[Unit]
Description=Bitifs my-bucket
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
ExecStart=/usr/local/bin/bitifs -f --shared-config=/etc/bitifs/credentials my-bucket /mnt/my-bucket
ExecStopPost=-/bin/umount -l /mnt/my-bucket
Restart=on-failure
RestartSec=5
TimeoutStopSec=300

[Install]
WantedBy=multi-user.target

-f runs the program in the foreground so that systemd manages it. Stopping the service uploads pending content first, so set TimeoutStopSec long enough.

Start

sudo systemctl daemon-reload
sudo systemctl enable --now bitifs-my-bucket
ls /mnt/my-bucket

Multi-user access

The drive letter is only visible in the logon session that mounted it, and there is no allow_other option.

  • Other users should sign in and mount it themselves.
  • Programs run as administrator cannot see a drive mounted from a regular window. Mount it from an administrator window instead.

To run programs directly from the mounted drive, add --file-mode 0755:

.\bitifs.exe --profile s4 --file-mode 0755 my-bucket B:

By default, only the user who mounted the bucket can access it. To allow other users and services:

./bitifs --profile s4 -o allow_other --file-mode=0666 --dir-mode=0777 my-bucket ~/bitiful-mount

--uid and --gid set the displayed owner of files, and --file-mode and --dir-mode set the displayed permissions.

By default, only the user who mounted the bucket can access it. To allow other users and services, such as Nginx or Docker:

./bitifs --profile s4 -o allow_other --file-mode=0666 --dir-mode=0777 my-bucket /mnt/my-bucket

Before a regular user can use allow_other, enable user_allow_other in /etc/fuse.conf.

--uid and --gid set the displayed owner of files, and --file-mode and --dir-mode set the displayed permissions.

Common options

OptionDefaultNotes
--profiledefaultWhich set of keys in the key file to use
-fBackgroundRun in the foreground and print logs to the screen. Windows always runs in the foreground
--log-fileSystem logLog file path. In the foreground, logs go to the screen by default
--memory-limit1000Maximum memory for the data cache (MB)
--cacheOffDisk directory for the data cache. Create it first
--stat-cache-ttl1mHow long file information and directory listings are cached
--max-flushers16Concurrent upload requests
--max-parallel-parts8Concurrency for uploading large parts
--read-ahead-large102400Read-ahead size for sequential reads (KB)
--part-sizes5:1000,25:1000,125Part sizes (MB) and counts
--fsync-on-closeOffWait for the upload to finish when a file is closed
--no-preload-dirOffDo not list the directory when opening a single file, which reduces list requests
--cheapOffReduce the number of requests at the cost of some performance

See bitifs --help (.\bitifs.exe --help on Windows) for the full list.

Tuning examples

Machines with little memory:

.\bitifs.exe --memory-limit 300 --read-ahead-large 20480 my-bucket B:
./bitifs --memory-limit 300 --read-ahead-large 20480 my-bucket ~/bitiful-mount
./bitifs --memory-limit 300 --read-ahead-large 20480 my-bucket ~/bitiful-mount

Uploading large files with high bandwidth:

.\bitifs.exe --memory-limit 4000 --max-flushers 32 --max-parallel-parts 32 --part-sizes 25 my-bucket B:
./bitifs --memory-limit 4000 --max-flushers 32 --max-parallel-parts 32 --part-sizes 25 my-bucket ~/bitiful-mount
./bitifs --memory-limit 4000 --max-flushers 32 --max-parallel-parts 32 --part-sizes 25 my-bucket ~/bitiful-mount

With fixed 25 MB parts, a single file can be up to about 250 GB.

When writes take effect

Writes go to memory first and are uploaded asynchronously, so a command returning does not mean the upload has finished. To make sure:

  • On macOS and Linux, run sync path on a file. On Windows, run type B:\directory\.fsyncdir, which returns after that directory is uploaded (the "file not found" message is expected). You can also call fsync in your program;
  • Mount with --fsync-on-close to wait for uploads when files are closed, which is slower;
  • Unmount normally, which waits for all uploads to finish.

Failed uploads are retried automatically. Do not kill the process or cut the power, or pending content will be lost.

Changes made on other machines or in the console are visible after the cache time (1 minute by default). Lower --stat-cache-ttl to see them sooner, at the cost of more requests.

Limits

  • Suitable for browsing, backups, media files, and sequential reads and writes. Do not run databases or virtual machine disks on it.
  • Hard links are not supported. File locks only work on the local machine. If several machines write the same file, the last one to finish wins.
  • chmod, chown, and modification times are not saved. Displayed permissions are determined by the mount options.
  • Changing part of a large file re-uploads the affected parts, so frequent small rewrites are inefficient.
  • Renaming a directory moves its files one by one, which takes time when there are many.
  • With the default part settings, a single file can be up to about 1 TB.

Cost

Every read, write, and directory listing generates requests and data transfer. Exclude the mount directory from antivirus, indexing, and backup programs to avoid repeated scans. For bulk migration, use Rclone or s5cmd, which is faster and makes fewer requests.

FAQ

Mounting succeeds, but listing reports Permission denied or access denied

The keys, bucket name, or permissions are incorrect. Check for extra spaces in the keys, the bucket name, and whether the sub-user has the list permission. If only a directory is granted, write my-bucket:directory.

stat mountpoint: no such file or directory

On macOS and Linux, create the mount point with mkdir -p first. On Windows it is the opposite: a directory mount point must not exist.

fuse, fusermount3, or macFUSE not found

WinFsp, macFUSE, or fuse3 is not installed. On macOS, you also need to allow the system extension in System Settings and restart.

Transport endpoint is not connected

The program has exited but the mount point was not cleaned up. Run fusermount3 -uz mountpoint (Linux) or umount -f mountpoint (macOS), then mount again.

Other users or Docker containers cannot see the files

On macOS and Linux, -o allow_other is missing. On Windows, the drive is only visible in the logon session that mounted it. See Multi-user access.

Slow reads or high memory usage

See Tuning examples. When many large files are open at once, raise --memory-limit or lower --read-ahead-large.

How do I view logs?

Run in the foreground with -f (the default on Windows), or write to a file with --log-file. Add --debug-s3 when troubleshooting requests.