LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Writing to a diskette (https://www.linuxquestions.org/questions/linux-newbie-8/writing-to-a-diskette-312698/)

RJEmery 04-13-2005 04:21 AM

Writing to a diskette
 
My frame of reference is W98, and so Linux is completely foreign to me. I am experimenting with Fedora Core 3, among other distros.

1) How do I go about formatting a diskette in /dev/fd0?
2) How do I go about writing a simple TXT file to a diskette, to be reread by a) a W98 machine and b) another Linux machine?
3) How do I go about reading a file on a diskette or copying it from there to my Linux system?

scuzzman 04-13-2005 04:23 AM

You simply need to mount the diskette with a vfat (FAT32) filesystem. This will probably be as simple as this:
1) Insert the diskette
2) Type this command
Code:

mount /dev/fd0
Post back if that returns errors, preferably with the output of
Code:

cat /etc/fstab
3) It will probably be mounted automagically to a set directory -- probably /mnt/floppy
4) Copy whatever you wish to the directory it gets mounted to, then unmount the disk with this command
Code:

umount /dev/fd0
If you need more information, please post back with the output of cat /etc/fstab as mentioned above.

mugwump84 04-13-2005 08:45 AM

To format a floppy...

You will need to su into root (I've tried several pleas for help, but no response. Try adding yourself to group floppy)

Once that's done:

Code:

fdformat /dev/fd0
mkdosfs /dev/fd0

I'm using mkdosfs because I assume you want to put this floppy into a Windows Machine.

Remember:
:study: :study: :study:

RJEmery 04-13-2005 09:56 AM

Mugwump,

OK. I formatted the diskette as you suggested. I presume the 'mkdosfs' will still enable me to read/write to/from Linux systems as well as Windows systems.

Now, how do I copy to or from the diskette?

If I try "cp somefile.txt /dev/fd0", I get a message warning me about overwriting /dev/fd0. I don't think that is something I should do.

harken 04-13-2005 10:44 AM

Once you're done with formatting the floppy disk and you have a filesystem written on it, there is something else that must be done before you can write to it: mount it
Code:

su          --press Enter, enter root password, then press Enter again
mkdir /mnt/floppy
mount /dev/fd0 /mnt/floppy

Now you can write to your diskette by using
Code:

cp somefile /mnt/floppy
ls -al /mnt/floppy

instead of copying to /dev/fd0. When you're done with it, unmount the floppy with
Code:

umount /dev/fd0
And don't forget to also 'exit' the root account, which is use for all the steps above. If you want to be able to write to your diskette as a regular user, look into the 'man mount' documentation for options that can be passed to the mount command (such as umask).


All times are GMT -5. The time now is 08:24 AM.