Jump to content

FAT32 - Setting cluster attributes?


Recommended Posts

Been a while since I tried any programming, and I have a 98se system to experiment with, so here goes:

I want to search ONLY the free space for zeroed clusters and mark them so they show up visually in a defrag program's initial map display. Show the "clean free space" or the inverse.

So, would marking them BAD be "good"? That won't cause the IDE controller to spare-out those areas, I hope.

Since the above is in the free space, we don't have to worry about chains, but what if we wanted to highlight a particular file's layout on the disk? First of all, any utilities do that already? I've seen some defraggers show "unmovable" files. Can we toggle that attribute for any file? How about raw clusters?

Suggestions as to what development tools to use for the easily intimidated procedural thinker?

Link to comment
Share on other sites


I don't want to write a defragger (!), just USE one to display free-space clusters that I have marked because they do or don't contain data. Very simple goal. Have to read the FAT and step through all free clusters looking for things other than zero. Then if a free cluster has even one set bit, it needs to be marked temporarily such that it shows up as a different color than empty free space. A single cluster may not show up well, but that's where a log output (to a different drive) would help. To save time, once anything is encountered or the string is found, break off and step to the next free cluster. Undo would be based on the log or by just resetting any bad clusters. Most drives don't show bad clusters anyway, but we can check and log those first.

Now how is this different than a recovery program that looks for file sigs and saves contiguous or FAT-image referenced clusters to a different drive, you ask? For one, it doesn't copy anything, and second, it can operate over huge logical drives without writing to any new data areas, and it should be able to undo what it does. It provides a GRAPHICAL means to check for data structures in the free space of drives without having to write any graphics code. Should be a good starter project with a short learning curve.

Even shorter would be the marking of valid files, but I'm guessing that would be by setting a directory attribute, not touching it's FAT-chain.

Link to comment
Share on other sites

What I'm trying to say is that you just cannot 'mark' arbitary clusters and expect them to somehow 'show up' in a defragger's display. The defragger would have to recognise the marking and react appropriately.

Link to comment
Share on other sites

Unless I'm completely misunderstanding this, BAD clusters are marked in the FAT, independent of any directory or other area on the disk. The clusters themselves are not written-to.

Bad clusters are shown by all defraggers I've ever used.

If I mark some free clusters as BAD, there's no harm to valid files on the disk, and it can be undone easily.

What do I put in the FAT? Let's say just for starters I use a sector editor to change FAT entries.

What is the simplest development tool to do sector/cluster reading and manipulate the FAT? This is low-level stuff, so I don't need a full-blown feature-bloated compiler, do I ?

Link to comment
Share on other sites

Thought your bladder would've been empty by now.

Anybody else have something to contribute? This is an interesting area to explore. What are some good pages on FAT32? I'm thinking that Win32ASM might be the way to go for development of small utils like this.

Link to comment
Share on other sites

I've been playing around with DISKEDIT on the FAT of a 32GB FAT32 logical drive, and by marking unused FAT entries with the number 268435447 (0x0FFFFFF7) they show up in any defrag program as BAD clusters, and it's PERFECT for my purposes, whatever they are. :angel

DiskTune or SpeedDisk shows even a SINGLE bad cluster, no matter how you scale the window, no matter how big the drive is. I can get readouts of cluster numbers, see what files are occupying allocated clusters, look for holes and interleaved files, change the colors of the map, all in relation to the newly-marked free clusters that meet certain criteria. The tradeoff is, either I write graphics code that can do that, or use the FAT of a big drive as a free pixel map. Reduce, reuse, recycle. Plus, it's just plain subversive and wrong.

The bad clusters can be cleared like nothing ever happened.

Blasphemy, to be sure, but there it is. Let's require everybody to do it that way from now on.

I will try experimenting with DOS assembler. There's some reference stuff to look at here.

Can WDM be used for FAT/cluster work? By mere mortals, that is.

Link to comment
Share on other sites

I've been playing around with DISKEDIT on the FAT of a 32GB FAT32 logical drive, and by marking unused FAT entries with the number 268435447 (0x0FFFFFF7) they show up in any defrag program as BAD clusters, and it's PERFECT for my purposes, whatever they are. :angel
Good luck remembering where you put them, and where the real bad clusters are. Edited by LLXX
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...