Home»Howto»Shell»Mount image

Mounting a disk image using the loop device

* Using Floppy images is easy, because there is no partition table:

# losetup /dev/loop0 /usr/local/bochs/dlxlinux/floppya.img

Now you can use the image like a real floppy:

- format : mkfs.minix /dev/loop0

- filesystem check : fsck.minix /dev/loop0

- mount : mount /dev/loop0 -o loop /mnt/floppy

Before you want to restart bochs you must do this:

# losetup -d /dev/loop0

Don't forget to umount before


* If you want access to a hard disk image, you have to calculate the size of the first cylinder. This value is the offset argument for losetup.

offset = bytes per sector * sectors per cylinder

The command for dlxlinux image looks like this:

losetup /dev/loop0 /usr/local/bochs/dlxlinux/hd10meg.img -o 8704

For images created by bximage you must use the value 32256.

* The hard disk image access doesnt work if the image contains more than one partition.

Latest News: