Page 1 of 1

Live ISO, VFS, and mount points

Posted: Wed Mar 15, 2023 6:29 pm
by startrail
I am booting from an ISO for my OSdev and I've implemented the Joliet ISO filesystem.
Since the block device shows up as CD-ROM, the root filesystem also becomes read-only by my design.

I also don't have a separate VFS. I just select the appropriate FS as / and let each FS implementation switch to another FS whenever a mount point is encountered during path traversal.

Now, when I want to mount other filesystems at some mount point say /fs/<GUID>, I'm unable to create the directory /fs.
I was thinking of adding a flag isVirtual to my makeDirectory function which will essentially mean this is a memory-only directory entry and must not be committed to the underlying device. But that seems hackish to me.

I have 2 questions.
1. Is there a better way to create "virtual" directories?
2. How does Live Ubuntu ISO or any other live distro handle this? Assuming the same CD-ROM constraints.

Re: Live ISO, VFS, and mount points

Posted: Wed Mar 15, 2023 6:55 pm
by klange
startrail wrote:Is there a better way to create "virtual" directories?
Typically, you'd simply already have these directories present (but empty) on the read-only filesystem, so that they can be used as mount points for writable filesystems later.
startrail wrote:How does Live Ubuntu ISO or any other live distro handle this? Assuming the same CD-ROM constraints.
A Linux live CD will typically use an overlay, putting an in-memory writable filesystem atop read-only data from a squashfs image on the CD.

Further, a Linux live CD may support an additional overlay system called casper, which allows changes to be written to (and read back from) a persistent storage device like a USB stick.

Re: Live ISO, VFS, and mount points

Posted: Wed Mar 15, 2023 10:52 pm
by AndrewAPrice
Make empty placeholder directories on your disk drive if needed. Failing that, go with having an overlay.

I got around it by ditching the Unix hierarchy and not having anything mounted at /. My root directories are all virtual (mount points, shortcuts to installed applications, etc.)

Re: Live ISO, VFS, and mount points

Posted: Fri Mar 17, 2023 4:49 am
by MollenOS
I get around this by having a root fs mounted at '/' that is it's own filesystem, but a in-memory filesystem. It implements the same interface as a regular filesystem, except it has no backing device.

Then I just mount new filesystems under /storage/<dev>/<part>/.... and see if the the partition has a mount-point preferred by it's GUID and remount it under /... whatever.