Yesterday I was searching a way to create and use img files using linux, and found a few simple commands that do the job.
Create a disk image from the phisical drive:
cat /dev/fd0 > imagefile.img
Copy image to the phisical drive:
cat imagefile.img > /dev/fd0
Simple isn’t it? And now the fun part :P
If we need it we can create an empty image and mount it using linux’s loop devices.
Creating the image:
$ dd bs=512 count=2880 if=/dev/zero of=imagefile.img
$ mkfs.msdos imagefile.img
Mounting it:
$ sudo mkdir /media/floppy1/
$ sudo mount -o loop floppy.img /media/floppy1/
Alternatively with a path as suggested by Anders Lennqvist in a comment to this post
Create a disk image from a physical diskette:
cat /dev/fd0 > /path/imagefile.img
Copy the image to a diskette:
cat /path/imagefile.img > /dev/fd0
There’s an even easier way to do this using mkfs.msdos, skipping the need for the dd command. Also, on my system, mkfs.msdos is in the /sbin directory, which is not usually in a user’s path. So, the new command is
Create an empty floppy image of 1.44 MB:
$ /sbin/mkfs.msdos -C /path/imagefile.img 1440
Simple isn’t it? And now the fun part :P
If we need it we can create an empty image-file and mount it using linux’s loop devices.
Creating an empty floppy image: (here 1.44MB)
$ dd bs=512 count=2880 if=/dev/zero of= /path/imagefile.img
Format it:
$ mkfs.msdos /path/imagefile.img
Mounting it:
$ sudo mkdir /media/floppy1/
$ sudo mount -o loop /path/imagefile.img /media/floppy1/
Thank you Anders!
Salena Vorik pointed out here a disk image can be created in an easier way:
There’s an even easier way to do this using mkfs.msdos, skipping the need for the dd command. Also, on my system, mkfs.msdos is in the /sbin directory, which is not usually in a user’s path. So, the new command is
Create an empty floppy image of 1.44 MB:
$ /sbin/mkfs.msdos -C /path/imagefile.img 1440
Thank you Salena!
Hello
Thank you for your little howto! It was a great help for me when I needed to create a virtual diskette while installing Win98 in virtual box under Ubuntu 7.10, gutsy gibbon. While using it I saved it to disk and made some modifications to make it more readable. Here is my version, you are welcome to use it if you like.
And again, thank you.
Create, mount and copy floppy disk images..
Create a disk image from a physical diskette:
cat /dev/fd0 > /path/imagefile.img
Copy the image to a diskette:
cat /path/imagefile.img > /dev/fd0
Simple isn’t it? And now the fun part :P
If we need it we can create an empty image-file and mount it using linux’s loop devices.
Creating an empty floppy image: (here 1.44MB)
$ dd bs=512 count=2880 if=/dev/zero of= /path/imagefile.img
Format it:
$ mkfs.msdos /path/imagefile.img
Mounting it:
$ sudo mkdir /media/floppy1/
$ sudo mount -o loop /path/imagefile.img /media/floppy1/
i’ll update post though thank you very much ;)
There’s an even easier way to do this using mkfs.msdos, skipping the need for the dd command. Also, on my system, mkfs.msdos is in the /sbin directory, which is not usually in a user’s path. So, the new command is
Create an empty floppy image of 1.44 MB:
$ /sbin/mkfs.msdos -C /path/imagefile.img 1440
i’ve added this to the post
thank you!
If you mount image file with following option
$ sudo mkdir /media/floppy1/
$ sudo mount -o loop /path/imagefile.img /media/floppy1/
normal user can’t create/move/copy/delete files on it.
If you let create/move/copy/delete to normal user then you mount it with
$ sudo mkdir /media/floppy1/
$ sudo mount -o loop,umask=0 /path/imagefile.img /media/floppy1/
I don’t know if it depends on linux distro (i use upensuse)
Thanks for suggestions
yes maybe some different ways of handling mount by the distro.
thank you very much i’ll add it to the post.
This post was very helpful to me, thank you!
Neither of the listed commands purported to work on Ubuntu 7.10 seem to work (see below). What am I missing?
foo@box:~$ cat /media/disk > winBootDisk.img
cat: /media/disk: Is a directory
foo@box:~$ /sbin/mkfs.msdos -C winBootDisk.img 1440
mkfs.msdos 2.11 (12 Mar 2005)
foo@box:~$
Ubuntu doesnt fail, you most likely have to use the block device and not the mountpoint when trying to
“cat /dev/fd0 /path/imagefile.img”. if you are unsure what your block device is, insert a floppy disk and at the command line use the “df” command
[...] http://untitledfinale.wordpress.com/2007/10/09/create-mount-and-copy-floppy-disks-images-under-linux... Author: bayu Categories: Uncategorized Tags: linux, os Comments (0) Trackbacks (0) Leave [...]
> foo@box:~$ cat /media/disk > winBootDisk.img
> cat: /media/disk: Is a directory
replace the mount point you give by the device file and it will work.
i.e. $ cat /dev/fd0 > winBootDisk.img
Thank you! It’s really hope to save my old pc!:)
[...] http://untitledfinale.wordpress.com/2007/10/09/create-mount-and-copy-floppy-disks-images-under-linux... Categories: ubuntu Tags: Comments (0) Trackbacks (0) Leave a comment Trackback [...]