Loopback Device: Difference between revisions

no edit summary
[unchecked revision][unchecked revision]
mNo edit summary
No edit summary
Line 4:
The linux loopback device can be used by root only, and needs to be enabled in the kernel before use.
 
=== Floppy Disk Images With GRUB and EXT2 ===
 
First, lets create a empty image.
 
dd if=/dev/zero of=floppy.img bs=512 count=2880
 
Now, lets set it up for mounting.
 
losetup /dev/loop0 floppy.img
 
Now lets make it EXT2 formatted.
 
mkfs -t ext2 /dev/loop0
 
Mount!
 
mount -t ext2 /dev/loop0 /mnt/myfloppy
 
Create GRUB directory.
 
cd /mnt/myfloppy
mkdir grub
 
Copy GRUB's second stage files.
 
cp /lib/grub/i386-pc/stage[12] /mnt/myfloppy/grub
 
Create a device mapping for the GRUB installation.
 
echo (fd0) /dev/loop0 > /mnt/myfloppy/grub/device.map
 
Start GRUB console for installation into the boot record.
grub --device-map=/mnt/myfloppy/grub/device.map /dev/loop0
 
In the GRUB console:
root (fd0)
setup (fd0)
 
NOTE: You must unmount /mnt/myfloppy before using a emulator to directly read /dev/loop0 such as.
 
qemu -fda /dev/loop0
 
NOTE: When deleting the loop device the original floppy.img file will be saved with the modified contents.
 
=== Floppy Disk Images With FAT16 ===
 
First, lets create an empty image.
160

edits