> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.bitiful.com/en/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.bitiful.com/_mcp/server.

# Advanced Bitifs setup

> Bitifs key configuration, mounting at startup, multi-user access, tuning options, write reliability, limits, and FAQ.

## Save the keys

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

**Windows**

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

```ini title="C:\Users\username.aws\credentials"
[s4]
aws_access_key_id = YourAccessKey
aws_secret_access_key = YourSecretKey
```

```powershell
.\bitifs.exe --profile s4 my-bucket B:
```

**macOS**

Write them to `~/.aws/credentials`:

```ini title="~/.aws/credentials"
[s4]
aws_access_key_id = YourAccessKey
aws_secret_access_key = YourSecretKey
```

```bash
chmod 600 ~/.aws/credentials
./bitifs --profile s4 my-bucket ~/bitiful-mount
```

**Linux**

Write them to `~/.aws/credentials`:

```ini title="~/.aws/credentials"
[s4]
aws_access_key_id = YourAccessKey
aws_secret_access_key = YourSecretKey
```

```bash
chmod 600 ~/.aws/credentials
./bitifs --profile s4 my-bucket ~/bitiful-mount
```

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

## Mount at startup

**Windows**

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:

```text
--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.

**macOS**

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.

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

**Linux**

Use systemd:

### Install the program and keys

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

Create the key file:

```ini title="/etc/bitifs/credentials"
[default]
aws_access_key_id = YourAccessKey
aws_secret_access_key = YourSecretKey
```

```bash
sudo chmod 600 /etc/bitifs/credentials
```

### Create the service

```ini title="/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

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

## Multi-user access

**Windows**

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`:

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

**macOS**

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

```bash
./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.

**Linux**

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

```bash
./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

| Option                 | Default            | Notes                                                                                     |
| ---------------------- | ------------------ | ----------------------------------------------------------------------------------------- |
| `--profile`            | `default`          | Which set of keys in the key file to use                                                  |
| `-f`                   | Background         | Run in the foreground and print logs to the screen. Windows always runs in the foreground |
| `--log-file`           | System log         | Log file path. In the foreground, logs go to the screen by default                        |
| `--memory-limit`       | 1000               | Maximum memory for the data cache (MB)                                                    |
| `--cache`              | Off                | Disk directory for the data cache. Create it first                                        |
| `--stat-cache-ttl`     | 1m                 | How long file information and directory listings are cached                               |
| `--max-flushers`       | 16                 | Concurrent upload requests                                                                |
| `--max-parallel-parts` | 8                  | Concurrency for uploading large parts                                                     |
| `--read-ahead-large`   | 102400             | Read-ahead size for sequential reads (KB)                                                 |
| `--part-sizes`         | 5:1000,25:1000,125 | Part sizes (MB) and counts                                                                |
| `--fsync-on-close`     | Off                | Wait for the upload to finish when a file is closed                                       |
| `--no-preload-dir`     | Off                | Do not list the directory when opening a single file, which reduces list requests         |
| `--cheap`              | Off                | Reduce 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:

**Windows**

```powershell
.\bitifs.exe --memory-limit 300 --read-ahead-large 20480 my-bucket B:
```

**macOS**

```bash
./bitifs --memory-limit 300 --read-ahead-large 20480 my-bucket ~/bitiful-mount
```

**Linux**

```bash
./bitifs --memory-limit 300 --read-ahead-large 20480 my-bucket ~/bitiful-mount
```

Uploading large files with high bandwidth:

**Windows**

```powershell
.\bitifs.exe --memory-limit 4000 --max-flushers 32 --max-parallel-parts 32 --part-sizes 25 my-bucket B:
```

**macOS**

```bash
./bitifs --memory-limit 4000 --max-flushers 32 --max-parallel-parts 32 --part-sizes 25 my-bucket ~/bitiful-mount
```

**Linux**

```bash
./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](https://docs.bitiful.com/en/prices/detail/requests-prices.md) and [data transfer](https://docs.bitiful.com/en/prices/detail/transfer-prices.md). Exclude the mount directory from antivirus, indexing, and backup programs to avoid repeated scans. For bulk migration, use [Rclone](https://docs.bitiful.com/en/clients/rclone.md) or [s5cmd](https://docs.bitiful.com/en/clients/aws-cli.md#s5cmd), which is faster and makes fewer requests.

## FAQ

<details>
<summary>Mounting succeeds, but listing reports Permission denied or access denied</summary>

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`.

</details>

<details>
<summary>stat mountpoint: no such file or directory</summary>

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.

</details>

<details>
<summary>fuse, fusermount3, or macFUSE not found</summary>

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

</details>

<details>
<summary>Transport endpoint is not connected</summary>

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.

</details>

<details>
<summary>Other users or Docker containers cannot see the files</summary>

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](https://docs.bitiful.com/bitiful-s4/intro.md#multi-user-access).

</details>

<details>
<summary>Slow reads or high memory usage</summary>

See [Tuning examples](https://docs.bitiful.com/bitiful-s4/intro.md#tuning-examples). When many large files are open at once, raise `--memory-limit` or lower `--read-ahead-large`.

</details>

<details>
<summary>How do I view logs?</summary>

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

</details>
