Over the past few years, the operating systems and applications have increased in size dramatically. Often, companies must upgrade to these newer (and larger) versions because their current versions are no longer supported or because of other situations beyond their control. Unfortunately, with all of the massive budget cuts going on, these software upgrades leave little money for upgrading hardware. For example, last fall, one company asked me to upgrade hundreds of computers from Windows 3.1 to Windows 98 in preparation for Y2K. Although many of these machines had only 512-MB hard drives, the company was unwilling to shell out the extra money for larger hard drives.

In such situations, a good alternative to buying a larger hard drive is to compress the existing one. With a few mouse-clicks, you can gain the extra space that you need for a new application or operating system. Although it’s a little slow, compression tends to work very well—as long as the operating system is intact. However, if any corruption occurs on a volume, the compressed files are often the first items to be lost. Fortunately, there are several methods of recovery when such situations occur. In this Daily Drill Down, I’ll discuss some ways in which you can recover a compressed volume if your hard disk becomes corrupt.

Before we begin
Keep in mind that the technique you use will depend on your situation. You may have to use a combination of techniques rather than just one technique. Likewise, keep in mind that there are times when hard disks become so corrupt that it’s impossible to recover the data—whether the drive is compressed or not. Therefore, if you see signs of corruption, you should fix the problem then and there before the problem gets any worse.

The anatomy of a compressed hard drive
Before you can repair a compressed volume, you need to understand how compression works. First, the files that are used in compression depend on which operating system you used to perform the compression. For example, DOS (or DOS with Windows 3.1) uses a program called DoubleSpace for compression. DoubleSpace uses a file called DBLSPACE.BIN as a compression driver. Windows 9x, on the other hand, uses a program called DriveSpace, which uses several files under the DRVSPACE.* naming scheme. Both versions work pretty much the same. The major difference is that DoubleSpace uses 16-bit code while DriveSpace uses a combination of 16-bit and 32-bit code. They’re so similar that you can install Windows 98 on a drive that DoubleSpace compressed.

Now that you know about the two different compression programs, let’s look at how the compression process actually works. When you compress a hard disk, you’re not actually compressing the partition at all. Remember that, during the initial phases of the boot process, your computer expects certain files to exist at certain locations on the hard disk. A true compression of the C: drive would render the computer unbootable because the location of these files would have moved. The computer would have no basis for reading the compression scheme. Even other partitions that aren’t needed for the boot process aren’t truly compressed. The operating system requires the file allocation table to rest in a certain position on the hard disk and in a standard format.

So, if the partition isn’t actually compressed, how does disk compression work? Rather than compressing the actual volume, the volume is remapped to a different drive letter. Later, this new drive letter becomes known as the host drive. Once the drive letter has been changed, the compression utility begins copying the contents of the drive into a single compressed database file. This database contains the files themselves and information about where each file begins and ends and about the size of each file. As each file is added to this database, it’s removed from the host drive. When the process is complete, the compression driver software emulates the original drive letter and points to the database. This setup gives the illusion that your data still exists in its natural form.

Now, before we get into the specifics of each technique, let’s examine the recovery techniques that I’ll be describing. The first technique involves moving the data off of a damaged compressed drive and onto a network drive. This technique is useful in situations when Windows has been severely damaged and you need to reformat the drive and begin again. It involves creating a network boot disk with the compression drivers.

Occasionally, you may run into a situation where this first technique isn’t an option. For example, if you don’t have a network, the network boot disk won’t do you any good. In these instances, there are commands that you can use to recover a damaged hard disk. If Windows won’t boot, you can daisy chain the damaged hard disk to another computer that also has DriveSpace installed. Then, you can use the commands.

Making the boot floppy
Let’s get started with our first technique. This one can become a little tricky because it’s highly dependent on what hardware is installed in your machine and on which compression driver you’re using. Begin by going to another Windows 98 machine that uses compression. (This machine should use the same compression program that the damaged machine does.) Insert your blank floppy disk into that machine and format it, copying the system files to the disk. Depending on which compression program you’re using, copy the files DBLSPACE.BIN and DBLSPACE.SYS or DRVSPACE.BIN and DRVSPACE.SYS to the floppy. Create a CONFIG.SYS file that calls the necessary files. This step will vary from machine to machine. Usually, you can use the machine’s existing CONFIG.SYS file as a model of how to get the job done. Often, this step involves adding a DEVICE= line to CONFIG.SYS that calls DRVSPACE.SYS or DBLSPACE.SYS.

Once you’ve added the compression drivers to the floppy, you need to add the network drivers. You can find the network client program on the Windows NT Server CD. If your copy of Windows NT Server came as a part of the BackOffice suite, the client software directory may be located on a different CD in the set—depending on which version you have. Once you’ve located the network client software, follow the enclosed instructions for setting up a DOS client. You’ll probably need the driver disk that came with your network card, too. In most cases, the client software will include the necessary protocols and the actual program that’s supposed to attach to the network, but it won’t be able to detect your network card without the driver from the floppy that came with the card.

Using the boot disk
Once you’ve created the boot floppy, go back to the damaged PC and boot from the disk. The machine will load the necessary drivers into memory and take you to a login prompt. When you login, you’ll see a command prompt. Map a network drive to the desired location and create a directory that you can use to offload your files. Then, you can begin copying the files from the damaged hard disk to the network. If you find this process too difficult, you can create a second floppy that contains system files, such as XCOPY.EXE and ATTRIB.EXE. With these files, you can make the copying process go much more smoothly.

Repairing a drive from within Windows
If Windows is still functional but the compressed drive is messed up, you can repair the drive from within Windows. To do so, you can use the commands that I cover in the remainder of this Daily Drill Down. You also can use this technique if you don’t have a network to which you can copy the files or if the compressed drive is damaged too badly to use a boot disk.

Whatever the reason for using the technique, Windows 98 must be functional. If Windows 98 exists on the damaged drive, you’ll have to daisy chain the damaged drive to a functional drive on another computer. Then, you’ll have to see if the other computer is already set up to use compression. It must use the same type of compression that the damaged drive does. If the other computer doesn’t use compression, you may not be completely out of luck. If the damaged hard disk used DriveSpace, you can install DriveSpace on the functional computer. Just because DriveSpace is installed doesn’t mean that you don’t have to compress the existing partitions. Installing DriveSpace merely provides you with the system files that you need in order to repair the damaged drive.

To install DriveSpace, double-click the Add/Remove Programs icon in the Control Panel. Next, go to the Windows Setup tab. Select System Tools and click Details. Now, select the option that corresponds to disk compression and click OK twice. Windows will copy the necessary files. Once DriveSpace is installed and the hard drives are daisy-chained together, you’re ready to start. Below, I discuss the various commands that you can use for recovery purposes. You can enter these commands from the command line in a DOS window.

Compressing a drive
The first thing that you can do with your disk is to compress a hard disk that’s getting too full. You must understand that DRVSPACE can’t compress a hard drive that’s completely full. The drive must have at least 2 MB free. (The maximum size of the compressed portion is 512 MB.) Thus, when you compress a drive, the default setting is to leave 2 MB uncompressed. However, on larger drives, more space will be left uncompressed. That way, you won’t exceed the 512-MB limit. To compress a drive, enter the following command:
DRVSPACE /COMPRESS drive1 [/new=drive2] [/reserve=size]

The /COMPRESS switch tells DrvSpace to compress the drive. Drive1 is the current drive letter of the drive that you want to compress. The New=drive2 parameter tells DrvSpace which drive letter to use for the uncompressed host drive. By default, DrvSpace uses the fourth available drive letter; however, you can use whatever you want. For example, if you have drives A, B, C, and D, DrvSpace will use H. Finally, the /reserve=size switch tells DrvSpace how much space not to compress. This switch is useful if your files don’t work well on a compressed drive. You reserve space for these files by using that command.

Create a new compressed drive
Another option is to create a new compressed drive by using some of the free space from an uncompressed drive. To do so, use the following command:
DRVSPACE /CREATE drive1: [/new=drive2] [/size=size] [/reserve=size] [/cvf=nnn]

The syntax for creating a new drive is very similar to that for compressing a drive. The main difference is that the DrvSpace command uses the CREATE switch instead of the COMPRESS switch. As you might have guessed, drive1 refers to the uncompressed drive from which you want to take space. The /new=drive2 refers to the drive letter that you want to create. If you leave this command out, the same rules apply as before. Again, /Reserve=size refers to the amount of space that you want to reserve on the uncompressed drive in case you have files that don’t work well when they’re compressed. Finally, the /CVF=nnn switch reports the extension of the CVF (compressed volume file).

Delete a compressed drive
A time may come when a compressed drive becomes so damaged that you’ll want to delete it and reclaim the space that it consumes. You can use the /DELETE switch to do so. This switch erases the compressed drive, its corresponding volume file, and the files stored within the volume. One word of caution: Once you use this command, there’s no turning back. Here’s the syntax:
DRVSPACE /DELETE d:\d??space.###

