Most active commenters
  • ranger_danger(3)

←back to thread

The File Filesystem (2021)

(mgree.github.io)
346 points wegwerff | 16 comments | | HN request time: 2.5s | source | bottom
1. paulgb ◴[] No.40216398[source]
This is really neat, but when I saw the headline I got excited that it was something I have been looking for / considering writing, and I figure the comments here would be a good place to ask if something like this exists:

Is there a FUSE filesystem that runs in-memory (like tmpfs) while mounted, and then when dismounted it serializes to a single file on disk? The closest I can find are FUSE drivers that mount archive files, but then you don't get things like symlinks.

replies(5): >>40216686 #>>40216763 #>>40216799 #>>40216812 #>>40220124 #
2. khc ◴[] No.40216686[source]
does it have to be fuse? cant you mount a disk image with loopback
replies(2): >>40216749 #>>40216775 #
3. metadat ◴[] No.40216749[source]
But will the disk image be fully stored in memory? No.. not with loopback. Either that, or it won't be mutable in memory with commit on unmount.
replies(1): >>40218001 #
4. Scaevolus ◴[] No.40216763[source]
Not purely in-memory, but something like https://github.com/jrwwallis/qcow2fuse maybe? It's clunky compared to OSX's DMGs, but if you squint it achieves similar ends.

Otherwise you could achieve this with a tmpfs wrapped to serialize to a tarball (preserving symlinks) when unmounted.

replies(1): >>40216892 #
5. andrewflnr ◴[] No.40216775[source]
Wouldn't a disk image have a fixed size? It could be a pain to resize.
replies(1): >>40216806 #
6. ranger_danger ◴[] No.40216799[source]
I can't think of anything _exactly_ like that, but I think you can get close by just copying some type of image file to /tmp and then moving it to disk when you're done after unmounting.
replies(1): >>40217275 #
7. ranger_danger ◴[] No.40216806{3}[source]
qcow2 is auto-expanding
replies(1): >>40222914 #
8. speps ◴[] No.40216812[source]
Closest I found: https://github.com/guardianproject/libsqlfs

> The libsqlfs library implements a POSIX style file system on top of an SQLite database. It allows applications to have access to a full read/write file system in a single file, complete with its own file hierarchy and name space. This is useful for applications which needs structured storage, such as embedding documents within documents, or management of configuration data or preferences. Libsqlfs can be used as an shared library, or it can be built as a FUSE (Linux File System in User Space) module to allow a libsqlfs database to be accessed via OS level file system interfaces by normal applications.

9. ranger_danger ◴[] No.40216892[source]
Oh nice, I didn't even know that existed. I've been using qemu-nbd and parted by hand and it gets cumbersome, so this might help a lot. Thanks!
10. AgentME ◴[] No.40217275[source]
/tmp isn't stored in memory; it's usually a normal on-disk filesystem that's cleared regularly. You want /dev/shm instead, which is a purely in-memory filesystem on normal Linux systems.
replies(1): >>40217297 #
11. codetrotter ◴[] No.40217297{3}[source]
> /tmp isn't stored in memory

It is if your system uses tmpfs for /tmp

https://en.wikipedia.org/wiki/Tmpfs

replies(1): >>40217373 #
12. throwway120385 ◴[] No.40217373{4}[source]
The point they were trying to make is that it doesn't have to be, and it isn't in several of the Linux systems I've used over the years. Assuming that it is is a bad idea.
replies(1): >>40218651 #
13. generalizations ◴[] No.40218001{3}[source]
Put the disk image inside a ramdisk and it's in memory. Write a script for saving to physical disk when dismounting, and you're done.
14. arjvik ◴[] No.40218651{5}[source]
/dev/shm always is though
15. hnlmorg ◴[] No.40220124[source]
Why does it have to be in memory?

I’m sure you’re already aware of this, but there are all kinds of very real scenarios that could lead to corrupted data if you’re only flushing the buffer upon unmounting.

Sounds like you’ve got an interesting problem you’re trying to solve though.

16. andrewflnr ◴[] No.40222914{4}[source]
But not trivially loop-mountable. I guess it's possible, though. https://unix.stackexchange.com/questions/268460/how-to-mount...