Sunday, October 11, 2009

Create, mount and copy floppy disks images under Linux

If we need it we can create an empty image and mount it using linux's loop devices.
(link to page)

Creating an empty floppy image (1.44MB):
$ dd bs=512 count=2880 if=/dev/zero of= /path/imagefile.img
Format it:
$ mkfs.msdos /path/imagefile.img

There's a more direct way to do this.
Create & format a floppy image of 1.44 MB:
$ /sbin/mkfs.msdos -C /path/imagefile.img 1440

Mounting it:
$ sudo mkdir /media/floppy1/
$ sudo mount -o loop /path/imagefile.img /media/floppy1/

If you want to transfer some files to Windows in VirtualBox then, after copying your files into the floppy image, you have to umount the image.
$ umount /media/floppy1

Now in VirtualBox you start Windows and mount the floppy image (Devices ==> Mount Floppy ==> Floppy Image) as you see in the picture.

Then you can transfer the files from the floppy image to Windows. Do not forget to unmount the floppy image once you're done or you'll get an error next time you try to boot into Windows. This is because the virtual machine tries to boot first from the floppy image.
In case you need to transfer bigger files, instead of a floppy image you can use a CDROM image. If you already have the files in a CD, that's easier since you can directly mount the CD.