What is
[HPFS Gif]

Table of Contents


General Introduction to HPFS

HPFS is an installable file system (IFS), much like a CD-ROM drive. There is an HPFS driver that allows OS/2 to access HPFS volumes, and handles requests for disk access. 1 It can be used alongside of or instead of the standard FAT file systems that come with DOS or Windows 95.2

Since HPFS is an installable file system, it has many utility features already built into it, such as: disk caching, long file name support (254 char), enhanced Extended Attributes, and a HotFix feature.3

In addition to the above, HPFS also features the following:

Interestingly, HPFS is resistant to most common viri because they are designed to exploit weaknesses in FAT, such as the File Allocation Table, which don't exist in HPFS. This ought not engender a sense of uninfectability, though, due to the incredible number of new viri being created daily, there are bound to be some eventually (or even presently) that exploit the few weaknesses in HPFS. Also, if an OS/2 machine is booted up in DOS mode it immediately becomes vulnerable to all the millions of FAT viri out there.

Advantages of HPFS over FAT

If you've been conscious over the past two years and have access to at least some type of media, such as a TV or a magazine, then you know about Microsoft's new and improved super spiffy Operating System, Windows 95. OS/2 users weren't getting all that excited about Win95 because, well, OS/2 has been offering everything that Windows 95 promises and more for over 4 years.

One of the biggest negatives when comparing Win95 with OS/2, is Win95's continued support of the old (from DOS v4, circa 1988) FAT file system. Microsoft made a few changes to FAT and called it VFAT, but VFAT is plain old FAT with 32-bit file and disk access added. The Volume Label file attribute was used to "graft long filename support onto the file system." 5 So, with Windows 95 you still get all the woes of FAT, including an alarming lack of resistance to file fragmentation and an equally sickening lack of efficient disk space usage and cluster sizes on hard disks greater than 100MB.

Advan #1 -- File Linking

In FAT at the end of a file segment there is a tag pointing to the location of the next section, but at the next section there is no tag pointing back to the previous or "parent" segment. In HPFS there are tags on the parent and child file segments that point to each other. As a result, CHKDSK for OS/2 is much better at fixing errors than CHKDSK for DOS because HPFS's file linkages are two way.
6

Advan #2 -- Disk Capacity & Cluster Size

-- Figure available at Dan Bridge's site

The only seeming advantage of FAT over HPFS is that FAT is realistically installable to 26 logical drives, as opposed to HPFS's 24. The difference in the number of supported logical drives is due to floppies. Because of the relatively large size and complexity of HPFS compared to FAT it isn't practical to put it on such a small volume as a floppy.

HPFS currently supports partition sizes up to 2.2 TB, buts is restricted to 64GB in the current implementation. Support for larger partitions may become available as the need arises.

The following chart shows the obvious inefficiencies of the FAT system on larger drives. This problem is primarily a design consideration, since FAT was originally designed to run on floppy drives, not 1 GB hard drives.

Cluster sizes
FAT HPFS
1.4MB FD = .5K 1.4MB FD = .5K
100MB HD = 2K 100MB HD = .5K
1-2GB HD = 32K 1-2GB HD = .5K

Here are some examples of FAT's ineffieciency in action:

Volume in drive E is MERLIN     
 Volume Serial Number is XXXX-XXXX
 Directory of E:\

CRAP                     0 01-11-97   6:54p
        1 file(s)              0 bytes
                   1,975,320,576 bytes free

This first directory listing is of an empty FAT partition of 1,881 MB, where 1 MB=2^20 bytes.

 Volume in drive E is MERLIN     
 Volume Serial Number is XXXX-XXXX
 Directory of E:\

CRAP                     0 01-11-97   6:54p
POOP                     6 01-16-97  12:02a
        2 file(s)              6 bytes
                   1,975,287,808 bytes free

Now compare the "bytes free" on E: after adding a 6 byte file. DOS reports that the file used up 32,768 bytes. POOP is taking up one 32KB cluster.

 Volume in drive D is SPIRAL_ARM 
 Volume Serial Number is XXXX-XXXX
 Directory of D:\

