RE: Formatting a file with mkfs.msdos
On Mon, 17 Aug 1998 10:39:25 -0700, Bob McGowan wrote:
>But, let me make a few comments, which may help answer the question
>anyway.
Or, at the very least, explain a few things to people who didn't know
that before.
>Anything with "mkfs" as part of its name generally refers to a tool
>used to build a filesystem. In the DOS world this is what "format"
>does.
And mkfs is short for "make file system."
>Files, on the other hand, "live" in the file system. So using an
>"mkfs" on a file does not quite make sense (unless you are using the
>word "file" in the VERY general sense of an item in the file system,
>which, in UNIX style systems, includes the names refering to disk
>devices).
Sure it does. Try this example:
dd if=/dev/zero of=/somefile bs=1024 count=8000
mkfs -t ext2 /somefile
It will complain that it isn't a block device and ask if you're sure. If
you are it will then format the file just fine. There, you have an 8Mb file
with a valid ext2 file system on it. You just formatted a file. ;) To
verify that make sure you have loopback support compiled into your kernel
and...
losetup /dev/loop0 /somefile
mount /dev/loop0 /mnt
Of course, if you use the losetup first and mkfs on /dev/loop0 instead of
the file, it doesn't complain that it isn't a block device.
My problem is I want to get the FAT formatting onto a file (disk image
may be a better word) that is 20Mb large so I can mount it under DOSEMU. Why
do it that way, you ask? Simple, I don't have any room on my current HDs to
make a real DOS partition and by doing it this way I can delete it later on
down the road. The problem is, mkfs.msdos (or mkfs -t fat) cannot find the
geometry of the drive (file) even when it is hooked up through a loopback
device.
--
Steve C. Lamb | Opinions expressed by me are not my
http://www.calweb.com/~morpheus | employer's. They hired me for my
ICQ: 5107343 | skills and labor, not my opinions!
---------------------------------------+-------------------------------------
Reply to: