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?

Recommended Answers

All 2 Replies

Hi,
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 !

That did it.. thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.