Hard Disk Partitioning
How and Why (or Why Not)
for MS-DOS/Windows PCs
How and Why (or Why Not)
for MS-DOS/Windows PCs
Summary: This page explains reasons why you might want to partition your hard disk, and reasons why you might not want to. If you decide to proceed, it shows you how to partition your disk without buying more software. Primary relevance is to Windows 9x, as opposed to Windows NT and its successors.
page was originally written in the days when Windows 3.1 was the
cutting edge of new technology. While I have updated it considerably
since then, it's definitely showing its age. But every time I remove
it, I get a lot of e-mail requests to bring it back, so here it is.
My thanks to Sandy Archer for giving it Web space.
I can't help with questions about specific models of hard drive and specific operating systems. Your best bet is to post a question to the Usenet newsgroup that deals with your specific hardware or operating system.
You're welcome to print copies of this page for your own use, and to link from your own Web pages to this page. But please don't make any electronic copies and publish them on your Web page or elsewhere.
And for the litigious among us: The information here is offered without warranty of any kind. Sigh.
In the following situations, cluster size is not a worry, though you may want to partition your hard disk for other reasons:
with FAT32 under Windows 95 or 98. The FAT32 file system features 4 KB clusters (8 KB by default for disks of 8 to 16 GB), so you won't be wasting enough space to make partitioning worth while. Windows 98 lets you choose the FAT32 file system, both in full install and in upgrading from Windows 95. Windows 95 OSR2 (distributed on most new PCs starting mid-1998) also lets you choose FAT32. Under Windows 95 or 98, right-click a drive in Explorer and select Properties to find out whether it has FAT32.
with DRVSPACE, DBLSPACE, or a similar product. As far as the operating system is concerned, such a partition is just one big file. Cluster size has no significant effect on the space used by a compressed volume. (Actually, some doubts have been raised on this point. According to Gordon Fecyk in his Windows 95 FAQ, the cluster size of a compressed volume in Win95 is 512 bytes. This means that there will still be some wasted space, but less than on an uncompressed partition 67 MB or larger.)
with Windows NT and Windows 2000 (which is NT-based). I understand that in Windows NT the user can set the cluster size within certain limits. This means that cluster size need not depend on partition size (as it does for DOS and the other versions of Windows). However, wasted space still depends on cluster size in Windows NT partitions, as explained in this article.
in OS/2: according to PC Magazine, OS/2 clusters are always 512 bytes.
Some users prefer disk compression utilities like DoubleSpace. Such programs will probably save you more space than partitioning your disk. But I'm a suspicious sort and don't trust any compression program more complicated than ZIP; I've heard enough reports of problems with the disk compression software to make me stay away from it.
ZIP and UNZIP from Info-ZIP are freeware (not shareware). File formats are identical to PKZIP format. You can download copies from the Info-ZIP home page at <http://www.info-zip.org/pub/infozip/>.)
Allocation by clusters means some space on the disk will be wasted. Regardless of the actual length of a file as reported by the DIR command, the file will actually occupy a whole number of clusters on the disk. So a 1-byte file will actually use a whole cluster, a file that's 1 cluster plus 1 byte long will use 2 clusters, and so on. You can read the math in appendix 2 if you like, but the bottom line is that, on average, an average file will waste an amount of space on your hard disk equal to half a cluster.
Is this serious? It can be, depending on the pattern of file sizes on your disk. For instance, if you have a traditional FAT 800 MB disk with 3,000 files on it, about 25 MB of your disk is being wasted. And the figures can be much worse, depending on the pattern of your usage. One user reported copying 450 MB of files to a 1.6 GB disk and having them take up 600 MB! As your disk approaches being full, you may wish you could squeeze some extra space out of it instead of buying a new disk.
By the way, there is a utility that will examine your disk and compute wasted space for you. WASTED is a small program (30,733-byte ZIP file) that runs under MSDOS or in a DOS window under Windows and computes the amount of wasted space at your current partition size and for other possible partition sizes. It's freeware. Though I haven't seen the source code and so can't verify the calculations, the report seemed reasonable when I tried WASTED on my disks.
I know of two other WASTED-type utilities available at Simtel, wastdv and wastre. I haven't tried out either of them myself. File names at Simtel change as new versions are released, so if you can't retrieve those particular files, try searching in the directories.
Here are the cluster sizes for various disk sizes; you can read the math in appendix 1 if you're interested. A megabyte means different things: Microsoft calls 1024 times 1024 = 1,048,576 bytes a megabyte, but hard disk manufacturers tend to inflate their nominal capacities a bit by calling 1,000,000 bytes a megabyte. In the table I use the Microsoft definition because that's what you'll have to use in entering your choices to FDISK.
|disk size in bytes||cluster size|
|up to 128 MB||134,217,728||2 KB|
|256 MB||268,435,456||4 KB|
|512 MB||536,870,912||8 KB|
|1024 MB||1,073,741,824||16 KB|
|2048 MB||2,147,483,648||32 KB|
|over 2048 MB||64 KB|
firstname.lastname@example.org, Windows NT partitions have configurable cluster size, 512 to 4096 bytes. This means that you can use the information in this article to calculate probable wasted space based on a cluster size you choose. You don't have to select a partition size based on a desired cluster size.
I haven't tried Windows 2000, but since it's really Windows NT 5.0 the preceding paragraph probably applies.
Even so, you may be inclined to think this is no big deal. But think about it: if you have a 1080 MB drive with 5,000 files, you're probably wasting about 80 MB (5000 times 16,384 bytes which is half the cluster size).
Compressed volumes: The following warning comes from Microsoft's application note PD0771:
Warning: If you are using software such as Disk Manager, SpeedStor, Priam, or Everex to replace the BIOS in interactions between MS-DOS and the hard disk controller, do not repartition your hard disk with the MS-DOS Fdisk program. Instead, use the disk-partitioning program you originally used to partition your hard disk.
To determine whether you have one of these disk-partitioning programs on your computer, search for the following files: DMDRVR.BIN (Disk Manager), SSTOR.SYS (SpeedStor), HARDRIVE.SYS (Priam), and EVDISK.SYS (Everex). If you need help in repartitioning your hard disk or are unsure whether the BIOS is being replaced, contact the manufacturer of your original disk- partitioning software.
Windows 95 driver bugs:
If you have an Enhanced IDE disk larger than 504 MB, and you'll be using the Win95 version of FDISK, you should read Microsoft's description of a bug in the Win95 drivers, which includes a fix that you can download and install.
As of 1998-11-18, you could find that information at <http://www.microsoft.com/windows/downloads/contents /Updates/W95DiskType/default.asp>. Unfortunately, Microsoft reorganizes its site several times a year, and I have given up on trying to stay abreast of the URL changes. You may want to try searching Alta Vista or another search engine for the string "Disk Type Specific Driver Update" (with the quotes), or you can pick up the information from this non-Microsoft site:
(Disclosure: I haven't needed to try the fix, because I created my partitions using an earlier version of FDISK.)
Long file names (Windows 95 or 98 users):
If you're running Windows 95 or 98, and you have some long file names, make sure you have a version of backup software that will treat those names correctly on both backup and restore. (If you use a DOS-based backup program, as I did until recently, you can use a utility like DOSLFNBK to save and restore the long filenames.)
I don't partition a hard disk often: every year or so. I prefer to use FDISK because it's free, and that's what I recommend to everyone who asks.
If you partition frequently, or you want a slick graphical interface with lots of options, you may prefer one of the shareware or commercial partitioning utilities. Note! I have not tried any of them, and therefore nothing I say should be taken as an endorsement or criticism of any of them. If you choose to buy such a utility, at least make sure before you pay for it that it will adjust cluster size. Why pay money for something that does no more than FDISK?
(In the past I linked to the home page of a popular partitioning utility, for the convenience of people who might want to investigate it. The problem is that people who preferred a different one kept e-mailing me to get me to list their choice; and even partisans of the one I listed kept e-mailing me with testimonials, for reasons that I suppose seemed good to them. I no longer link to any partitioning utility under any circumstances, because I continue to prefer using FDISK -- not because it's wonderful, but because it's free and I can't see spending money for simple software that I use less than once a year.)
The following procedure will use FDISK to partition your hard drive.
Example: I divided my 1080 MB Western Digital drive (1080 MB nominal; 1033 MB according to FDISK) into three partitions of 453, 453, and 126 MB. The first two then have 8 KB clusters and the third has a 2 KB cluster, versus 32 KB clusters for the unpartitioned drive. This reduced wasted space to 16.6 MB (5.2 %) from 70.8 MB (22.0 %), and increased the number of files that the disk could hold. (You can look at the details in appendix 3.) But another division may be right for you, based on your file sizes. Don't be too concerned, though: almost any partitioning will save you space over an unpartitioned drive.
(If you have multiple operating systems, you can
put the additional operating systems in additional primary partitions.
Some OSes can boot from a logical partition within an extended
partition. A disc can contain as many as four primary partitions, or
three primary partitions plus one extended partition.)
This completes the procedure. The rest of this document is background for those who may be interested in the numerical details.
Clusters are always some power of 2 times 512 bytes, but just which power of 2 depends on the disk size. Why should this be so? I mentioned above that clusters are numbered sequentially. The problem is that, in the traditional FAT or FAT16 file system, the directory structure and the FAT have room for only 16 bits for a cluster number. Since the largest unsigned number that will fit into a 16-bit field is 2^16-1 = 65535, the disk can hold at most 2^16 = 65536 clusters. This gives the formula
cluster size = disk size ÷ 65536, rounded up to a power of 2
For FAT32, the cluster number can be 32 bits, allowing for 2^32 = 4,294,967,296 clusters. Therefore any disk size up to 32 TB (32 million million million bytes) can be accommodated with a cluster size of just 8 KB.
For both FAT16 and FAT32, the average wasted space per file will be half a cluster. We'll explore the implications of this after we look at cluster sizes for various disk sizes.
First, as a rule of thumb you should know that each file on your disk, regardless of size, wastes half a cluster. How can we say this? Consider for a moment all the files that take up N clusters on the disk. This will include the files whose true size is N-1 clusters plus 1 byte, up to those whose true size is N clusters exactly. Assuming that file sizes are distributed fairly evenly, the average true size of all the files that take up N clusters will be N-(1/2) clusters. Since the actual space consumed for each of those files is N clusters, we have N-(N-(1/2)) = 1/2 cluster wasted space per file. Note that this result no longer depends on N: the average wasted space per file is half a cluster, regardless of file size and regardless of cluster size.
(Note: In the rule of thumb that "the average file wastes half a cluster", the word *average* is important. If the file is just a few bytes above a whole number of clusters, it will waste almost the whole of the next cluster. All the math in this note assumes that your files are roughly randomly distributed in size (modulo cluster size). If your file distribution is highly unusual the conclusions in this note may not apply.)
Next, we want to calculate how much space is wasted over the whole disk. Let's define some symbols. We'll call
From this we have the following (I use * for the multiplication sign instead of × [×], which some browsers still can't interpret correctly):
Note that the fraction of space wasted doesn't depend on the number of files, only on the cluster size K and on the average file size S. The exact same files will waste proportionally four times as much space on a drive with 32 KB clusters as on one with 8 KB clusters.
You can determine K, D, and N by using the CHKDSK command. K is the number of bytes in each allocation unit; D is the bytes of total disk space; and N is the sum of the numbers of hidden files, directories, and user files.
S, the average file size, is extraordinarily difficult to obtain. It's just the total file size divided by N, but the total file size can't be obtained, as far as I know, without examining the entries in each and every directory.
Fortunately (see above), the amount of wasted space depends on the total number of files and the assumption that their sizes (module cluster size) are fairly randomly distributed. So even without knowing S you can tell how much disk space you'll free up if you reduce cluster size.
In fact, you don't even have to do the math, since the WASTED utility (described above) will examine your disk and compute it for you. My calculations assume a random distribution of file size, and therefore they will only approximate any actual disk; but the utility will make an exact calculation for your disk.
|C:||453 MB partition, 2,352 files, 187,118,114 bytes|
N = 2352, S = 78, K = 8
number of files the partition can hold: 5656
waste = 9.2 MB = 5.1%
(This drive is a mix of big Windows programs, including a 21 MB swap file, and gazillions of those little .INI files.)
|D:||453 MB partition, 1,791 files, 115,589,208 bytes|
N = 1791, S = 63, K = 8
number of files the partition can hold: 6923
waste = 7.0 MB = 6.3%
|E:||126 MB partition, 389 files, 35,041,958 bytes|
N = 389, S = 88, K = 2
number of files the partition can hold: 1449
waste = 389 KB = 1.1%
(I was surprised at how many very large files I had on this partition. I had expected S to be around 10 KB or less.)
Now to compare the partitioned situation with what it would have been if I had not partitioned the disk:
|disk or partition size in MB (1 MB = 1024sup2; bytes)||1034||453, 453, 126|
|total amount of file data in KB||329,833||329,833|
|N = number of files||4532||4532|
|S = average file size in KB||73||73|
|K = cluster size in KB||32||8-8-2|
|wasted space in MB||70.8||16.6|
|wasted space relative to actual file data||22.0%||5.2%|
|number of files the disk can hold||11,896||14,028|
The differences are pretty dramatic. Using the partitions I selected, I
cut wasted space to 5 % from 22 %, and increased effective capacity of
my disk to 14,028 files from 11,896, an increase of almost 18 percent.