CRAP                     0 01-11-97   6:54p
        1 file(s)              0 bytes
                      84,392,999 bytes free

Drive D: is an 85 MB partition (once again 1MB=2^20 bytes). What happens with the addition of a 6 byte file?

 Volume in drive D is SPIRAL_ARM 
 Volume Serial Number is 014C-08E9
 Directory of D:\

CRAP                     0 01-11-97   6:54p
POOP                     6 01-16-97  12:03a
        2 file(s)              6 bytes
                      84,390,951 bytes free

The 6 byte file, POOP, only takes up 2,048 bytes here, which is much better than the 32,768 on a 1.9 GB partition, but still four times more than would be used by the same file on the same sized partition under HPFS.

 Volume in drive A is DON'T_USE  
 Volume Serial Number is XXXX-XXXX
 Directory of A:\

CRAP                     0 01-16-97  10:20a
        1 file(s)              0 bytes
                       1,457,664 bytes free

As you can see A: is a 1.4MB floppy drive.

 Volume in drive A is DON'T_USE  
 Volume Serial Number is XXXX-XXXX
 Directory of A:\

CRAP                     0 01-16-97  10:20a
POOP                     6 01-16-97  10:20a
        2 file(s)              6 bytes
                       1,457,152 bytes free

Here, a 6 byte file only uses up 512 bytes. To be as efficient as HPFS in disk space usage and cluster sizing, FAT has to use a 1.4MB partition or smaller. Hardly realistic nowadays.

As you can see above, as FAT partitions get bigger their cluster sizes also increase. All files smaller than the cluster size, therefore, are wasting disk space. HPFS has a constant overhead of ~2.5MB due to sector size (assuming 10,000 files) wastage and 5MB for the Fnodes, totalling 7.5MB regardless of whether the HD is 10MB or 100GB. As you can see the advantages of HPFS are far greater on larger drives (above 100MB). 6

Advan #3 -- Directory Search Speed

HPFS doesn't have the limit on the number of files in the root director that FAT does (512 entries). To search for a file in FAT, assuming a maximum number of 64K entries, in FAT one would have to search through, on average, 32K entries.

HPFS maintains a BTree, which is a balanced tree file/entry structure where each "branch" of the tree is relatively equal in length. HPFS also makes use of Dnodes that are stored in contiguous 4KB blocks. These store various file information and attributes. Through the use of the Dnodes and the BTree you could find a file in a maximum of three hits (because three branches of the tree can hold 65, 640 files). 7

-- Graph available from Dan Bridge's site

HPFS access time on a directory search increases relatively linearly as number of files increases, but FAT's access time plot follows a third-order polynomial, thus increasing exponentially as number of files increases. Disk caching and Lazy writes also greatly enhance HPFS's performance.

HPFS locates a Dnode band at the middle of the cylinder, which contains information on where all the files on the disk are located, so that when doing a directory search the distance that the hard drives heads must travel is halved.

Advan #4 -- Directory & File Location and Fragmentation

Subdirectories on FAT are usually scattered all around the disk, and entries in a subdirectory may not be contiguously stored on the disk. If defrag moves all the files to the beginning of the disk, then when the user adds a new file to the hard drive there is no free space at the beginning of the disk, so fragmentation begins again. 8

HPFS does a lot of work to keep files in one piece or in the minimum number of pieces possible. Head movement time (search for file parts) is time consuming, so it's better to take a little extra time to find a good place to stick the file than to have to go looking for it later on.

Files in HPFS are stored in 8MB contiguous runs of sectors known as data bands. Each data band has a 4-sector freespace bitmap situated at the band's beginning or end. The bitmaps are placed next to each other so that there is a total of 16MB of contiguous disk space available per chunk.

Fragmentation can still occur if you're using DOS or Windows programs which weren't designed to request preallocated space. Even so, fragmentation on an HPFS partition usually doesn't exceed 1%. 9

For more advanced information on HPFS check out Part 2 of Dan Bridges article, Inside the High Performance File System.

