[lkml]   [1996]   [Dec]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectPatch to support mounting a looped file as the root filesystem

this is a small patch to enable mounting of the root filesystem
from a looped file. So it's possible to have your ext2 root filesystem as a
single large file on an MSDOS partition and boot from there, like this :
c:\linux> dir
c:\linux> loadlin vmlinuz root=/dev/hda1 looproot=/linux/rootfs rw

where /dev/hda1 is the DOS partition.
The DOS partition is accessible after booting under /bootfs

The kernel must have compiled (_not_ as modules) support for the loop device,
the following patch, and the msdos (or whatever) filesystem.

rootfs can be a standard root filesystem produced by any distribution, with
the following modifications :
Modify /etc/fstab on the fs contained in rootfs to include the line :
/dev/loop0 / ext2 defaults 1 1
instead of the usual entry for /
Also modify your startup rc file (rc.S for slackware) to remount / ro before
the check for a readonly root fs and the subsequent fsck :
/sbin/mount -n -r -o remount /

You might also want to setup a file to swap to.

This offers an alternative to UMSDOS as a way to run linux from a DOS
partition. It would be useful in situations where you want "Instant Linux"
for temporary demos etc. on DOS-only machines, where you can't go through
the process of defrag/fips/repartition/install.
This is of course, not restricted to DOS partitions, you can as easily boot
from files hosted by any other filesystem.

Problems/caveats :
1. The biggest problem is the loop device itself. It is deadlock-prone -
mke2fs on a 40MB looped file on a 386/4MB RAM locks up every time.
2. Performance is much worse than it should be when the hosting file is msdos.
For example - booting from the same fs took (roughly) 22 seconds on raw
ext2, 24 seconds on looped ext2 on ext2, and 45 seconds on looped ext2 on
msdos. The problem seems to be the slow msdos bmap (which is called for
every block). These timings are on a 486DX2/66MHz/8MB/630MB IDE.
3. This is my first attempt at kernel programming :) Also I haven't tested
this very extensively.

Ray van Tassle has written patches which solve 1. and 2., but they don't seem
to have made it into the kernel yet.
BTW, why does bmap not work when msdos filesystems are mounted with
blocksize=1024 ? If it did, then we could implement md-style re-mapping and
get almost the same performance as on a raw partition.

The patch is against 2.0.18, but compiles and works nicely upto
at least 2.0.26 (should work ok with later kernels too).

Comments, suggestions welcome ...

-- ganesh

beg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