A native Linux filesystem for Microsoft OneDrive
onedriver is a native Linux filesystem for Microsoft OneDrive.
onedriver is a network filesystem that gives your computer direct access to your files on Microsoft OneDrive. To your computer, there is no difference between using files on OneDrive and files on your local hard disk. onedriver isn't a sync client, but it comes with all of the best features of one.
onedriver is extremely straightforwards to use:
I've spent a lot of time trying to make onedriver fast, convenient, and easy to use. Though you can use it on servers, the goal here is to make it easy to work with OneDrive files on your Linux desktop. You can easily sync files between Windows and Linux computers. You can setup your phone to auto-upload photos to OneDrive and edit and view them on your Linux computer. You can switch between LibreOffice on your local computer and the Microsoft 365 online apps as needed when working. Want to migrate from Windows to Linux? Just throw all your Windows files into OneDrive, add your OneDrive account to Linux with onedriver, and call it a day.
Microsoft OneDrive works on Linux.
Getting started with your files on OneDrive is as easy as running:
onedriver /path/to/mount/onedrive/at(there's also a helpful GUI!).
onedriver has several nice features that make it significantly more useful than other OneDrive clients:
Files are downloaded only when you use them. onedriver will only download a file if you (or a program on your computer) uses that file. You don't need to wait hours for a sync client to sync your entire OneDrive account to your local computer or try to guess which files and folders you might need later while setting up a "selective sync". onedriver gives you instant access to all your files and only downloads the ones you use.
Bidirectional sync. Although onedriver doesn't actually "sync" any files, any changes that occur on OneDrive will be automatically reflected on your local machine. onedriver will only redownload a file when you access a file that has been changed remotely on OneDrive. If you somehow simultaneously modify a file both locally on your computer and also remotely on OneDrive, your local copy will always take priority (to avoid you losing any local work).
Can be used offline. Files you've opened previously will be available even if your computer has no access to the internet. The filesystem becomes read-only if you lose internet access, and automatically enables write access again when you reconnect to the internet.
Fast. Great care has been taken to ensure that onedriver never makes a network request unless it actually needs to. onedriver caches both filesystem metadata and file contents both in memory and on-disk. Accessing your OneDrive files will be fast and snappy even if you're engaged in a fight to the death for the last power outlet at a coffeeshop with bad wifi. (This has definitely never happened to me before, why do you ask?)
Has a user interface. You can add and remove your OneDrive accounts without ever using the command-line. Once you've added your OneDrive accounts, there's no special interface beyond your normal file browser.
Free and open-source. They're your files. Why should you have to pay to access them? onedriver is licensed under the GPLv3, which means you will always have access to use onedriver to access your files on OneDrive.
Users on Fedora/CentOS/RHEL systems are recommended to install onedriver from COPR. This will install the latest version of onedriver through your package manager and ensure it stays up-to-date with bugfixes and new features.
sudo dnf copr enable jstaf/onedriver sudo dnf install onedriver
Ubuntu/Pop!_OS/Debian users can install onedriver from the OpenSUSE Build Service (despite the name, OBS also does a nice job of building packages for Debian). Like the COPR install, this will enable you to install onedriver through your package manager and install updates as they become available. If you previously installed onedriver via PPA, you can purge the old PPA from your system via:
sudo add-apt-repository --remove ppa:jstaf/onedriver
Arch/Manjaro/EndeavourOS users can install onedriver from the AUR.
Post-installation, you can start onedriver either via the
onedriver-launcherdesktop app, or via the command line:
Note: You can also set this up through the GUI via the
onedriver-launcherdesktop app installed via rpm/deb/
make install. You can skip this section if you're using the GUI. It's honestly easier.
To start onedriver automatically and ensure you always have access to your files, you can start onedriver as a systemd user service. In this example,
$MOUNTPOINTrefers to where we want OneDrive to be mounted at (for instance,
~/OneDrive). Mounting OneDrive via systemd allows multiple drives to be mounted at the same time (as long as they use different mountpoints).
# create the mountpoint and determine the service name mkdir -p $MOUNTPOINT export SERVICE_NAME=$(systemd-escape --template [email protected] --path $MOUNTPOINT)
systemctl --user daemon-reload systemctl --user start $SERVICE_NAME
automatically mount onedrive when you login
systemctl --user enable $SERVICE_NAME
check onedriver's logs for the current day
journalctl --user -u $SERVICE_NAME --since today
In addition to the traditional Go tooling, you will need a C compiler and development headers for
json-glib. On Fedora, these can be obtained with
dnf install golang gcc pkg-config webkit2gtk3-devel json-glib-devel. On Ubuntu, these dependencies can be installed with
apt install golang gcc pkg-config libwebkit2gtk-4.0-dev libjson-glib-dev.
# to build and run the binary make mkdir mount ./onedriver mount/
in new window, check out the mounted filesystem
ls -l mount
unmount the filesystem
fusermount -uz mount
you can also just "ctrl-c" onedriver to unmount it
A headless binary (no GUI) can be built with
make onedriver-headless. If you don't know which target to build, this isn't the one for you (run
makeinstead). When using the headless build, follow the text instructions in the terminal to perform first-time authentication to the Microsoft Graph API. Though it's not officially supported, the headless build should work on macOS, BSD, and even Windows as long as you have a variant of FUSE installed (for instance, OSXFUSE on macOS or libfuse on BSD).
The tests will write and delete files/folders on your onedrive account at the path
/onedriver_tests. Note that the offline test suite requires
sudoto remove network access to simulate being offline.
onedriver has multiple installation methods depending on your needs.
# install directly from source make sudo make install
create an RPM for system-wide installation on RHEL/CentOS/Fedora using mock
sudo dnf install golang gcc webkit2gtk3-devel json-glib-devel pkg-config git
rsync rpmdevtools rpm-build mock sudo usermod -aG mock $USER newgrp mock make rpm
create a .deb for system-wide installation on Ubuntu/Debian using pbuilder
sudo apt update sudo apt install golang gcc libwebkit2gtk-4.0-dev libjson-glib-dev pkg-config git
rsync devscripts debhelper build-essential pbuilder sudo pbuilder create # may need to add "--distribution focal" on ubuntu make deb
Most errors can be solved by simply restarting the program. onedriver is designed to recover cleanly from errors with no extra effort.
It's possible that there may be a deadlock or segfault that I haven't caught in my tests. If this happens, the onedriver filesystem and subsequent ops may hang indefinitely (ops will hang while the kernel waits for the dead onedriver process to respond). When this happens, you can cleanly unmount the filesystem with the following:
# in new terminal window fusermount -uz $MOUNTPOINT killall make # if running tests via make
onedriver can be completely reset (delete all cached local data) with
Many file browsers (like GNOME's Nautilus - see bug report) will attempt to automatically download all files within a directory in order to create thumbnail images. This is somewhat annoying, but only needs to happen once - after the initial thumbnail images have been created, thumbnails will persist between filesystem restarts.
Microsoft does not support symbolic links (or anything remotely like them) on OneDrive. Attempting to create symbolic links within the filesystem returns ENOSYS (function not implemented) because the functionality hasn't been implemented... by Microsoft. Similarly, Microsoft does not expose the OneDrive Recycle Bin APIs - if you want to empty or restore the OneDrive Recycle Bin, you must do so through the OneDrive web UI (onedriver uses the native system trash/restore functionality independently of the OneDrive Recycle Bin).
onedriver loads files into memory when you access them. This makes things very fast, but obviously doesn't work very well if you have very large files. Use a sync client like rclone if you need the ability to copy multi-gigabyte files to OneDrive.
OneDrive is not a good place to backup files to. Use a tool like restic or borg if you're looking for a reliable encrypted backup tool. I know some of you want to "back up your files to OneDrive". Don't do it. Restic and Borg are better in every possible way than any OneDrive client ever will be when it comes to creating backups you can count on.
Finally, this project is still in active development and is provided AS IS. There are no guarantees. It might kill your cat.