Advan #5 -- Bad Sector Handling

HPFS sports a Hot Fix: If HPFS encounters a bad sector during a write operation it loads that information into a special sector on the next boot up the sector is marked bad and isn't ever used again. 10

Information / Tips on Having FAT and HPFS Co-Exist

Without Partition Magic, installation of HPFS over FAT requires a destructive format, and it's probably due to this that most new OS/2 users just use the "Easy Installation" option when installing OS/2, but this just utilizes FAT, which isn't as good a file system as HPFS. Consider using the "Advanced Installation", which allows you to selectively install certain parts of OS/2, to install OS/2 on an extended partition other than C:, to install Boot Manager, and to use HPFS. 11

Unlike some other operating systems, OS/2 is very friendly to other systems on the same computer, so you can get the advantages of HPFS and still make use of your other programs or systems that may not be compatible with HPFS.

If you're running Win95 you can get "Just Add OS/2" from IBM (three disks), which includes:

Not to worry, though, if you're running DOS. It is often possible to leave a small FAT boot partition, which can be read by OS/2. This is not necessary, though, because Warp comes with IBM DOS 5 built-in, but you can install other flavours of DOS if want to. You don't need to worry about whether they'll be able to read the HPFS partition when run under OS/2 because OS/2 handles all the disk access transparently. 13

If having to boot OS/2 to access your HPFS volumes is too difficult, you don't have to, because AMOS (a shareware program) allows native DOS to access HPFS drives. You might run into problems with larger HD's on older computers because some BIOS's can only read the first 1,024 cylinders on hard drives.

I found several places to download what I think is the latest version of AMOS, version 3.20. There's only one place that I found where you can download it for free (the other two require subscriptions ranging in price from US$9.00 to US$35.00). You can get AMOS320.ZIP for free from the Hobbes FTP site in the /dos directory.

I've found two different versions of AMOS on the Web. AMOS v1.11 is a command shell that allows access to both HPFS and FAT partitions. It includes some of its own commands, but also covers basic DOS file-management stuff, like MD, CD, COPY and TYPE. AMOS v3.20 is a memory-resident TSR that allows you to mount HPFS drives like "normal" drives.

The Registered Version of AMOS v1.11 allowed both read and write access to HPFS drives. AMOS v3.20 isn't CrippleWare, that is, the Unregistered Shareware version has all the features of the Shareware version. Write access hasn't been implemented in v3.20 yet.

AMOS v3.20 was written entirely in Borland Pascal v. 7.x, which has led to a rather large memory requirement to run the TSR (~40KB). Re-coding to assembler should produce trimmer code and lower memory requirements. AMOS is still listed on the Cincinnati Team OS/2 Disk Index. If you know where to find more info let me know.

Miscellaneous Information and Online References

HPFS is 16-bit code, which seems odd, since OS/2 is a 32-bit operating system, IBM states that there are few gains in the arena of file systems with 32-bit code since the limitations are mainly due to mechanical factors rather than software factors.

HPFS runs as a ring 3 task (i.e., application level) in 80x86 protected mode. There is a 32-bit version of HPFS that runs at ring 0 (kernel level) for use primarily on servers that require faster and heavier disk access.14

Until recently HFPS was not supported on removeable media (such as, Zip or Jaz drives or Bernoulli optical drives). Jeff Jackowski has developed HPFSRem which allows the use of removable media formatted for HPFS that can be removed without the associated system crash. Info at: HPFSRem Index of the Cincinnati Team OS/2 Home Page.

References & Further Reading:

  1. Warpfaq Section 1.5 -- HPFS
  2. HPFS - Part 1 by Dan Bridges
  3. HPFS - Part 2 by Dan Bridges
  4. HPFS vs. FAT
  5. HPFS Text from Microsoft Systems Journal Sept 1989 v4 n5 p1(13)

Free Tip: to find out if a partition is HPFS or FAT do a DIR on the root directory, and if you see "." and ".." dir entries then HPFS is being used.
1