Skip to main content

onedrive-fuse

onedrive-fuse is a Linux or macOS network filesystem.

onedrive-fuse is a network filesystem that gives your computer direct access to your files on a remote server. onedrive-fuse allows you to use files on your remote server as if they were files on your local computer. text onedrive-fuse performs an on-demand download of files when your computer attempts to use them.

Key features

onedrive-fuse has several nice features:

  • Only download files when you use them. The deafult is to only download a file if you (or a program on your computer) uses that file.

  • Bidirectional sync. onedrive-fuse will only download a file when you access a file that has been changed remotely. If you somehow simultaneously modify a file both locally on your computer and also remotely on your server, onedrive-fuse will keep the most recently modified file. The default is to check your remote server once every minute for any remotely changed files.

  • Can be used offline. Files you've opened previously will be available even if your computer has no access to the internet. While your computer is disconnected from the internet, you can continue to update the local filesystem and when you reconnect to the internet, the locally updated files will be uploaded to your server.

  • Fast. onedrive-fuse asynchronously performs network requests to your server once every 10 seconds. onedrive-fuse caches both filesystem metadata and file contents both in memory and on-disk. Filesytem operations will always be fast unless a large file must be read from Google Drive.

  • Symbolic Links. onedrive-fuse supports symbolic links (e.g., ln -s command).

  • gitignore files. Files that match a .gitignore file are only cached locally and are not uploaded to your server. This means that Python virtual environment packages in .venv and nodejs packages in node_modules are only installed locally.

Local Only directories. Directories can be configued to only store files locally in your native filesystem to improve small file performance. The ~/.onedrive-fuse/config.toml file is used to configure local only directories. Thenode_modules directory is configured as a local only directory so node packages are stored locally in your native filesystem, and npm install will run very fast.

This is the default `config.toml' file:

### This is the configuration file.
### It should be placed in $HOME/.onedrive-fuse/config.toml

# Directory names that are only created localy and not synced to Google Drive.
# Files in local only directories are stored in the native filessystem for fast
# updates.  Install directories are good candidates to be stored locally.
local_only = [
   "node_modules",    
]

Quick start

Install FUSE

OSX

On Mac OSX, onedrive-fuse requires osxfuse and pkg-config:

$ brew update; brew install pkg-config; brew tap homebrew/cask; brew install --cask osxfuse

Ubuntu / Debian

On Ubuntu / Debian, onedrive-fuse requires libfuse-dev, libssl-dev and pkg-config:

sudo apt-get install -y fuse3 libfuse-dev libssl-dev pkg-config

Fedora

On Fedora, onedrive-fuse requires gcc, fuse3-devel, and pkg-config:

sudo dnf install -y gcc fuse3-devel pkg-config

Authentication

These authentication parameters must be configured in your ~/.onedrive-fuse/config.toml file:

  • client_id
  • client_secret
  • redirect_url

Here is an example of how to configure authentication tokens in the ~/.onedrive-fuse/config.toml file:

# Registrater a onedrive application:
# 1. Go to: https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBladeh
# 2. Click "+ New registration"
# 3. Enter a name: "OneDrive FUSE"
# 4. Set supported account types to "Personal accounts only"
# 5. Select platform: "Web"
# 6. Set the redirect URI to "http://localhost:8080"
# 7. Create client secret.
client_id = "copy client_secret here"
client_secret = "copy client_secret here"
redirect_uri = "http://localhost:8080"

Install onedrive-fuse:

MacOS

Install pipx:

brew install pipx
pipx ensurepath
sudo pipx ensurepath --global # optional to allow pipx actions with --global argument
pipx install onedrive-fuse

Ubuntu / Debian

sudo apt update
sudo apt install pipx
pipx ensurepath
sudo pipx ensurepath --global # optional to allow pipx actions with --global argument
pipx install onedrive-fuse

Fedora

sudo dnf install pipx
pipx ensurepath
sudo pipx ensurepath --global # optional to allow pipx actions with --global argument
pipx install onedrive-fuse

Mount Filesystem

Create mountpoint directory:

MOUNTPOINT=~/mnt
mkdir $MOUNTPOINT

Mount Filesystem:

onedrive-fuse mount $MOUNTPOINT # add --downloadall to sync all files

Notes:

  • It's recommended to run it as user, not as root. For this to work the mountpoint must be owned by the user.
  • The cache update interval defaults to 1 minutes, and can be set with the --updateinterval option.

Unmount Filesystem

onedrive-fuse unmount $MOUNTPOINT

or

fusermount -u $MOUNTPOINT

Display onedrive-fuse activity:

onedrive-fuse status

Building onedrive-fuse yourself

Create Virtual Environment:

cd onedrive-fuse
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pip install -e .

Mount filesystem:

$ ./src/onedrive_fuse/cli.py $MOUNTPOINT

Running tests

The best way to test is to clone a repo, and install, build and run the application.

Mount Filesystem:

onedrive-fuse mount $MOUNTPOINT

Build and run web application:

cd $MOUNTPOINT
git clone https://github.com/allproxy/allproxy.git
npm install
npm run build
npm start

Run python application:

cd $MOUNTPOINT
git clone https://github.com/davechri/onedrive-fuse.git
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pip install -e .
./src/onedrive_fuse/cli.py status

Troubleshooting

If the filesystem appears to hang, its possible the fileystem has crashed. To resolve this:

  • Remount: fusermount -u $MOUNTPOINT and remount `onedrive-fuse mount $MOUNTPOINT
  • Clear the local cache: fusermount -u $MOUNTPOINT and remount onedrive-fuse mount $MOUNTPOINT --clearcache
  • Restart your computer

Logging

  • Error Log: error logs are logged to ~/.onedrive-fuse/error.log

Debug Logging

For debug logging use the --debug option. The --verbose option will produce more verbose logging.

onedrive-fuse mount $MOUNTPOINT --debug &> ~/path_to_my_log_file

Display onedrive-fuse status

Filesystem statistics are displayed every 10 seconds.

onedrive-fuse status
08:28:45 ONLINE:
	LOCAL_ONLY:   /home/dave/.onedrive-fuse/home/localonly=1.0 GB
	REMOTE_FILES: dirs=526   files=934      links=17   cached=13.1 MB   fileBytes=1.1 GB
08:28:57 ONLINE:
	LOCAL_ONLY:   /home/dave/.onedrive-fuse/home/localonly=1.0 GB
	REMOTE_FILES: dirs=526   files=934      links=17   cached=13.1 MB   fileBytes=1.1 GB
08:29:09 ONLINE:
	REMOTE CALLS: readdir=1 
	LOCAL_ONLY:   /home/dave/.onedrive-fuse/home/localonly=1.0 GB
	REMOTE_FILES: dirs=564   files=941      links=20   cached=13.1 MB   fileBytes=1.1 GB

Dump Internal State

Display metadata:

onedrive-fuse metadata

Display directory entries:

onedrive-fuse directories

Diaplay all unread files:

onedrive-fuse unread

Display the event queue:

onedrive-fuse eventqueue

Metadata

Release files for onedrive-fuse 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for onedrive-fuse 0.0.2
File Size Uploaded
onedrive_fuse-0.0.2.tar.gz 52.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for onedrive-fuse 0.0.2
File Interpreter ABI Platform
onedrive_fuse-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 119.2 kB

Release files / onedrive_fuse-0.0.2.tar.gz

Download URL onedrive_fuse-0.0.2.tar.gz
Size 52.4 kB
Tags Source
SHA-256 checksum
How to use checksums
71f2f60ba9732be22b09b6130f9088947216d17c3372eee565b53d6a528af424
BLAKE2b-256 checksum
How to use checksums
22af5fe24b65dc8426a43b8eebdc4a1f56114c2893f95187a495d88bf1ac160e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / onedrive_fuse-0.0.2-py3-none-any.whl

Download URL onedrive_fuse-0.0.2-py3-none-any.whl
Size 66.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7b4de44d34b5e1f867f82f3dbc7a37005835b1836e904f3121991fad3a12f325
BLAKE2b-256 checksum
How to use checksums
eabedef96f2095ff7df05c17d83b4377fcb5f53c98eea450745a1cc463b39c67
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page