Skip to main content

onedrive-fuse is a Linux or macOS filesystem for OneDrive

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

onedrive_fuse-0.0.2.tar.gz (52.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

onedrive_fuse-0.0.2-py3-none-any.whl (66.7 kB view details)

Uploaded Python 3

File details

Details for the file onedrive_fuse-0.0.2.tar.gz.

File metadata

  • Download URL: onedrive_fuse-0.0.2.tar.gz
  • Upload date:
  • Size: 52.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for onedrive_fuse-0.0.2.tar.gz
Algorithm Hash digest
SHA256 71f2f60ba9732be22b09b6130f9088947216d17c3372eee565b53d6a528af424
MD5 de31bfb0ad4646ca056071217a16ab6a
BLAKE2b-256 22af5fe24b65dc8426a43b8eebdc4a1f56114c2893f95187a495d88bf1ac160e

See more details on using hashes here.

File details

Details for the file onedrive_fuse-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: onedrive_fuse-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 66.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for onedrive_fuse-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7b4de44d34b5e1f867f82f3dbc7a37005835b1836e904f3121991fad3a12f325
MD5 bd8c9d08e0e6c9b139c85a8476e1b270
BLAKE2b-256 eabedef96f2095ff7df05c17d83b4377fcb5f53c98eea450745a1cc463b39c67

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page