https://github.com/swillner/ramcachefs
Userspace in-memory filesystem with on-demand persistance
https://github.com/swillner/ramcachefs
filesystem fuse in-memory-filesystem libfuse persistent
Last synced: 2 months ago
JSON representation
Userspace in-memory filesystem with on-demand persistance
- Host: GitHub
- URL: https://github.com/swillner/ramcachefs
- Owner: swillner
- License: mit
- Created: 2021-04-13T15:39:34.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-04-14T06:01:36.000Z (almost 2 years ago)
- Last Synced: 2025-04-11T01:14:47.433Z (12 months ago)
- Topics: filesystem, fuse, in-memory-filesystem, libfuse, persistent
- Language: C
- Homepage:
- Size: 37.1 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ramcachefs
Userspace in-memory filesystem with on-demand persistance using [FUSE
(Filesystem in Userspace)](https://github.com/libfuse/).
`ramcachefs` caches a directory in memory and persists changes to the
directory and its files back to disk on demand only. Useful for
caching directories with lots of read/write operations, e.g. for
inefficient I/O processes or to protect SSDs from frequent writes to
browser caches.
## Features
- No root needed as long as FUSE is enabled on the system (unlike
`tmpfs`)
- Caches the directory and all its files and subdirectories in place
(i.e. no path changes for processes accessing the directory)
- Write-back of changes (file changes, type changes, creations,
deletions, permissions, and changes to owner) on demand (calling
`ramcachefs -p `) and optionally automatically after
unmount.
## Installation
### Prerequisites
To build `ramcachefs` you need the FUSE 3 libraries. On Debian/Ubuntu,
just install these using
```
sudo apt-get install libfuse3-dev
```
### Building
Just build the `ramcachefs` binary using
```
make
```
## Usage
Just call the `ramcachefs` binary and specify the directory to cache
as ``. By default it forks to the background as a daemon,
which can be disabled using the `-f` option. Stop the caching by
unmounting the `` (`umount `. By default changes are persistet after unmount, which
can be disabled using the `-o noautopersist` option.
### Options
```
usage: ramcachefs [options]
-p --trigger-persist trigger persist
-h --help print help
-V --version print version
-d -o debug enable debug output (implies -f)
-f foreground operation
-s disable multi-threaded operation
-o clone_fd use separate fuse device fd for each thread
(may improve performance)
-o max_idle_threads the maximum number of idle worker threads
allowed (default: 10)
-o allow_other allow access by all users
-o allow_root allow access by root
-o auto_unmount auto unmount on process termination
-o direct_io always use direct_io (breaks mmap!)
-o maxinodes=NUMBER maximum number of inodes (default: '1000000')
-o noautopersist do not persist on unmount
-o prepopulate read full files at start (prepopulate mmaps)
-o size=SIZE size (default: '1G')
```
## Disclaimer
Bugs in filesystems can easily lead to data losses! Use `ramcachefs`
at your own risk. I am using it on a day-to-day basis without any
issues so far. Nevertheless, please be careful when using it for
crucial data.