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.1.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.1-py3-none-any.whl (66.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: onedrive_fuse-0.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 4cd41b0f05c8af4cec9a474d71e4ccfda47e83db8f83d3ea3a2454df0efcb9b8
MD5 5e7b9fbe20800e16f797e2cebfb7d8ff
BLAKE2b-256 f4d1571d9c782ea0a14c96ba042577a6dadb30555567926048e2f69ff6b43d74

See more details on using hashes here.

File details

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

File metadata

  • Download URL: onedrive_fuse-0.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d7bd4494e5269e6d3b32da68afa8af47abc075722865b9f9d1d72eda4faa518b
MD5 3406ac57c6d13ebc9bc7c925c89cfc52
BLAKE2b-256 3eabc975686139a9a11495823e2c7a1b02b34cfdd788e95a30c994857057c942

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