[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Using loop devices in Debian



David wrote:
On 24 January 2014 01:04, Richard Owlett <rowlett@cloud85.net> wrote:

As I DO NOT have high speed internet available I have purchased a set of
Squeeze DVD's.

My impression is that I should be able to copy the set of DVD's to a flash
drive and access as loop device to save physically handling DVD's when using
apt-get etc.

Could I mount it as a loop device and do installs from the flash drive. I've
already have created several versions of preseed.cfg to address various
issues.

Disclaimers: I'm not sure exactly what you are asking.

That makes two of us ;)
That's why I ended my post asking for references "... so that I might ask good questions."

I don't know anything about preseed.

For the moment I'm comfortable with preseeding. I doubt I'm using it maximally, but that comes only with experience.

Hopefully you find the below assorted tips  useful anyway.

Regarding iso files:
-------------------

Ordinarily, an iso file is used to prepare a filesystem image that is
then burnt to a dvd. But you want to go in the opposite direction.
Somehow you need to read the entire dvd image into an iso file. And
this is not necessarily simple, see for example:
http://www.troubleshooters.com/linux/coasterless.htm#_Accurately_Reading_a_CD
Years ago I have done this successfully with CDs. I don't know if it
applies to DVDs.

From an initial reading, I don't see why it would not apply to a DVD.
Careful reread and experimentation to follow.


See also:
http://www.debian.org/doc/manuals/debian-reference/ch10
Section 10.3 and especially 10.3.6 following "you can ... make the
ISO9660 image directly from the CD-ROM device as follows"

I've found other portions of that work valuable in the past. Thanks for reminding me of it. Chapters 9 and 10 should keep me occupied. "10.3.8. Mounting the ISO9660 image file" implies an answer to my question.


Regarding loop mount of file versus device:
------------------------------------------

wikipedia explains the basic point well thus:
"if the file contains an entire file system, the file may then be
mounted as if it were a disk device."

Note the *file* may be loop-mounted. Not a device. While 'mount' is
commonly used to mount devices, this is different. Loop devices are
files pretending to be devices.

Could I mount *it* as a loop device (my emphasis on your "it")

You don't loop mount the flash *drive*, you loop mount a *file*.

So where you have several dvd iso files, then ordinarily you would
need several separate loop mounts. Unless you create a filesystem in
one huge file, copy all the iso's into it, and then loop mount that
huge file. That sounds like a very ugly idea to me, but I suppose it's
possible if preseed requires it for some reason. It would be smarter
to create one custom image file based on DVD #1 plus any extra you
need and mount just that. Try it first with just an image of DVD#1
before anything more complex.

I've been working on several quite unrelated personal projects. The only thing they have in common is _me_. In my physical environment It makes my life simpler if all of Debian is on a single physical device.


Regarding loop filesystems:
--------------------------

Loop filesystems are easy to experiment with. Create a file of zeros
of the required size (dd), create a filesystem inside the file (mkfs),
mount it (mount), copy files into it.

# dd if=/dev/zero of=/tmp/my_file bs=1024 count=1024
# mke2fs /tmp/my_file
# mkdir -p /tmp/my_mountpoint
# mount -v -o loop -t ext2 /tmp/my_file /tmp/my_mountpoint
# echo 'testing' > /tmp/my_mountpoint/testfile
# cat /tmp/my_mountpoint/testfile
# ls -l /tmp/my_mountpoint
# umount -v /tmp/my_mountpoint

That example skips over the utility named 'losetup' which creates the
loop device, because mount calls it for you. For iso images you will
need mount -t iso9660 or whatever 'file' reports for the image file.

Finally, thanks for correctly calling it a "loop" device and not a
"loopback" device (because loopback is a network interface), people
are often careless about this.



Thank you.


Reply to: