Skip to content

Conversation

@amigthea
Copy link
Contributor

added bindfs mount option

added bindfs mount option
@BrownNPC
Copy link

Please merge this! it could have saved me hours of research

@BrownNPC
Copy link

BrownNPC commented Jan 23, 2026

Here's how you do a bi-directional mount using bindfs. I would appreciate if this guide could be added too.

This is useful for allowing waydroid to write files into your linux host.

For example, if we want to link our host ~/Downloads folder from within waydroid's filesystem as Download so that when you download a file in waydroid, it goes to your linux ~/Downloads folder.

First get the UID waydroid uses for folders.

export WAYDROID_ID=$(sudo stat -c '%u' ~/.local/share/waydroid/data/media)

next, we can use a command like this to mount a linux folder into waydroid.

sudo bindfs \
  --perms=u=rwx,g=rwx,o=rx \
  --force-group=$WAYDROID_ID \
  ~/LINUX_HOST_FOLDER \
  ~/.local/share/waydroid/data/media/0/WAYDROID_FOLDER
Bash script version (Click to reveal)
#!/usr/bin/env bash

# Exit on errors
set -e

# Usage check
if [ $# -ne 2 ]; then
    echo "Usage: $0 <host_folder> <waydroid_subfolder>"
    exit 1
fi

HOST_FOLDER="$1"
WAYDROID_SUB="$2"
WAYDROID_BASE="$HOME/.local/share/waydroid/data/media/0"
TARGET_FOLDER="$WAYDROID_BASE/$WAYDROID_SUB"

# Check host folder exists
if [ ! -d "$HOST_FOLDER" ]; then
    echo "Error: Host folder '$HOST_FOLDER' does not exist"
    exit 1
fi

# Detect Waydroid UID dynamically
if ! WAYDROID_UID=$(sudo stat -c '%u' "$WAYDROID_BASE" 2>/dev/null); then
    echo "Error: Could not determine Waydroid UID from '$WAYDROID_BASE'"
    exit 1
fi

# Create target folder if it doesn't exist
sudo mkdir -p "$TARGET_FOLDER"

# Perform the bindfs mount
sudo bindfs \
    --perms=u=rwx,g=rwx,o=rx \
    --force-group="$WAYDROID_UID" \
    "$HOST_FOLDER" \
    "$TARGET_FOLDER"

echo "Mounted '$HOST_FOLDER' → '$TARGET_FOLDER' with Waydroid UID $WAYDROID_UID"

Usage

# Allows waydroid to access host ~/Downloads folder. it will be available as Download inside of waydroid's filesystem
./bind-to-waydroid.sh ~/Downloads Download

@aleasto aleasto merged commit 76adc74 into waydroid:master Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants