Re: ext2 in a dos file/partition

Albert Cahalan (albert@ccs.neu.edu)
Thu, 7 Mar 1996 15:53:03 -0500 (EST)


>> How about this as an alternative/replacement for umsdos:
>> 1) Under dos, create a large contiguous file--obviously this
>> is a dos file in a dos partition.
>> 2) Convince Linux to use this file as if it were a linux partition.
>> 3) Do the normal linux things to it--specifically: mkfs & mkswap.

> There is such a thing; it's called the loop device. It's been around

Nope, at least I don't think so. The virtual block device has
these characteristics:

1: host file must be contiguous
2: host file might not be a file at all, just a block range
3: host filesystem code is not used to get the blocks
4: vbd acts like a partition in every way, including speed
5: blocks are calculated as n+vbd, where vbd is the vbd start

For safety, it would be reasonable to add some restrictions:

Assume that a vbd has been created in the /mnt/mystuff.vbd file.
This file is kept busy as if a program were executing from it.
The file may be removed, but not written to. If it is removed,
the blocks do not get freed until the host filesystem is unmounted
or the vbd is disabled. If the host filesystem is unmounted while
the vbd is in use, the blocks will be deallocated in that filesystem.
The vbd continues to run, and will prevent the host filesystem from
being remounted.

In other words:
It is possible to create the vbd with the host filesystem mounted,
It is possible to unmount the host filesystem while the vbd runs.
It is not possible to mount the host filesystem while the vbd runs.
It is possible to create the vbd without a host filesystem,
using just the block offset and number. This method _only_ works
for blocks that are not part of a mounted filesystem.

One very nice thing is that this makes it easy to handle
weird partitions in user mode. Many operating systems
define extended partition schemes. I think this includes
BSD, Xenix, SCO, AIX, and Linux (new in 1.3.xx). It also
lets a Windows swap file get used for swap at full speed.