Package: mount, umount, udev, kernel-2.6.32-5-686
Distribution: Debian 6.0.2.1-i386-DVD, Updated to Debian 6.0.3-i386-DVD, Using
Debian 6.0.3-i386-Update-DVD-Volumes 1 and 2
Hardware: MSI MS-7108 Motherboard with Intel Pentium 4, LGA 775, 3.0 GHz, Dual
Processor CPU,
Intel 848P, ICH5, 2 GB of 400 MHz DDR SDRAM, Floppy drive, 8 USB 2.0 ports (USB
1.1 compatible)
Files: <sys/mount.h>
Follow-up III: Here is how to read and write LINUX or MS-DOS or other kinds of
floppies without mounting
the floppy device, as mount always fails to mount it while behaving as if it
has mounted it.
To read an MS-DOS floppy:
1) Make sure that the write-protect tab on the floppy is set to read-only.
2) Insert the floppy into the floppy drive.
3) Execute the following commands in the order given. The text in paranthesis
between the commands are my
comments, as needed.
(First, list the directory I will use as the floppy image mount on the local
system: It has a file in it, but this
does not matter as will be shown. The file will not be lost in LINUX.)
root@yg-pc-linux:~# ls -tal /media/floppy0
total 12
drwxr-xr-x 2 root root 4096 Nov 12 17:55 .
-rw-r--r-- 1 root root 3339 Nov 12 17:55 BIOS_ODDLY_READ
drwxr-xr-x 14 root root 4096 Nov 11 13:36 ..
root@yg-pc-linux:~#
(Make sure that the "loop" module is loaded into the kernel. The word "FATAL"
is produced should the module
be already loaded, and I have asked for a first time load check:)
root@yg-pc-linux:~# modprobe --first-time loop
FATAL: Module loop already in kernel.
root@yg-pc-linux:~#
(Now, read the entire structure of the floppy disk in the disk drive into a
local file. The local file is called
"floppyImage_1", in this example. You can give a different name for each
floppy you have read in. You can
save these images as they are the ideal floppy disk back-ups. To read them
again will not wear the floppy
disk out.)
root@yg-pc-linux:~# dd if=/dev/fd0 of=floppyImage_1
2880+0 records in
2880+0 records out
1474560 bytes (1.5 MB) copied, 48.4048 s, 30.5 kB/s
root@yg-pc-linux:~#
(Get the name of the first available "loop" device:)
root@yg-pc-linux:~# losetup -f
/dev/loop0
root@yg-pc-linux:~#
(Associate this loop device with the image of the floppy we have just read in:)
root@yg-pc-linux:~# losetup /dev/loop0 floppyImage_1
root@yg-pc-linux:~#
(Mount the loop device on to the mount directory I have wanted:)
root@yg-pc-linux:~# mount -t vfat /dev/loop0 /media/floppy0
root@yg-pc-linux:~#
(List the directory just mounted. It should show only the floppy contents:)
root@yg-pc-linux:~# ls -tal /media/floppy0
total 1339
drwxr-xr-x 14 root root 4096 Nov 11 13:36 ..
-rwxr-xr-x 1 root root 1053385 Nov 9 03:08 DSC00018E.jpg
-rwxr-xr-x 1 root root 101394 Nov 9 02:15 DSC00018B (2).jpg
-rwxr-xr-x 1 root root 101394 Nov 9 02:15 DSC00018B (3).jpg
-rwxr-xr-x 1 root root 101394 Nov 9 02:15 DSC00018B.jpg
drwxr-xr-x 2 root root 7168 Dec 31 1969 .
root@yg-pc-linux:~#
(Copy the contents of the floppy into the (for example) local directory:)
root@yg-pc-linux:~# cp /media/floppy0/* .
root@yg-pc-linux:~#
(List the current directory for the relevant files just copied in to make sure
that they are there:)
root@yg-pc-linux:~# ls -tal DSC*
-rwxr-xr-x 1 root root 101394 Nov 17 13:20 DSC00018B (2).jpg
-rwxr-xr-x 1 root root 101394 Nov 17 13:20 DSC00018B (3).jpg
-rwxr-xr-x 1 root root 101394 Nov 17 13:20 DSC00018B.jpg
-rwxr-xr-x 1 root root 1053385 Nov 17 13:20 DSC00018E.jpg
root@yg-pc-linux:~#
(Now, unmount the loop device, and release the association with the floppy
image file:)
root@yg-pc-linux:~# umount /dev/loop0
root@yg-pc-linux:~# losetup -d /dev/loop0
root@yg-pc-linux:~#
(Check the mount directory, which is now released. It should have all of its
previous contents:)
root@yg-pc-linux:~# ls -tal /media/floppy0
total 12
drwxr-xr-x 2 root root 4096 Nov 12 17:55 .
-rw-r--r-- 1 root root 3339 Nov 12 17:55 BIOS_ODDLY_READ
drwxr-xr-x 14 root root 4096 Nov 11 13:36 ..
root@yg-pc-linux:~#
(And, it does. No bugs in the system in that department...)
And now, to WRITE into an existing MS-DOS floppy:
1) Do this only when you absolutely need it. It will change the floppy disk
surface data, but the floppy will be
readable and may be writable by MS-DOS. Microsoft Windows Vista may not be
able to format (hence
losing all the data on it) this floppy unless you ask it to make a bootable
MS-DOS formatted floppy.
You can then re-format it into an un-bootable one if you so desire.
2) Make sure that the write-protect tab on the floppy is set to read and WRITE.
3) Insert the floppy into the floppy drive.
4) Execute the following commands in the order given. The text in paranthesis
between the commands are my
comments, as needed.
(First, list the directory I will use as the floppy image mount on the local
system: It has a file in it, but this
does not matter as will be shown. The file will not be lost in LINUX.)
root@yg-pc-linux:~# ls -tal /media/floppy0
total 12
drwxr-xr-x 2 root root 4096 Nov 12 17:55 .
-rw-r--r-- 1 root root 3339 Nov 12 17:55 BIOS_ODDLY_READ
drwxr-xr-x 14 root root 4096 Nov 11 13:36 ..
root@yg-pc-linux:~#
(Make sure that the "loop" module is loaded into the kernel. The word "FATAL"
is produced should the module
be already loaded, and I have asked for a first time load check:)
root@yg-pc-linux:~# modprobe --first-time loop
FATAL: Module loop already in kernel.
root@yg-pc-linux:~#
(Now, read the entire structure of the floppy disk in the disk drive into a
local file. The local file is called
"floppyImage_1", in this example. You can give a different name for each floppy
you have read in. You can
save these images as they are the ideal floppy disk back-ups. To read them
again will not wear the floppy
disk out.)
root@yg-pc-linux:~# dd if=/dev/fd0 of=floppyImage_1
2880+0 records in
2880+0 records out
1474560 bytes (1.5 MB) copied, 48.4048 s, 30.5 kB/s
root@yg-pc-linux:~#
(Make a copy of the floppy image just read in. I will use only the copy. One
has a backup this way, should
something go wrong...)
root@yg-pc-linux:~# cp floppyImage_1 floppyImage_1w
root@yg-pc-linux:~#
(Get the name of the first available "loop" device:)
root@yg-pc-linux:~# losetup -f
/dev/loop0
root@yg-pc-linux:~#
(Associate this loop device with the image of the floppy we have just read in:)
root@yg-pc-linux:~# losetup /dev/loop0 floppyImage_1w
root@yg-pc-linux:~#
(Mount the loop device on to the mount directory I have wanted:)
root@yg-pc-linux:~# mount -t vfat /dev/loop0 /media/floppy0
root@yg-pc-linux:~#
(List the directory just mounted. It should show only the floppy contents:)
root@yg-pc-linux:~# ls -tal /media/floppy0
total 1339
drwxr-xr-x 14 root root 4096 Nov 11 13:36 ..
-rwxr-xr-x 1 root root 1053385 Nov 9 03:08 DSC00018E.jpg
-rwxr-xr-x 1 root root 101394 Nov 9 02:15 DSC00018B (2).jpg
-rwxr-xr-x 1 root root 101394 Nov 9 02:15 DSC00018B (3).jpg
-rwxr-xr-x 1 root root 101394 Nov 9 02:15 DSC00018B.jpg
drwxr-xr-x 2 root root 7168 Dec 31 1969 .
root@yg-pc-linux:~#
(Put an additional file in the floppy contents directory, making sure that it
will fit the floppy disk:)
root@yg-pc-linux:~# cp readMSDOSFloppies /media/floppy0
root@yg-pc-linux:~#
(List the floppy contents directory to make sure that the file copied is there:
)
root@yg-pc-linux:~# ls -tal /media/floppy0
total 1341
drwxr-xr-x 2 root root 7168 Nov 17 13:29 .
-rwxr-xr-x 1 root root 1588 Nov 17 13:29 readMSDOSFloppies
drwxr-xr-x 14 root root 4096 Nov 11 13:36 ..
-rwxr-xr-x 1 root root 1053385 Nov 9 03:08 DSC00018E.jpg
-rwxr-xr-x 1 root root 101394 Nov 9 02:15 DSC00018B (2).jpg
-rwxr-xr-x 1 root root 101394 Nov 9 02:15 DSC00018B (3).jpg
-rwxr-xr-x 1 root root 101394 Nov 9 02:15 DSC00018B.jpg
root@yg-pc-linux:~#
(Now, unmount the loop device, and release the association with the floppy
image file:)
root@yg-pc-linux:~# umount /dev/loop0
root@yg-pc-linux:~# losetup -d /dev/loop0
root@yg-pc-linux:~#
(Check the mount directory, which is now released. It should have all of its
previous contents:)
root@yg-pc-linux:~# ls -tal /media/floppy0
total 12
drwxr-xr-x 2 root root 4096 Nov 12 17:55 .
-rw-r--r-- 1 root root 3339 Nov 12 17:55 BIOS_ODDLY_READ
drwxr-xr-x 14 root root 4096 Nov 11 13:36 ..
root@yg-pc-linux:~#
(And, it does. Now, write entire new floppy image onto the actual floppy disk.
Check to make sure that
this is really what you have wanted to do before pressing the "Enter" key at
the end of the line. It does work
as described...)
root@yg-pc-linux:~# dd if=floppyImage_1w of=/dev/fd0
2880+0 records in
2880+0 records out
1474560 bytes (1.5 MB) copied, 121.014 s, 12.2 kB/s
root@yg-pc-linux:~#
(Now, one can take the floppy disk out of the floppy disk drive and check it on
an MS-DOS system, should one
so desire... It works...)
-- Yekta
Yekta Gursel, Ph. D.
Address:
5444 Baldwin Avenue
Temple City
California, 91780-2624
Phone: (626) 454-4029
E-mail: [email protected]