Read/Edit Hard Drive Details

Quick Start: There are two particularly useful tools that can be downloaded from the PowerQuest/Symantec Public FTP folder (or may be bundled with a Partition Magic install) that we highly recommend and outline in some detail in this page. These are PowerQuest's PartitionInfo (a Partition Information Extraction Utility) and PTEdit (an MBR/EPBR Partition Table and Boot Sector Viewer and Editor). Note that there are different versions for different operating systems. We provide a BartPE plugin (pqutils.cab 584kB) that allows the Windows NT versions of both programs to be run from a BartPE Live CD (covered on another page).

The DOS versions of PartitionInfo and PTedit (along with FDisk and Format) have been compiled into some bootable floppy and CD image files. On booting to them, they should immediately load the output of PartitionInfo into a text file on a RAMdrive as X:\partinfo.txt. This output can be simply read or be copied/saved to a floppy drive or to an available FAT partition. There is no USB support unless your BIOS supports it directly. The A: drive on the CD is not writable but if the system also has a physical floppy drive it should be accessible as drive B: once you have booted to the CD. When ready you can close the initial display of text (in edit.com) from its File Menu and then from the A:\ prompt you should be able to run ptedit, fdisk, format or partinfo at your will.

If you prefer a menu-driven equivalent boot floppy have a look at Sylvander's thread at the PCGuide Forums.

IMPORTANT NOTES RE VISTA AND EFI BIOS: There are many anomolies that apply to (a) Vista and the way it treats both HDD geometry and the boot process - as well as (b) how EFI based BIOS will affect this area as they become more commonplace. There is much good information about such issues in general and multibooting in particular at the Goodells Site and with particular respect to Vista at the Multibooters Site. There is also a Microsoft paper ' Boot Configuration Data (BCD) in Windows Vista' and ' The Windows NT 6 boot process' which are both, for those interested in this area, worth reading.

In short we advise "multibooters" to only let Vista partition a drive that it will use exclusively - otherwise use 3rd Party or legacy partitioning methods. For an example of just why, see MSKB 931854. Vista is probably moving towards the day when drives may have the current sector size of 512 bytes increased to 4096 bytes (4kB). Vista has changed the "Hidden Sectors" legacy value of 63 (one track) to 2048 (1 MB) when it does the partitioning, even though it will happily use legacy-formatted partitions. Vista's partitions now dont start or end on traditional cylinder boundaries and this can make, for example, WinXP and Vista's partitions invisible to each other.

Introduction and other Misc Programs

There are times when it can be extremely helpful to be able to read, understand, pass on and even edit information relating to one's hard drives, their partitions and other data that they contain. It is often necessary to do this from outside the hard drive in question and typically from another operating system altogether. With the right tools at one's disposal, it is often possible to regain access to an unbootable system or to access/recover apparently deleted data.

The use of a disk hex editor on a boot CD is another approach and we have covered this in some detail on our TinyHexer and BartPE page. A superb and more elaborate program for looking into these murky waters is the shareware WinHex - but this has to be run from a Windows interface. The program TestDisk can also dig out certain basic information and is good at recovering "lost" partitions but is not user-friendly for newbies. The TBU program BiNG, covered on another of our own pages, can also search unallocated space for lost partitions and facilitate the rebuilding of partition tables. The two main PowerQuest utilities and some other utilities are described in greater detail below.

The RAMdrive in the compiled boot floppies was obtained from The TBU Knowledgebase. You may well want to edit the autoexec.bat file to customise it for you own use. The TBU link and the ramdrive.zip download have instructions on how to modify the use of XMSDSK should that be desired or needed.

PartitionInfo

If you haven't used one of the utilities mentioned in the Quick Start to make a bootable medium, you can still download and unzip the stand-alones PartIn9x.zip (for Win9X/ME) or PartInNT.zip (for Win2K/XP and "Vista-ish") as well as partinfo.zip (the DOS version which only gives a text output). The Windows GUI has more or less run OK from Vista. We did experience some problems displaying all the information in its Windows but it did correctly display the correct text output when previewed or saved as a file.