This command deserves a little explaining. In this command, d:\d??space.### refers to the drive that you’re trying to delete. Suppose that you had compressed the C: drive. If that were the case, the volume file would probably be stored on H. If so, your command might look something like this:

This command won’t work if any files on the compressed drive or on the host drive are opened.

Format a compressed drive
Occasionally, you may run into a situation where a compressed volume is physically fine, but it contains thousands of corrupt files. If you run into such a situation, it may make more sense to reformat the volume than to delete it completely. So, use the FORMAT switch.

Before I provide you with the syntax for the FORMAT switch, I must caution you. First, formatting a drive deletes all of the files on it. Second, formatting a compressed drive works very differently from the system’s standpoint than formatting a physical volume does. Thus, you can’t unformat a compressed volume if you accidentally format the wrong one. Here’s the syntax for the FORMAT switch:
DRVSPACE /FORMAT d:\d??space.###

The /FORMAT portion issues the format command, while the d:\d??space.### portion points the way to the volume file that you’ll be formatting. In the real world, the command might look like this:

Mount a compressed drive
Normally, when you create a compressed volume, the system will automatically mount the volume when the system boots. However, if you previously unmounted the drive, it will no longer mount automatically. A compressed drive may also fail to mount if your hard disk sustains damage. You can mount a dismounted compressed volume manually by using the following syntax:
DRVSPACE /MOUNT [=nnn] drive1: [/new=drive2:]

DRVSPACE /MOUNT d:d??space.### [/new=drive2:]

The drive1 parameter refers to the drive that contains the compressed volume file. This parameter must be specified as a drive letter. The nnn portion of the command refers to the number that’s used in the extension of the compressed volume file. By default, the command looks for a compressed volume file named DBLSPACE.000. If you need to mount a compressed volume file named DBLSPACE.001, use 001 as the nnn parameter. The second syntax line also provides a mechanism for specifying the entire name of a compressed volume file. Finally, the /new=drive2 parameter specifies the drive letter that will be used to reference the compressed volume once it has been mounted.

Setting a compression ratio
DriveSpace uses a compression ratio to estimate how much free space is available on the compressed volume. However, this ratio doesn’t always produce an accurate calculation. For example, if you attempt to copy a ZIP file to a compressed drive, the ratio will be wrong because most ZIP files can’t be compressed. If this happens, you can use the RATIO switch to change the compression ratio to a more accurate calculation. The syntax is as follows:
DRVSPACE /RATIO[=r,r] [drive:]

Here, the drive parameter specifies which drive to apply the ratio to, while the [=r,r] portion specifies the new ratio. You can set the new numbers anywhere from 1 to 16. Just keep in mind that not all compressed drives will accept all compression ratios.

Setting a size for compressed drives
The Size parameter is one of the most powerful parameters available. It allows you to resize a compressed volume dynamically. For example, you could adjust the size if you needed more space on the compressed volume or if you needed more space on the host drive. The syntax for this command is as follows:
DRVSPACE /SIZE[=size] [/reserve=size2] drive:

The syntax for this command is a little tricky. Obviously, the drive parameter specifies the drive with which you want to work. The size variable specifies the new size of the compressed volume in megabytes. The /reserve parameter indicates the number of megabytes that you want to reserve on the host volume. The real trick is that you can use a value in the size parameter or the reserve parameter—but not in both. For example, the command to change the size of drive D: so that its host drive (C:) contains 35 MB of uncompressed space would look like this:

Uncompressing a compressed drive
Another option is to decompress a compressed drive. Doing so decompresses everything on the compressed drive, and everything ends up in the same location with the files on the host drive. The files will use either the drive letter that the compressed drive used previously or the drive letter that the host drive used, depending on how the drive was set up.

You need to keep two important factors in mind when you decompress a drive. First, you must have enough free space on the host drive and on the compressed drive to be able to decompress the files that are contained on the compressed drive. Second, if the drive letter changes, remember that some programs may point explicitly to a certain drive letter for executable code or data files. Due to these two facts, I recommend that you back up the entire system before you make the change. Once the backup is complete, I also recommend that you delete any unnecessary files from the compressed volume. The syntax for decompressing a drive is as follows:

Unmounting a compressed drive
If you need to make a compressed drive temporarily unavailable, you can do so by using the UNMOUNT switch. Use the following syntax:

Talainia Posey learned to handle PCs the old fashioned way: by reading manuals and doing on-the-job troubleshooting. Her experience also includes installing networks for several small companies. When she’s not working on computers, Talainia loves to shop for toys and watch cartoons, or spend time with her cat, Beavis.

The authors and editors have taken care in preparation of the content contained herein, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for any damages. Always have a verified backup before making any changes.