5 ms·
Maybe this is a really dumb question but how does one use a read-only filesystem? Can you mount it as writable temporarily or something? Or is it that you crea
by staticassertion 4y ago
Maybe this is a really dumb question but how does one use a read-only filesystem? Can you mount it as writable temporarily or something?
Or is it that you create a compressed 'file' that you can mount as a file system? Like a zip file kinda I guess?
- koolba 4y agoYou mount it as a read only file system to a mount point. It’s like putting in a CD (remember those?) into a drive. The source data can be a raw block device or more likely a local file. It doesn’t matter as either way the kernel is just reading blocks of bytes.
- staticassertion 4y ago> remember those? Not really tbh. I haven't used a CD in my adult life. I remember "burning a CD" was a thing and that's about it.
- o_1 4y agowe won't ask about 3.5 drives, funny thing is they have their special uses too.
- bee_rider 4y agoHow could you make us all feel so old. You monster.
- unsafecast 4y agoI was born in the early 2000s and I've used CDs a lot.
- staticassertion 4y agoAs an adult? For what? I was born in 1991 and I haven't used one since I was in 9th grade and made a girl a 'mix tape'.
- hansvm 4y agoJust like a read-only file or service. There's some kind of a construction step, and thereafter it's read-only. One might do that to make it explicit that updates are expensive, to grant read-only privileges to a less trusted process, or whatever. Somebody else can chime in with the exact mechanism by which this one is written, but common solutions include being writable sometimes or having a program to build the filesystem from known data. That might be filesystem-as-a-file, filesystem on a separate partition, or what have you.
- staticassertion 4y agoRight I want to know what the construction step is in this case, but that makes sense that there's multiple approaches.
- Nekit1234007 4y agoJust like creating any sort of archive. You (or a program of sorts) create the fs structure in some directory, then invoke something like `mkdwarfs -i /path/to/that/directory -o /path/to/output/file.dfs`
- Arnavion 4y agoAnd squashfs works the same way - mksquashfs takes a directory as input and writes a file as output. That file can then be loopback-mounted to present the readonly filesystem.
- staticassertion 4y agoGot it, yeah so that tracks then, thanks.
- syntheticnature 4y agoAnother option is to use a read-only filesystem with overlayfs to provide a writeable filesystem (like JFFS2) that also has a solid static FS underneath in case of error. OpenWrt does, or at least did, this.
- hinkley 4y agoYou got a few good “how” answers but as to “why”, it’s common for containers to use an overlay file system to handle writes. So in a container situation, you’ve already paid the overlay tax. Adding compression is a smaller incremental cost.