I am having this strange problem with a FAT partition a in large disk. It is a 
long story. At first, you'll see me talk a lot about NetBSD, but the problem 
also occurs with OpenBSD.


My 120-Gb disk
--------------------

I had OpenBSD and NetBSD in the beginning of a 120-Gb hard disk. They were 
followed by a couple of Linux partitions and a few FAT32 partitions. These 
FAT32 partitions were labeled D:, E:, F: and G: in Windows. Here is a tree-like 
explanation:

Windows 98
BSD
---- extended ----
Linux
Linux swap
Linux
FAT32: D
FAT32: E
FAT32: F
FAT32: G (20 Gb)

I know I wrote data to D: and E: with OpenBSD (not NetBSD IIRC). But I don't 
remember ever writing to the G: partition, the last one in the disk. Except for 
one time.

I was quite satisfied with OpenBSD, but wanted to give NetBSD another try, a 
few months after giving up on it. I didn't have extra space, so I deleted 
OpenBSD to install NetBSD. Actually, I can't really say that I *used* OpenBSD 
or NetBSD. I just had them installed so I could learn about them. I spent most 
of the time reading man pages and experimenting a little.

Before installing NetBSD, I made a "netbsd" directory in my G: partition (20 Gb 
in size) while running Windows 98. I downloaded many binary packages into that 
directory so I could install them in NetBSD.

When I installed the binary packages, already running NetBSD, I had an idea: I 
created a sub-directory named "gone" and, as I installed the packages, I moved 
them to the "gone" folder. So this "gone" folder was created with 'mkdir' in 
NetBSD. After some time, that "gone" directory had at least 30 or maybe even 
100 files.

A few hours later, I was in Windows 98 again and, for some reason, wanted to 
check something in that folder. Surprise: the "gone" folder appeared empty from 
Windows! Where had all the files gone? I booted into NetBSD and everything was 
still there! Only Windows 98 couldn't see it. Weird

Anyway, I just moved everything to a 160-Gb hard disk. And it got worse.


My 160-Gb disk
--------------------

With a bigger disk, I decided to have both NetBSD and OpenBSD:

Windows 98
OpenBSD
NetBSD
---- extended ----
Linux
Linux swap
Linux
FAT32: D
FAT32: E
FAT32: F
FAT32: G (40 Gb)

The last partition got a lot bigger too. Twice as big.

As soon as I had my 160-Gb disk in place, I started with NetBSD, because it is 
easier to install than OpenBSD. Once again, I made a "netbsd" directory in my 
G: partition (now 40 Gb in size). Don't forget: this directory was created in 
Windows 98. All over again, I downloaded many binary packages into that 
directory so I could install them in NetBSD. And when I installed them, I 
created a sub-directory named "gone" for the packages that had been installed 
already. And once again, this "gone" folder was created with 'mkdir' in NetBSD. 
Time to check the mysterious disappearance of the "gone" folder's contents. I 
booted into Windows and, hey, everything was there!  : -)

But not so fast. I made a stupid mistake with NetBSD and decided I wanted to 
format its partition and reinstall from scratch. OK. Then I tried to install 
all the binary packages from that G: partition again. NOT OK! NetBSD installed 
some packages, but most failed. NetBSD told me they were "invalid" and 
"probably not a package"! What the hell? So I installed all the packages again, 
but now downloading them through FTP. So many of the packages in that directory 
were replaced with new copies while I was in NetBSD.

I booted into Windows again. I saw the "gone" folder. When I opened it, YIKES! 
Hundreds of folders with totally messed up names! And the status bar said the 
folder contained some 220 Gb! That was really ugly.

So I booted into Linux and inspected the folder. Everything looked normal! I 
even opened some of the files. So what is the culprit? Windows 98? My new hard 
disk? NetBSD? Like I said, it is a long story

Looking for the culprit
----------------------------

I could not delete those strangely named files and folders. Windows 98 won't 
handle them. I ran Scandisk on the G: partition. That was not a good idea 
either. Scandisk detected errors, but messed up many other files and folders in 
G: so badly that I would have lost everything if I didn't have backups. I 
decided to reboot into NetBSD and delete those bad folders from there. I could 
not. Now NetBSD refused to boot because it wouldn't find the "/usr" partition's 
superblock. Oh boy.

At that point, two bad thoughts crossed my mind:

1) I had made some very bad mistake when I partitioned the disk.

