I have a need to make my own .img file that can be mounted as a virtual diskette, but I do not know the command I need to use to do so. I've looked briefly at the man page for dd, but I can't tell if this can be used to do what I need, nor how to do it, even if it is the correct tool.

I just need to make a normal fat12 filesystem within a disk image, with custom files in it. How might I go about this?

7 Years
Discussion Span
Last Post by agent154

Let us say you want to create a 10 Mb file system. Use dd to create a virtual disk image first.
Example - "dd if=/dev/zero of=/tmp/my.img bs=1k count=10000"
That will create a image file of size 10 Mb ~ approximately (1k * 10000)
Now to make it a FAT12 file system, use the command mkfs.vfat (or an equivalent tool in your distro like mkdosfs)
Basically, "mkfs.vfat -F 12 /tmp/my.img" (more parameters may be required) should format the virtual image as FAT12
Be careful that you do not destroy any critical data by mistake when using these commands.
Good luck !

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.