# Mount S4 locally with Bitifs

> Use the official mounting tool Bitifs to mount an S4 bucket as a local folder on Windows, macOS, and Linux.

Bitifs BETA is the official S4 mounting tool from Bitiful. It maps a bucket to a local folder on Windows, macOS, and Linux.

## Prerequisites

- You have [created a bucket](https://docs.bitiful.com/en/bitiful-s4/handbook/buckets.md);
- You have [created a sub-user and AccessKey](https://docs.bitiful.com/en/bitiful-s4/handbook/access-keys.md) and [granted](https://docs.bitiful.com/en/bitiful-s4/handbook/permissions.md) it read, write, and list permissions on the bucket.

## Install and mount

The command format is `bitifs bucket-name mount-point`. Replace `my-bucket` below with your bucket name. To mount only one directory, write `my-bucket:directory-name`; do the same when the sub-user has permissions on a directory only.

**Windows**

### Install WinFsp

Download and install it from the [WinFsp releases page](https://github.com/winfsp/winfsp/releases).

### Download Bitifs

AMD64: <https://tools.bitiful.com/bitifs/bitifs.exe>

### Set your keys

CMD:

```batch
set AWS_ACCESS_KEY_ID=YourAccessKey
set AWS_SECRET_ACCESS_KEY=YourSecretKey
```

PowerShell:

```powershell
$env:AWS_ACCESS_KEY_ID="YourAccessKey"
$env:AWS_SECRET_ACCESS_KEY="YourSecretKey"
```

### Mount to drive B

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

**macOS**

### Install macFUSE

Download and install it from the [macFUSE releases page](https://github.com/macfuse/macfuse/releases).

### Download Bitifs

Apple silicon:

```bash
curl -fL -o bitifs https://tools.bitiful.com/bitifs/bitifs_macos_arm64 && chmod +x bitifs
```

Intel chips:

```bash
curl -fL -o bitifs https://tools.bitiful.com/bitifs/bitifs_macos_amd64 && chmod +x bitifs
```

### Set your keys

```bash
export AWS_ACCESS_KEY_ID="YourAccessKey"
export AWS_SECRET_ACCESS_KEY="YourSecretKey"
```

### Mount

```bash
mkdir -p ~/bitiful-mount && ./bitifs my-bucket ~/bitiful-mount
```

**Linux**

### Install FUSE

```bash
sudo apt install fuse3   # Debian、Ubuntu
sudo dnf install fuse3   # Rocky、CentOS Stream、Fedora
```

### Download Bitifs

AMD64:

```bash
curl -fL -o bitifs https://tools.bitiful.com/bitifs/bitifs_linux_amd64 && chmod +x bitifs
```

ARM64:

```bash
curl -fL -o bitifs https://tools.bitiful.com/bitifs/bitifs_linux_arm64 && chmod +x bitifs
```

### Set your keys

```bash
export AWS_ACCESS_KEY_ID="YourAccessKey"
export AWS_SECRET_ACCESS_KEY="YourSecretKey"
```

### Mount

```bash
mkdir -p ~/bitiful-mount && ./bitifs my-bucket ~/bitiful-mount
```

**One-click mount for Bitiful S4**

A one-click Linux script made by a community member: <https://gitee.com/cncsrf/bitiful-oss>

## Unmount

```bash
umount ~/bitiful-mount          # macOS
fusermount3 -u ~/bitiful-mount  # Linux
```

On Windows, just end the `bitifs.exe` process. Before unmounting, make sure no program is writing.

## Usage tips

- Suited to browsing, backup, and sequential reads and writes. Hard links and file locks are not supported, so do not run databases on it;
- File permissions, owners, and modification times are not saved;
- Every read, write, and directory listing generates requests, so scanning many small files (for example by antivirus software or indexing services) increases request costs;
- For bulk migration, use [Rclone](https://docs.bitiful.com/en/best-practice/solutions/rclone.md) or [s5cmd](https://docs.bitiful.com/en/best-practice/solutions/aws-cli.md), which are faster.

## FAQ

<details>
<summary>Mounting fails with a permission error or 403</summary>

Check the keys and the sub-user grants. If only a directory is granted, mount with `my-bucket:directory-name`.

</details>

<details>
<summary>fuse is not found</summary>

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

</details>

<details>
<summary>Keeping keys in environment variables is inconvenient</summary>

You can put them in `~/.aws/credentials` and select them with `--profile name`.

</details>