2) Disks have some sort of extra "buffer zone" that is used to make for bad 
clusters. The disk automatically remaps bad clusters to some part of that extra 
area and provides the illusion that the entire disk is sane. Maybe there was 
some sort of "cross-reference" between two areas of the disk that was making 
NetBSD corrupt G: and, conversely, changes written to G: corrupt the NetBSD 
area. I don't know. I was guessing a lot.

So I booted into Linux and inspected the folder again, after the Scandisk 
fiasco. I could see some damage, but not as bad as it looked from within 
Windows 98. So I deleted almost everything with Linux. Then the next thing I 
did was copy some files and folders from Linux to the G: FAT32 partition. I 
also mkdir'ed a couple of folders and touch'ed a few files.

Boot into Windows. Saw and opened files: everything normal! Linux did not cause 
any damage.

I formatted G: again, from DOS, with slow formatting. Repeated all tests. Same 
results. Ugh!

That encouraged me to rule out disk defects for the time being. Obviously, 
neither Windows nor Linux ever caused any problem. Only NetBSD did. Wait. Only 
NetBSD? What will happen if I try to write data to that disk with OpenBSD?

Well, the short answer: ALL THE SAME trouble happens when I write data to that 
partition with OpenBSD. I get hundreds of strangely named folders when I 
inspect the folder with Windows 98, but a very normal and sane listing when I 
inspect the folder with Linux.

Then I ran a few more tests and found out something interesting. Nothing wrong 
happens when I write data to the D:, E: and F: partitions with NetBSD or 
OpenBSD! Only the G: partition is susceptible. And since it is a long reading, 
let me remind you: it happened in the 120-GB disk and now it happens in the 
160-Gb.

Even so, I decided it was time to check the disk again. First I ran Scandisk 
with a full check, surface checking etc. Then I ran Partition Magic. It is a 
very old version, but the infinite times it takes to format a partition suggest 
that it does quite a lot of checking. Not a problem found. Damn. I went 
further. I decided to repartition everything. Instead of cfdisk and QtParted, 
this time I used my copy of Partition Magic. It is very old, but heck, it never 
failed me before. I created one partition at a time. Slow formatting and 
checking. I even changed some partition sizes, i.e. changed the position of 
partition boundaries. I was resorting to superstition already.

I reinstalled NetBSD. Then OpenBSD. Arf! Another problem. When I try to install 
OpenBSD with NetBSD already present, OpenBSD detects NetBSD's disklabel and 
won't let me create its own. The only option I have is overwriting that 
disklabel. Sigh Whatever. I tested a little with NetBSD, removed NetBSD and 
installed OpenBSD.

The test: I copied a couple of HTML folders to D:, E:, F: and G:. Same thing 
all over again: the D:, E: and F: partitions are okay, but G: throws a horrible 
fit whenever I write to it with NetBSD or OpenBSD. And this time I am testing 
with an empty G: partition. So instead of writing to "the middle" of the 
partition, now I am writing data to the very beginning of it. I really don't 
think there is anything wrong with this disk anyway.

OK, so here is a summary of the problem with that last FAT32 partition:

Write with              Read with               Result
--------                        --------                        --------
Windows 98              Windows 98              OK
Windows 98              Linux                   OK
Windows 98              Net/Open BSD    OK

Linux                   Linux                   OK
Linux                   Windows 98              OK
Linux                   Net/Open BSD    OK

Net/Open BSD    Linux                   looks OK

Net/Open BSD    Windows 98              garbled files and directories

Net/Open BSD    Net/Open BSD    looks OK at first, but I had 
                                                problems reading binaries back  
                                        from that partition and installing them.


Epilogue
------------

And this is the end of my story, at least for a while. Now I hope that someone 
can:

- give me suggestions to find out what the problem is and maybe solve it 
completely, short of avoiding that partition altogether when running OpenBSD or 
NetBSD;
- run a similar test and confirm that it does not happen to me only;
- not crack silly jokes or throw in derisive comments because I still use 
Windows 98 - I've heard a lot of them already and none of them has changed my 
needs or preferences;
- instruct me on the best course of action in case this actually proves to be a 
bug in the BSDs' kernels - which I find unlikely but not impossible.

At any rate, I wish to thank everyone that was kind and patient enough to read 
the entire lengthy account of my problems.

A little more information follows:

Machine: i386 - Sempron 2.2
Disk: Seagate ST3160021A (160 GB)
Operating systems: Windows 98 SE, NetBSD 2.0.2, OpenBSD 3.7 and Slackware Linux 
10.2.

Disklabel and dmesg obtained from OpenBSD:

http://tinyurl.com/93thb

http://tinyurl.com/7wwdg

Reply via email to