HPFS v. FAT: A Little More Info- by Heath Phillippi

From the beginning, OS/2 was created as the next step after DOS. The original designers sat down and found all the faults and weaknesses in DOS, then looked at ways to improve these. One of the best results of this was HPFS. HPFS was built from the ground up with large hard disks, speed, and stability in mind.

HPFS is an installable file system, just like a CD-ROM. It has a driver that loads and enables OS/2 to read and write to an HPFS volume. Because HPFS is an installable file system, many features are built in, instead of only being supported by third party utilities (like FAT). Some of these features include: resistance to fragmentation, built in caching, long file names (254 characters long), enhanced extended attribute support, and a Hot Fix feature.

Because of the way HPFS stores files, it has a built in resistance to fragmentation. When you originally write a file to disk, HPFS assumes you will want to add more to it later. So it adds a little blank space at the end of the file for just such an occurrence. It also handles free space differently. In FAT, addresses for free space are located in a single list. HPFS makes a "map" of free space that can be searched much quicker.

All files and directories on an HPFS drive are stored in a Binary Tree fashion, compared to FAT's flat file structure. Since FAT was originally designed for floppy disks with only a few files on them, it starts to loose efficiency on larger hard disks. HPFS, on the other hand, was designed for large disks and doesn't have this problem.

Suppose you have a file cabinet with no labels on the drawers. When you create a new file, you stick it at the end of the last drawer. If you have to add to an old file, you stick a note with the original file telling it where to look for the rest of the file. Whenever you need a file, you start looking in the top drawer and keep looking, top down, until you find it. This is how FAT stores and finds files. While this may be alright for one or two drawers, what happens when you get four or eight? Or a hundred?

HPFS is like putting labels on the drawers. When you create a new file, you leave a little extra room in the drawer for additions later. When searching for an old file, you no longer need to look through drawers one and two to get to three, you just jump there. When dealing with larger numbers of files, the advantages start adding up, the most important being SPEED.

Another advantage of HPFS on large hard disks is a set sector size. No matter how big the drive, HPFS always has a sector size of 512 bytes. FAT's sectors, on the other hand, range anywhere from 512 bytes to 32000 bytes. On a 512 meg drive the sector size is around 8000 bytes, and on a 1 gig drive the sector size is 16000 bytes!

This leads to major inefficiency and wasted space. Take a look at your current drive, how many files are under 16K or just slightly above? Each one is taking space in multiples of 16k, whereas on an HPFS partition these files are taking up space in multiples of 512 bytes, or 1/2K.

One other bonus of HPFS is that it is resistant to most common virii. Because most virii exploit weaknesses in FAT, they simply fail when they try to infect an HPFS drive. Don't let this give you a false sense of security, though. Many new virii are created monthly, and you can bet some of them will eventually be HPFS aware.

HPFS also automatically caches information being written and read from the hard drive. The line which starts the HPFS driver has a switch for cache size (/CACHE:xxxx). Standard HPFS has a maximum cache size of two meg.

Since HPFS has caching built in, the designers decided to go one step further and added a Hot Fix feature. If, while writing data to the drive, HPFS detects a problem with a sector, it stores the data to an area set aside for just such an occasion. Then, upon the next boot up the sector is marked bad permanently. So instead of waiting until you can't read data from a bad sector (like FAT) HPFS never even writes data to it.

Another downfall of fat is the 8.3 naming convention. HPFS allows file names up to 254 characters long, containing multiple periods, spaces, dashes, etc. One caveat, though: try to avoid spaces in names of any files you plan to access to from the command line. To specify a file with spaces from the command line you will have to put the name in quotes ("") in order for OS/2 to recognize it as one file and this can get a little tedious.

One last major enhancement of HPFS is its handling of Extended Attributes. OS/2's Extended Attributes can store up to 64k of information about a file. This can be information about the file's icon, search keywords, or just about anything else you or the programmer want to store about the file.

EA's are stored in a central database on a FAT partition, with a small pointer at the end of the file. All these pointers leave a lot of room for disaster if a something destroys the central database. HPFS on the other hand, stores the EA's on a per file basis. This means if one file's EA's get corrupted, all files are not necessarily affected.

Send a letter to the editor.


Contents | Back to Heath's Tips


This page is maintained by Haligonian Media. We welcome your suggestions.

Copyright © 1995 - Haligonian Media