Loopback Device: Difference between revisions

[unchecked revision][unchecked revision]
Content deleted Content added
 
(8 intermediate revisions by 5 users not shown)
Line 8:
=== Floppy Disk Images With GRUB and EXT2 ===
 
First, lets create aan empty image.
 
dd if=/dev/zero of=floppy.img bs=512 count=2880
Line 69:
 
mount -t msdos /dev/loop0 /mnt/myfloppy
 
=== Floppy Disk Images With FAT12 ===
 
The steps mentioned below will be useful for the BrokenThorn Entertainment tutorials
 
Create an empty image.
dd if=/dev/zero of=floppy.img bs=512 count=2880
 
Set it up for mounting.
 
vnconfiglosetup vn0/dev/loop0 floppy.img
 
Format it to FAT12.
 
mkdosfs -F 12 /dev/loop0
 
Mount!
mount /dev/loop0 /mnt -t msdos -o "fat=12"
 
Unmount
 
umount /mnt/myfloppy
 
Destroy loopback device
 
losetup -d /dev/loop0
 
=== Hard Disk Images ===
Line 191 ⟶ 218:
|-
| mke2fs
| Create an ext2EXT2 filesytem
|-
| -b1024
Line 203 ⟶ 230:
|}
 
This gives us a clean ext2EXT2 formatted partition.
 
Note: mke2fs is smart enough to figure out block size and #blocks for itself, but if you ever want to use multiple partitions you'll need to know how to use those values.
Line 314 ⟶ 341:
mount /mnt/wherever
umount /mnt/wherever
 
 
==== The End ====
Line 325 ⟶ 351:
* losetup -o type command will give you the equivalent of a raw partition device (Eg /dev/hda1)
 
Don'''You must nevert forget to flush the filesystem buffers when manipulating with files on mounted disk image. ifOn you'rea using the image for running theUnix-like system., On linux itthis can be simply done by executing ''the <tt>sync''</tt> commandprogram in your shell.'''
 
== Loopback Device under FreeBSD ==
 
FreeBSD uses mdconfig. First, use DD to create an empty floppy image (1.44 MB in size). Memdisks are allocated dynamically, and the name is displayed after the mdconfig command. This assumes that "md0" is printed.)
FreeBSD 4.x uses vnconfig FreeBSD 5.x uses mdconfig
 
First, use DD to create an empty floppy image (1.44mb in size)
 
=== FreeBSD 4.x ===
 
dd if=/dev/zero of=floppy.img bs=512 count=2880
vnconfig vn0 floppy.img
newfs_msdos -f 1440 /dev/vn0
mount -t msdosfs /dev/vn0 /mnt/myfloppy
 
To shut and image down, unmount and unconfigure it.
 
umount /mnt/myfloppy
vnconfig -c /dev/vn0
=== FreeBSD 5.x ===
Memdisks are allocated dynamically, and the name is displayed after the mdconfig command. This assumes that "md0" is printed.)
 
To mount: