July 27th, 2024

Sqlitefs: SQLite as a Filesystem

The sqlitefs GitHub repository provides a tool to mount SQLite database files as filesystems on Linux and MacOS, enabling standard filesystem operations with SQLite databases for easier data manipulation.

Read original articleLink Icon
Sqlitefs: SQLite as a Filesystem

The GitHub repository sqlitefs offers a tool that allows users to mount a SQLite database file as a standard filesystem on Linux and MacOS. This tool, named sqlite-fs, enables the use of a SQLite database file in a manner similar to a regular filesystem. To utilize sqlite-fs, users need to have the Rust programming language (version 1.38 or higher) and either libfuse for Linux or osxfuse for MacOS, as required by the fuse-rs library.

To mount a filesystem, the command `sqlite-fs <mount_point> [<db_path>]` is used. If the specified database file does not exist, sqlite-fs will create it along with the necessary tables. If no database file is provided, an in-memory database will be created, which will be deleted upon unmounting. Unmounting is done using `fusermount -u <mount_point>` for Linux and `umount <mount_point>` for Mac.

The tool supports various functions, including creating, reading, deleting directories and files, changing file attributes, copying and moving files, and creating hard and symbolic links. However, file lock operations and strict error handling are not implemented. This tool is particularly beneficial for developers looking to interact with SQLite databases in a filesystem-like manner, facilitating easier data manipulation and access.

Link Icon 12 comments
By @tom1337 - 3 months
Ok so if we take this repo and then the headline from https://news.ycombinator.com/item?id=41085376, we could get an infinitely fast file system by just putting another SQLite filesystem on top.
By @alberth - 3 months
Reminds me of Microsoft WinFS.

Which was essentially SQL Server as a filesystem.

Project was ultimately cancelled.

https://en.m.wikipedia.org/wiki/WinFS

By @greenthrow - 3 months
Why would you bother with this instead of just making an in memory drive? I remember mounting in memory drives even in MS-DOS back in the early 90s. I did it to move whatever game I wanted to play into the RAM Drive so my load times would be faster.
By @punnerud - 3 months
If SQLite is faster than a normal file system, how fast is SQLite running on “SQLite as a filesystem”?
By @jefebromden - 3 months
Will anyone mention the repo hasn't been updated on 4 years?
By @DemocracyFTW2 - 3 months
It works (on Linux)! Should add that I only got to do what it does after following the advice expressed in the error message:

    fusermount: option allow_other only allowed if 'user_allow_other' is set in /etc/fuse.conf
It did not work using `sudo`
By @sillywalk - 3 months
For the bored, I was searching for 'database filesystem' and found one by Oracle. I gather it's a way to make editing BLOBs easier. That could make for some interesting recursive things.

It's "a file system interface placed on top of files and directories that are stored in database tables."[0]

[0] https://docs.oracle.com/en/database/oracle/oracle-database/1...

By @adius - 3 months
Related: SQLiteDAV - WebDAV server that maps an SQLite database to directories/files.

https://github.com/Airsequel/SQLiteDAV

By @gbonc2 - 3 months
I wrote this one, I tested with PostgresDB and Oracle , at time:

https://github.com/gbonacini/dbfs

By @szundi - 3 months
Filesystems are DB like structures these days anyway.