On Wed Jul 29 1998, Sony Lloyd Ponton wrote:
> So, to put a ram disk on a floppy, the command was
> something like :
> dd=if ramdisk of /dev/fd0..
You seem to be confused about exactly what you want to do, and why you may
need to do it.
This is rather deep water for a newbie to linux, especially since it
involves working with raw device files.
To put a *filesystem image* onto a floppy, you can do it two ways:
dd if=filesystem.img of=/dev/fd0 count=1474560
or more simply (but with less "control"):
cp filesystem.img /dev/fd0
Note that you are copying a file into a DEVICE (/dev/fd0 - the floppy), not
just a file to another file. What will happen is that the file will get
put onto the floppy disk in a "raw state".
To extract an image *from* the floppy, you just reverse these commands, ie,
input from /dev/fd0 and output into a file.
Try it... put *any* msdos-floppy disk (bootable or not) into your floppy
drive and do this:
cp /dev/fd0 msdog.img
You'll end up with a file called msdog.img with a size of 1474560 bytes.
Now (if you have a loop device capable kernel) you can do this:
mkdir msdog
mount -t msdos -o loop msdog.img msdog
ls -l msdog
This will actually mount that file as a filesystem onto the directory point
"msdog", and the ls command will show you what's on it - and it should be
*exactly* the same as what's on the original floppy disk. Magic, eh? :)
Note that you have complete read/write access to that image. Do what you
want to do to it, copy it back to another floppy disk, and you then have an
EXACT copy of the original disk (including the "id/vol" number - so beware)
except for the changes you might have made to the image.
This is how dosemu can work under linux without the need to have an actual
msdos filesystem on a partition - it can use a file *image* instead!
Powerful stuff.
You can also do the same thing to a hard drive partition or even a cdrom!
(Heh, if you have the hard drive space:) If you have a cdrom burner and
want to copy a cdrom, then the simple part is getting the actual image that
needs to put burned.
You can do the same for an ext2 filesystem images. It's easy to use dd to
create a file of any size full of zero bytes, "mke2fs" it, loop mount it to
do things with it, then finally copy it onto a floppy disk.
Now, to put a *ramdisk* filesystem onto a floppy, it is a but more
complicated. You need to copy a bootable kernel onto the floppy,
then the filesystem image to it as well (with an offset from the beginning
of the floppy to avoid over-writing the kernel). But first you need to
actually *contruct* the filesystem image! This involves things like
loop-mounting a filesystem image etc. And then you can compress the
ramdisk image before writing it to a linux-boot disk since the kernel knows
how to uncompress them on the fly before loading it into ram. And so on.
There is a bootdisk HOWTO that you should read. Then check out utilities
like YARD that automate much of the gunt work for you.
Cheers
Tony