Partition Information Utility Fig 1.

Two basic sorts of information may be displayed, copied, printed, etc. Firstly there is the sort of information shown in Fig 1, which is fairly straightforward and is a translation of the information in the partition tables found in the MBR and in each Logical Partition's EPBR scattered throughout the disk. Secondly there is the information relating to any specific partition's boot sector. If specific partitions are highlighted in the upper window then clicking on the [Boot Record] button will open a secondary display outlining the relevant translated metadata contained in its PBS as shown in Fig 2. for the C: drive highlighted in Fig 1. The various FAT and NTFS partitions will show on slightly different templates from one another.

Boot Record Info Fig 2.

If you really want to edit the PBS without having to edit the hex with a hex editor then there are a couple of fairly easy ways to do this. One is with WinHex's Boot Sector Template (accessed as per Fig 3 after the relevant "logical drive" has been opened - such as C: in the above example). The opened template looks essentially just like that of the one from PartitionInfo (Fig 2) but is writable. You will need to have actually purchased WinHex for you to be able to do this. Such direct disk-access write functions are disabled while it is just on trial. The second is to use the Boot Sector Template Window from PTEdit as described in the next section.

WinHex PBS Edit Fig 3.

PTEdit

As with PartitionInfo, you can either use one of the utilities in the Quick Start or you can download and unzip the stand-alones PTEDIT32.zip (for Windows) or ptedit.zip (for DOS) from the Symantec public FTP folder. When the application is first opened (as in Fig 4) you should see four main lines of values. Each line is translated from the corresponding 16bytes of code in the MBR into a comprehensible form for us humans to read (and to edit). Any interim changes one makes appear in red until the changes are saved/written to disk. Don't save any such changes UNLESS YOU REALLY MEAN IT and know what you are doing. If you have more than one hard drive or array in your system ensure that you choose the correct one in the drop down list at the top. We recommend that you write down any original values on a piece of paper before committing any changes to disk; it will only take you a moment or two.

PTEdit Basic Fig 4.

Familiarisation and Usage

Manual Editing, "Zeroing" and Backup using PTEdit

HD_Tune

HD Tune comes in both Pro and Free Versions. There are some screenshots on the webpage that give you a good idea of its interface. It is a generic hard drive tester, performance analyser and information gatherer. The most comprehensive analysis will be from internally connected IDE or SATA drives not configured into any RAID, since for such drives it can dig out much information directly from the drive's firmware. It can access RAID volumes as if they were "hard drives" and can access drives in USB enclosures - but the listed information will not be as complete. At this time we have only used the free version. Using a hard drive manufacturer's own diagnostics (most of the big names except for Toshiba provide them on their websites) from another boot medium, other that the hard drive, may be wise if you think your drive may be compromised or is inaccessible by normal means.

HD_Info

HD Info is a trialware windows utility from 48bitLBA.com. It provides less information than HD_Tune and only shows information about internally fixed IDE drives. It has certain limited uses in determining whether a motherboard or hard drive controller card supports 48bit LBA.


Appendix 1. Links to Hard Drive Maker's Diagnostic Utilities and Hard Drive Tools.

Appendix 2. What is a partition table and what does it look like?

Specific areas of hard drives have different uses and one such area is known as a partition. Partitions come in different formats but also need to be capable of having their boundaries defined. These definitions are stored in what are called Partition Tables. A normal MBR (or EPBR) contains four such tables with each having 16 bytes of information written within the 512 (0-511) bytes of its hexadecimal offsets 1BE-1CD, 1CE-1DD, 1DE-1ED and 1EE-1FD (or in decimal 456-461, 462-477, 478-493, and 494-509) respectively.  If  we examine just the first one with a hex editor it could have the following appearance:

Offset       0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F

0000001B0                                              00 01                 ..
0000001C0   01 00 04 FE 3F 03 3F 00  00 00 C5 FA 00 00         ...þ?.?...Åú..

