Previous Next Contents

14. Using a Loopback Device

A loopback device allows a normal disk file to be mounted as a filesystem. Depending on how much physical memory you have, using a loopback device may be preferable to using /dev/ram0 for building a root filesystem with Yard.

To use a loopback device you'll need to do the following:

Thanks to Roderich Schupp for some of this information.

  1. Enable loopback device support in your kernel if you haven't already. Under Floppy, IDE and other block devices, select either Y or M for Loopback device support. Recompile your kernel and reboot.
  2. You'll need modified versions of mount and losetup. These are available from:
    ftp://ftp.win.tue.nl:/pub/linux/util/
    in the file mount-2.5X.tar.gz, where X is the latest version letter.
  3. You'll also probably need mke2fs 1.02 or later. Type mke2fs with no arguments to see the version and option information. If there is no ``-F'' option listed, you'll need a newer version. mke2fs is included in the e2fsprogs package available in:
                    sunsite.unc.edu:/pub/Linux/system/Filesystems/ext2/
            
    

To use the loopback device/file with Yard, simply:

  1. In Config.pl, set $device to the name of a temporary disk file to hold the disk image, eg /tmp/fsfile. The file need not already exist. Set $fs_size to its desired size.
  2. Create the $device file:
            create_loopback_file
    
    or do it yourself with:
            dd if=/dev/zero of=$device bs=1k count=$fs_size
    
    and substitute your values for $device and $fs_size.
  3. If necessary, load the loopback device module (via insmod loop) into your kernel.

Yard may then be run with no further alterations.

Warning: When using a loopback device, occasionally the ext2 filesystem seems to get corrupted for no apparent reason. If you start getting errors in the middle of make_root_fs from sys() complaining that a directory doesn't exist, this may be what is happening. I don't know why this happens and I can't reproduce it consistently; however, unmounting, deleting and re-creating the file seems to get rid of the problem.


Previous Next Contents