Re: ext2 in a dos file/partition

Albert Cahalan (albert@ccs.neu.edu)
Tue, 12 Mar 1996 01:10:19 -0500 (EST)


> You could do this, with the loop device, but you'd have to write some
> support programs. What you'd do is given a host file, make sure it's
> contiguous, and find its start block, using the appropriate ioctl's.
> (See how LILO determines the blocks used for the kernel image file for
> an example.) Then open the device (/dev/hda1, or whatever), and set up
> the loop device to use that device, with the specified starting offset
> for the vbd start.

> point is that the loop device can either create a virtual block device
> based on a device OR a file. As you point out, a possible application
> of basing a vbd on top of a device is to handle wierd partitions in user
> mode. Just read in the BSD disklabel, and then set up the loop device
> with the correct starting offset.
>
> In order to completely use the loop device for this applicaiton, we
> would need to have a method of manually setting the size of the
> partition of the virtual device. Right now, the size is set to the size
> of the parent device or file minus the starting offset. We need to
> create a new ioctl to restrict the size down to the size specified in
> the non-native partition table. This wouldn't be at all difficult,

This would be _great_ for all the people sharing swap between Linux
and Windows. There could be a winswapon command that adds the swap
signiture a few blocks into the file, looks up the block and verifies
that the file really is contiguous, attaches a loopback device to
the disk at the proper offset, and then enables swapping. Putting
this into one command would make swap sharing really easy, yet fast.