If we just look at these sixteen bytes in a row they have the following sequence:

00 01 01 00 04 FE 3F 03 3F 00 00 00 C5 FA 00 00

It is possible to show exactly how these translate into values that are meaningful to us humans (TheStarman and others on the web will show you how this is done if you really want to find out but it involves reversing some sequences and using only parts of some of the bytes). The four-byte "d-word" for the number of sectors in the first partition is obtained by first reversing its sequence of bytes on disk from "CF FA 00 00" to the hexadecimal number "00 00 FA CF". The leading zeros are dropped and one can then quite easily convert the hexadecimal number FACF to the decimal one of 64197, using a calculator. The translated output of this whole example is shown in Partition Table 1 in Fig 5. It actually references a non-active 31MB FAT16 partition at the start of a hard drive. PTEdit (Fig 4) has the same values but with the columns in a slightly different order. Fig 5 shows the entries in the same sequence that they are written in the partition tables. Excepting when legacy geometry is needed on old systems, the CHS values become virtually meaningless once the 8.4 gig threshold is traversed and when all CHS values then begin with "1023 Cylinders".

 PT   Start   End Hidden Sectors Number of Sectors
  Act Cyl Head Sect Type Cyl Head Sect (LBA) (LBA)
 1: 0 0 1 1 04 3 254 63 63 64197
 2: 80 4 0 1 07 1023 254 63 64260 20482875
 3:   0 1023 0 1 0F 1023 254 63 20547135 34780725
 4:   0 1023 0 1 07 1023 254 63 55327860 16964640

Fig 5: (MBR = LBA Sector 0).

"Hidden Sectors" is a synonym for "Sectors Before". These are sectors that span a defined area prior to any partition's actual PBS. Primary partitions define it from the start of the hard drive. A logical partition's first partition table defines it from its own EPBR and its second partition table (when there is one) is a reference from the start of the containing extended partition to where the next logical partition's EPBR will be found. Confusing? Indeed it can be!

 PT   Start   End Hidden Sectors Number of Sectors
  Act Cyl Head Sect Type Cyl Head Sect (LBA) (LBA)
 1: 0 1023 1 1 07 1023 254 63 63 10185147
 2: 0 1023 0 1 05 1023 254 63 10185210 14346045
 3: 0 0 0 0 0 0 0 0 0 0
 4: 0 0 0 0 0 0 0 0 0 0

Fig 6: (1st EPBR = LBA Sector 20547135 ).

The first of three logical partitions within the extended partition (referenced by Partition Table 3 in Fig 5) is shown in Fig 6. The first partition table references its own PBS and the second one references the next EPBR in the daisy chain. The next EPBR is displayed in Fig 7.

 PT   Start   End Hidden Sectors Number of Sectors
  Act Cyl Head Sect Type Cyl Head Sect (LBA) (LBA)
 1: 0 1023 1 1 07 1023 254 63 63 14345982
 2: 0 1023 0 1 05 1023 254 63 24531255 10249470
 3: 0 0 0 0 0 0 0 0 0 0
 4: 0 0 0 0 0 0 0 0 0 0

Fig 7: (2nd EPBR = LBA Sector 30732345).

The middle one of three logical partitions is shown in Fig 7. It is referenced from the first logical in Fig 6 and is itself referencing the third one in Fig 8.

 PT   Start   End Hidden Sectors Number of Sectors
  Act Cyl Head Sect Type Cyl Head Sect (LBA) (LBA)
 1: 0 1023 1 1 07 1023 254 63 63 10249470
 2: 0 0 0 0 0 0 0 0 0 0
 3: 0 0 0 0 0 0 0 0 0 0
 4: 0 0 0 0 0 0 0 0 0 0

Fig 8: (3rd and last EPBR = LBA Sector 45078390)

The last of these three logical partitions is shown in Fig 8 and so only references its own PBS. Each EPBR's partition tables are in the same position as those in a standard MBR and have the same general structure. The rest of the EPBR does not normally, unlike the MBR, contain any bootstrap code.