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

Hi,
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
loadlin.exe
vmlinuz
rootfs
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 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