How to Remove EZ-Drive Without Reinstalling or Moving Data

I have an old machine that I used to use as a personal server. For some reason the hard drive contained EZ-Drive. I don't know why. Perhaps the hard drive had it preinstalled. In any case, the boot sector eventually got corrupted and LILO refused to run. Accessing the filesystem with a boot disk didn't work, since EZ-Drive had taken over the normal partition table. I could have just reinstalled, of course, but in the process of figuring out what was going on I found a removal method.

There don't seem to be any other descriptions of how to get rid of EZ-Drive, so here is what I found out. These instructions are more or less intended for disks that contain Linux (or no operating system). I don't know what would happen with another OS.

Description of EZ-Drive

EZ-Drive was a program for working around hard drive size limitations of early BIOSes and MS-DOS/Windows. Apparently there are several different programs that are repackaged versions of EZ-Drive. Some of these are:

At this point, I'll defer to a few other pages on the subject:

As far as I can tell, EZ-Drive works by providing a boot loader and an alternate partition table. The normal partition table, rather than listing the partitions "really" on the drive, looks like this:

# fdisk -ul /dev/hda

Disk /dev/hda: 30.7 GB, 30736613376 bytes
255 heads, 63 sectors/track, 3736 cylinders, total 60032448 sectors
Units = sectors of 1 * 512 = 512 bytes

      Device Boot      Start         End      Blocks   Id  System
/dev/hda1      *          63    60002774    30001356   55  EZ-Drive

The EZ-Drive partition table is in the second sector of the disk; it lists the "real" partitions.


You probably don't have to remove EZ-Drive if you don't want to.

As far as I know, EZ-Drive is not ever needed for Linux, but Linux can work with a hard drive that has an EZ-Drive alternate partition table. Add the kernel option "hda=remap" (or hdb, hdc, etc.) to your LILO or GRUB configuration. If you're running Linux 2.6 off such a drive now, you've probably already done this.

As long as you can mount the filesystems with your data, you can always move the data elsewhere, wipe the beginning of the disk, re-create partitions, copy the data back, and recreate your boot record(s). I'm not going to go into how to do that here, but it is a more conservative approach.

Dire Warnings

Heed these if you value your data.

  1. Make a backup! The first instruction shows how.
  2. Doing any kind of low-level manipulation of a hard disk like this has the potential to wipe out your data or make it inaccessible. If that scares you too much or you don't trust the backup you'll make, don't try anything.
  3. As I mentioned before, these instructions are for disks with Linux or no OS. They might kill BSD, Dos, Windows, etc., as well as dual-boot configurations.
  4. If you lose your data, you can blame me, but it won't do you any good. ;)


Conceptually, removing EZ-Drive is rather simple. The EZ-Drive partition table (which has the "real" partitions) must be copied over the normal partition table (which has the fake EZ-Drive partition). If the EZ-Drive bootloader was in use (and it probably wasn't, if you've been using Linux exclusively), LILO or GRUB should be re-run so you can boot from the hard drive.


1. Boot From a Boot Disk

You shouldn't try this procedure while the disk is in use or the "hdx=remap" kernel parameter is in effect. The easiest safe method is to use a boot floppy or CD. Try Knoppix.

2. Make a Backup

The Safest Way (or the Paranoid Way)

There are lots of ways to back up hard drives, partitions, and files. If you want to use your own method, go ahead and do so, but keep in mind that a full disk image is the safest way. If you're using a boot disk, you may want to use netcat to transfer the image.

First, have a host computer (with enough filesystem space to hold the entire drive) on the same network. Run the following command on the host:

nc -l -p 8888 -q0 > disk.bin

Next, run this command on the client (replace with the host's IP address) and wait a long time for the disk to copy:

dd if=/dev/hda | nc 8888 -q0

note: This doesn't encrypt the data during the transfer. If there is any danger of somebody eavesdropping on your LAN (especially a wireless LAN), use an encryption program like gpg, ssh, or openssl.

A Reasonably Safe Way

The method above makes a copy of the entire hard drive, but you'll only be working with the first two sectors, so that's really all you need to back up. Replace the dd command listed above with this one:

dd if=/dev/hda bs=512 count=2 | nc 8888 -q0

All you'll need is 1024 bytes of free disk space on the host, and the transfer will be very fast. This partial backup will not lilkely protect you from mistyped commands, however, so be careful.

3. Overwrite the Partition Table

Sectors were always 512 bytes on PC systems during the era in which EZ-drive was shipped with hard drives. Partition tables are normally stored 446 bytes into the first sector; the EZ-Drive partition table is 446 bytes into the second sector (hence, 512+446=958 bytes into the disk itself). Both partition tables use the remaining space in the sector, which is 512-446=66 bytes.

Here's a diagram. Note that it isn't to scale; look at the '^' marks for offset locations and the numbers below for the offsets themselves. I'm using decimal (as opposed to hexadecimal) because that's the base used for dd.

[--------- sector 0 ---------][--------- sector 1 ---------][-------- and so on
(boot loader)(partition table)(   empty   )(EZ-Drive  table)
^            ^                ^            ^                ^
0 bytes      446 bytes        512 bytes    958 bytes        1024 bytes

The following command will copy the EZ-Drive table over the normal partition table. Given the numbers above, it should be self-explanatory.

dd if=/dev/hda bs=1 skip=958 count=66 of=/dev/hda seek=446

As always, replace /dev/hda with whatever disk you're manipulating.

4. Test and Cleanup

Run 'fdisk -ul /dev/hda'. Do your partitions show up like you expect them to? If so, then all is well. If not, restore the backup (see below) and/or look for typos.

The previous step should have left your boot loader alone, so try booting from the hard drive. If, for some reason, you need to reinstall your boot loader, then you can boot from the boot disk again, mount your root filesystem, chroot, and use lilo or grub to reinstall. The details of how to do this vary, but they follow more or less the same steps as listed here:
If in doubt, find the specific documentation for your distribution and boot loader.

If you were using the "hda=remap" kernel parameter, then once you get your system running again, remove the parameter from your boot loader configuration. Reboot and make sure everything still works.

Backup Restoration

If you mess something up or want to go back for some other reason, the restoration commands are more or less the reverse of the backup. On the host, run:

nc -l -p 8888 -q0 < disk.bin

On the client, run:

nc 8888 -q0 | dd of=/dev/hda


If you have a question about this procedure, feel free to email me and ask. I'll probably want to examine the first two sectors of your disk, so attach the 1024-byte file described in the backup section.


Did this work for you? Did it not? Have I made any grievously incorrect recommendations? Tell me. I'm quite curious to know if these instructions actually are of use to anybody. My address is below.

I received a very nice email from Keith Neufeld, who found this page useful. He has quite generously offered to build me a custom digital wall clock with a display made from bright blue LEDs, once he finalizes the design. The clock design progress is documented on several pages of Keith's blog, notably this one:
Thank you, Keith!

Further Reading

Andries Brouwer has two very nice documents describing DOS-style partition tables:

The man pages for the standard Linux partition table editors are also informative:

Revision History:
2006-08-30 Wrote initial version.
2006-09-12 Made a few small wording changes.
Converted buggy HTML to validated XHTML 1.0.
Added revision history.
2006-10-04 Made a few small wording and markup changes.
Added thank you note.
2008-10-06 Added "Help!" and "Further Reading" sections.
Changed backup instructions to save the first two sectors.
2010-02-14 Changed sentence about hard disk sector sizes.

Corey Hickey, bugfood-c [at] fatooh [dot] org
other stuff