Appendix 3: The Loop Device
The loop device is a device driver that allows an image file to be mounted as
though it were a normal block device. The question that immediately jumps to
mind is, So, how do I use this beast . As an example, let's look at mounting,
and examining the contents of, the rescue floppy image file.
First the CD ROM, or other device containing this image file needs to be
mounted like:
mount r t iso9660 /dev/scd0 /cdrom
Note:
The r option declares the device to be read only. Also
/dev/scd0 assumes the drive is the first SCSI device. If the
machine uses a SoundBlaster Pro/Creative Labs combo for
the cdrom this device would be /dev/sbpcd0 instead. The
other possibilities depend on the particular interface being
used.
If this is an Official CD that was mounted, the file of interest is found as:
/cdrom/debian/hamm/main/disks i386/current/resc1440.bin
So the mount command using the loop device will look like:
mount t msdos o loop /../../resc1440.bin /mnt
After this an ls of /mnt will show all the files that will appear on the floppy disk
when this image file is transferred to it. This is a live file system. That is, it
can be modified just like any other read/write file system mounted as a block
device. The changes made to the file system while mounted become part of
the image file and will be reflected on the floppy constructed from that image.
Of course, in our example the file image resides on a read only medium so
changes aren't possible, but when the image file resides on a writable medium,
like the hard disk, then those kinds of changes become possible.
243
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved