The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]

Things look quiet here. But I've been doing a lot of blogging at dan.langille.org because I prefer WordPress now. Not all my posts there are FreeBSD related. I am in the midst of migrating The FreeBSD Diary over to WordPress (and you can read about that here). Once the migration is completed, I'll move the FreeBSD posts into the new FreeBSD Diary website.

Write protected floppies should be mounted read-only 4 January 2002
Need more help on this topic? Click here
This article has 12 comments
Show me similar articles

Backup backup backup.

Words to live by. Nobody every regretted making a backup. In preparation for my talk, I formated, labeled, and newfs'd a floppy and copied the StarOffice talk to it. I also flicked over the write-protect tab for a bit of added protection.

To test the floppy, I did this on another box:

# mount /dev/fd0 /mnt
# cp /mnt/oclug-sdd.tgz /home/dan/talks/
# umount /mnt # umount: unmount of /mnt failed: Input/output error

Hmmmm, we tried many things. umount -f /mnt didn't help. After talking to some folks in the know, we figured it out. We found this in /var/log/messages:

Jan 2 19:28:26 xeon /kernel: fd0c: hard error writing fsbn 16 of 16-18 (ST0 40<abnrml> ST1 2<write_protect> ST2 0 cyl 0 hd 0 sec 17)
Jan 2 19:28:26 xeon /kernel: fd0c: hard error writing fsbn 56 of 56-63 (ST0 40<abnrml> ST1 2<write_protect> ST2 0 cyl 1 hd 1 sec 3)
Jan 2 19:28:26 xeon /kernel: fd0c: hard error writing fsbn 240 (ST0 40<abnrml> ST1 2<write_protect> ST2 0 cyl 6 hd 1 sec 7)

That indicates the system was trying to write to the floppy and was failing because the floppy was write-protected. Ummm, but why was it trying to write? I hadn't written anything. I only copied something off the disk. What's going on?

Access time

If a file is accessed, the access time on the file is updated. That's what was being updated. That's why the system was trying to write to the floppy. Access time is useful if you are trying to find out how "used" a file is. If it's not been access in a while, why keep it around?

Consider this example:

$ touch test
$ ls -l test
-rw-r--r-- 1 dan dan 0 Jan 2 19:07 test
$ ls -lTu test
-rw-r--r-- 1 dan dan 0 Jan 2 19:07:10 2002 test
$ more test
$ ls -lTu test
-rw-r--r-- 1 dan dan 0 Jan 2 19:07:25 2002 test
$ ls -lT test
-rw-r--r-- 1 dan dan 0 Jan 2 19:07:10 2002 test

First I create a file, test. Then I view the details of the file. Then I view the time full details (T) and the access time instead of the modification time (u). Then I access the file using more and check the times again. You'll see how they change.

Work around

I was able to unmount the floppy by doing this:

  1. take out the floppy
  2. adjust the write-protect tab
  3. insert the floppy
  4. umount /mnt
The right thing

The right thing to do is to mount the floppy read-only:

mount -r /dev/fd0 /mnt

Then I went back and tried again. No problems. The unmount worked fine.

I talked to some FreeBSD developers about this problem. They helped me to find out the cause of the problem and come to the work around. Then they started talked about rewriting the fd driver to take notice of the write-protect tab.... That's an interesting example of how things change. A problem comes up. Someone decides to solve it.

FreeBSD continues to grow.


Share
Need more help on this topic? Click here
This article has 12 comments
Show me similar articles