A number of VPCCentral readers have emailed with questions about Virtual PC hard drive image limitations. Most of the confusion results from an incomplete understanding about hard drive terminology and technology. I’ll try to clear up some of the confusion.
A hard drive is a block device storage medium. That means the information is stored in blocks that have individual addresses. In the case of hard drives, these blocks are usually referred to as sectors. In the case of IDE drives (the type typically used in PCs), each sector holds 512 bytes. Given the size of today’s hard drives, there are a lot of sectors on a typical disk! Reading data from or writing data to a hard drive is accomplished by specifying a particular sector number. The first is numbered zero, and the last is determined by the size of the hard drive.
It’s the operating system’s job to impose some order on the hard drive sectors. For example, the OS needs to keep track of which sectors are related (e.g. contain data located within the same file) and which sectors are unused. The way the OS accomplishes this is by chopping a hard drive into pieces called partitions. Most hard drives have just one partition, so users often confuse the two. Partitions are also sometimes referred to as volumes. For example, if you have a hard drive with two partitions in a PC, the first volume will show up as the “C Drive” and the second will show up as the “D Drive”. Already we see why some of the confusion occurs with Virtual PC. The program itself attempts to hide the distinction between hard drives and partitions; the PC Settings window refers to the hard drives as the “C Drive”, “D Drive”, etc. These would more accurately be referred to as “Drive 1” and “Drive 2”. If “Drive 1” contained two partitions, they would become C and D.
The operating system stores information about the paritions in the first several sectors on the disk. This area is known as the partition table. It records where each partition begins and ends and the type of volume format used for each partition. The volume format is determined by the file system used to access the information on the volume. A volume format typically includes a way to track logical groups of sectors that together make up files. For efficiency reasons, many file systems always allocate hard drive space to files in increments of more than one sector. Typically, files grow by a larger value (always a power of two). This value is known as the allocation block size or the cluster size. For example, if the cluster size were 16K, a file that contains just one byte of information would still take up 16K (or 32 sectors) on the hard drive.
Included with most volume formats is the ability to keep a hierarchical list of files and directories. Associated with each file is a set of clusters that make up the file. One way of storing this information is in a simple table — a file allocation table. In fact, the most popular volume format in the Windows world is commonly referred to as FAT (short for file allocation table). You may have heard about FAT16 and FAT32. The number indicates the number of bits used to address the clusters. Because a 16-bit number represents values between 0 and 65,535, a FAT16 volume is limited to 65,536 clusters. Now you see why file systems use a size larger than a single sector for clusters. If a cluster were just one sector, a FAT16 volume would be limited to 32K! However, if you make every cluster 32K, FAT16 supports a 2GB volume. In fact, 2GB is the biggest volume FAT16 supports. This is why FAT32 was designed.
With FAT16, the cluster size needs to be chosen very carefully. If it is larger than necessary for a given volume size, there will be more wasted space (remember than one-byte file I mentioned above?) With real PC’s, it’s always best to choose the smallest possible cluster size for a given volume because the hard drive size will never change. However, Virtual PC allows users to expand their hard drive images. The expansion of images is often limited by the cluster size. Typically, a FAT16-formatted volume can be increased in size up to the next power-of-two size. You’ll notice that your 513MB drive image cannot be expanded beyond 1024MB. Now you know why.
Pictorally, the drive expansion process can be shown as a two-step process. First, the media is increased is expanded, then the single volume is expanded. Note that Virtual PC is only able to expand hard drives that contain either a single FAT16 or FAT32 volume.
The “drive expansion” process described above shouldn’t be confused with the dynamically-expanding drives introduced in Virtual PC 4. I’ll talk more about these at a later date.
What are the absolute limits on hard drive images within Virtual PC? In VPC 3, the limit was 2GB. Connectix had a good reason for sticking to a 2GB limit in the VPC 3 timeframe. Until recently, the MacOS limited file sizes to 2GB. With the advent of MacOS 9.0 and VPC 4, you can now create drive images up to 128GB in size! The limit this time is imposed by the IDE drive standard. The IDE interface uses a 28-bit number as a sector address. This means drive can be up to 2^28 * 512 bytes in size (which turns out to be 128GB).