home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: SysTools
/
SysTools.zip
/
chkpart.zip
/
CHKPART.DOC
next >
Wrap
Text File
|
1997-02-20
|
14KB
|
344 lines
CHKPART Version 1.0 - An OS/2 program that checks and displays the partition
table chain (MBR/EBR) on disk drives.
Written by:
Doug Azzarito
IBM OS/2 Change Team
Azzarito@austin.ibm.com
(c) 1994-1997, IBM Corp. All rights reserved.
This program is for internal use only, and for use by customers who use it
under the direction of OS/2 support personnel. NO ONE MAY USE, REDISTRIBUTE
OR UPLOAD THIS PROGRAM TO AN ON-LINE SOFTWARE REPOSITORY WITHOUT PRIOR
WRITTEN PERMISSION FROM THE AUTHOR.
What is it?
CHKPART is an OS/2 text-mode program that will scan the hard disk partition
tables (the Master Boot Record, or MBR, and the Extended Boot Records, or
EBRs), looking for errors. It won't fix any errors, and does not write to
your hard disk. It just displays the results of the search. The output is
not meant for "casual" users, but if you are familiar with the structure of
the MBR/EBR, you should be able to use the output from CHKPART to fix the
error yourself.
HINT: If you save the output from CHKPART, the information in the report
can help recover a system if the partition tables are destroyed
(virus, accidental FDISK use, disk crash, etc).
CHKPART looks for things like:
Partitions that don't end on a cylinder boundary
BPBs that have a different geometry than the drive unit
HPFS sizes that don't match the partition size
And anything else I could find by walking the MBR/EBR chain.
To run CHKPART, just type CHKPART from an OS/2 command session. It takes
no parameters, but since you will usually want to save the output to a
file, the best way to run it is with the command:
CHKPART > A:\CHKPART.LOG
You can then view the file A:\CHKPART.LOG, which contains the results from
CHKPART's scan. If there are any errors, you'll see a message at the end of
the report, and then you can scan through the report to see exactly what
CHKPART found.
If you don't understand the output from CHKPART, it would take a book to
explain it all. If you are familiar with the layout of the MBR and
EBRs, you will probably recognize just about everything in the report.
Some rules that will help you decipher the output:
- Most numbers are reported in HEX and DECIMAL, with the decimal value in
parenthesis. Example: 01A2 (418)
- If a number is calculated by CHKPART (using other values obtained by
querying the system), the number will be followed by an asterisk (*).
The calculation and the source of the number is described later in this
document.
A CHKPART report looks like this:
---------------------------------------------------------------------------
Partition Diagnostic Utility - Version 1.00
Copyright (c) 1994-1997, IBM Corp.
Distribution of this program without author's consent is PROHIBITED!
For information, contact: Azzarito@austin.ibm.com
Report generated on Tue Feb 18 15:07:19 1997
Physical Drives Detected: 1
Drive Information for Physical Disk 1:
Cylinders 012E (302)
Heads 40 (64)
Sectors/Track 20 (32)
Total Sectors 00097000* (618496)
Drive Size (MB) 302.000* (316669952 bytes)
Partition 1:
Boot Indicator 00 (0)
Partition Type 05 (5) [Extended]
Begin CHS 00A,00,01 (10,0,1)
End CHS 12C,3F,20 (300,63,32)
Rel Sectors 00005000 (20480)
Sectors 00091800 (595968)
Begin RBA 00005000* (20480)
End RBA 000967FF* (616447)
Begin CHS 00A,00,01* (10,0,1)
End CHS 12C,3F,20* (300,63,32)
Size (MB) 291.000* (305135616 bytes)
Extended Partition Information
Partition 1:
Drive D:
Boot Indicator 80 (128) [Bootable]
Partition Type 07 (7) [Installable File System]
Begin CHS 00A,01,01 (10,1,1)
End CHS 0E6,3F,20 (230,63,32)
Rel Sectors 00000020 (32)
Sectors 0006E7E0 (452576)
Begin RBA 00005020* (20512)
End RBA 000737FF* (473087)
Begin CHS 00A,01,01* (10,1,1)
End CHS 0E6,3F,20* (230,63,32)
Logical Cylinders 00DD (221)
Heads (BPB) 40 (64)
Sectors/Track (BPB) 20 (32)
Sectors (BPB) 0006E7E0 (452576)
Sectors (HPFS) 0006E7E0 (452576)
Size (MB) 220.984* (231718912 bytes)
Partition 2:
Boot Indicator 00 (0)
Partition Type 05 (5) [Extended]
Begin CHS 0E7,00,01 (231,0,1)
End CHS 12C,3F,20 (300,63,32)
Rel Sectors 0006E800 (452608)
Sectors 00023000 (143360)
Begin RBA 00073800* (473088)
End RBA 000967FF* (616447)
Begin CHS 0E7,00,01* (231,0,1)
End CHS 12C,3F,20* (300,63,32)
Size (MB) 70.000* (73400320 bytes)
Extended Partition Information
Partition 1:
Drive E:
Boot Indicator 80 (128) [Bootable]
Partition Type 07 (7) [Installable File System]
Begin CHS 0E7,01,01 (231,1,1)
End CHS 12C,3F,20 (300,63,32)
Rel Sectors 00000020 (32)
Sectors 00022FE0 (143328)
Begin RBA 00073820* (473120)
End RBA 000967FF* (616447)
Begin CHS 0E7,01,01* (231,1,1)
End CHS 12C,3F,20* (300,63,32)
Logical Cylinders 0046 (70)
Heads (BPB) 40 (64)
Sectors/Track (BPB) 20 (32)
Sectors (BPB) 00022FE0 (143328)
Sectors (HPFS) 00022FE0 (143328)
Size (MB) 69.984* (73383936 bytes)
Partition 2:
[Empty]
Partition 3:
[Empty]
Partition 4:
[Empty]
Partition 3:
[Empty]
Partition 4:
[Empty]
Partition 2:
Drive C:
Boot Indicator 00 (0)
Partition Type 01 (1) [FAT (12bit)]
Begin CHS 000,01,01 (0,1,1)
End CHS 009,3F,20 (9,63,32)
Rel Sectors 00000020 (32)
Sectors 00004FE0 (20448)
Begin RBA 00000020* (32)
End RBA 00004FFF* (20479)
Begin CHS 000,01,01* (0,1,1)
End CHS 009,3F,20* (9,63,32)
Logical Cylinders 000A (10)
Heads (BPB) 40 (64)
Sectors/Track (BPB) 20 (32)
Sectors (BPB) 00004FE0 (20448)
Size (MB) 9.984* (10469376 bytes)
Partition 3:
Boot Indicator 80 (128) [Bootable]
Partition Type 0A (10) [Boot Manager]
Begin CHS 12D,00,01 (301,0,1)
End CHS 12D,3F,20 (301,63,32)
Rel Sectors 00096800 (616448)
Sectors 00000800 (2048)
Begin RBA 00096800* (616448)
End RBA 00096FFF* (618495)
Begin CHS 12D,00,01* (301,0,1)
End CHS 12D,3F,20* (301,63,32)
Size (MB) 1.000* (1048576 bytes)
Partition 4:
[Empty]
---------------------------------------------------------------------------
Here's a line-by-line description of what the numbers are, and how I got
them:
Physical Drives Detected: 1
This should be the number of PHYSICAL drive units. If you have a RAID
system, the entire RAID will probably show up as one unit. I get this
value by using the OS/2 API, DosPhysicalDisk, function
INFO_COUNT_PARTITIONABLE_DISKS.
Drive Information for Physical Disk 1:
Cylinders 012E (302)
Heads 40 (64)
Sectors/Track 20 (32)
This is the physical geometry for the disk. I get these values by using
the OS/2 API DosDevIOCtl, CATEGORY_PHYSDISK, function GET_DEV_PARMS.
Total Sectors 00097000* (618496)
This value is calculated by multiplying Cylinders * Heads * Sectors/Track.
Drive Size (MB) 302.000* (316669952 bytes)
This value is calculated by multiplying Total Sectors * 512.
Partition 1:
Drive D:
This indicates that a drive letter should be assigned to this partition. I
use a similar algorithm to what OS/2 uses. The first ACTIVE PRIMARY partition
on each drive gets drive letters starting with C:. Then I scan each drive
looking for logical drives in extended partitions. If they are a recognized
type (FAT, IFS), I assign a drive letter. This does *not* mean that the drive
is currently assigned that letter - this value is not checked, it is just
an aid in figuring out what drive you are viewing.
Boot Indicator 00 (0)
This value is the first byte of an EBR/MBR partition record, and will be
0x80 if the partition is ACTIVE/STARTABLE. I get this value by reading
the MBR/EBR from disk.
Partition Type 05 (5) [Extended]
This value is the fifth byte of an MBR/EBR partition record. It tells
us what kind of filesystem is in this partition. An extended partition
points to an EBR, which contains one or more partitions. This value
is read directly from the MBR/EBR.
Begin CHS 00A,00,01 (10,0,1)
End CHS 12C,3F,20 (300,63,32)
These values give the Cylinder/Head/Sector of the beginning and end of
this partition. These are read directly from the MBR/EBR.
Rel Sectors 00005000 (20480)
This value is the number of sectors between the MBR/EBR and the start of
the partition. It is read directly from the MBR/EBR.
Sectors 00091800 (595968)
This is the number of sectors in the partition. This number does not include
those sectors between the MBR/EBR and the start of partition. This value
is read directly from the MBR/EBR.
Begin RBA 00005000* (20480)
End RBA 000967FF* (616447)
This is the "Relative Block Address" of the beginning and end of the
partition. An RBA is a way of representing sectors regardless of the
CHS geometry. RBA 0 is the first sector on a disk, and is where the MBR
is stored. I calculate the Begin RBA by adding Rel Sectors to the RBA of
the MBR or EBR where this partition is recorded. I calculate End RBA by
adding Sectors to the Begin RBA.
Begin CHS 00A,00,01* (10,0,1)
End CHS 12C,3F,20* (300,63,32)
These numbers are calculated by CHKPART to verify the values stored in the
MBR/EBR. I use the Begin and End RBA, convert them to CHS, and make
sure they match what is on disk.
Logical Cylinders 00DD (221)
Heads (BPB) 40 (64)
Sectors/Track (BPB) 20 (32)
This is the LOGICAL geometry for the partition. It only appears if the
partition has a BPB (BIOS Parameter Block). It is legal to have a different
logical geometry in each partition, and it can be very confusing as well.
These values are read from the BPB.
Sectors (BPB) 0006E7E0 (452576)
If the partition has a BPB, the number of sectors in the partition is stored
in one of two places. CHKPART looks in both places, and finds the valid one.
This should match the value from the MBR/EBR.
Sectors (HPFS) 0006E7E0 (452576)
If the partition is HPFS, CHKPART will look into the HPFS structure and get
the recorded partition size. It may not match the other values, as HPFS
rounds all partitions down to the nearest multiple of 4. This value is
read from the HPFS SuperBlock.
Size (MB) 291.000* (305135616 bytes)
This is the size of the partition, calculated by taking the Sectors value and
converting it to Megabytes.
USING CHKPART TO DIAGNOSE GEOMETRY PROBLEMS
-------------------------------------------
Often, MBR/EBR problems are caused by differences between BIOS
geometry and the geometry presented after loading a device driver.
To test this, use the following procedure:
- Run CHKPART.EXE, using your normal CONFIG.SYS, and record the
results.
- Create an OS/2 boot diskette that uses IBMINT13.I13 as the only disk
device driver. Edit the CONFIG.SYS on the bootable diskette, and
REM out all other disk device drivers (IBM1S506.ADD for IDE drives).
If you do this properly, when you run RMVIEW /IRQ (the RMVIEW
utility comes with OS/2 Warp), you'll see that the driver on IRQ14
is the INT13 BIOS driver.
- Run CHKPART.EXE against the INT 13 driver. Compare the two results.
You should not see a change in geometry (HEADS and SECTORS/TRACK
should be the same in both reports).
If your geometry figures change between INT 13 and your disk device driver,
you have a problem that must be fixed. OS/2 uses BIOS to load the MBR and
EBR's, Boot Manager, and the first stages of OS/2 boot. Once the OS2KRNL
file is loaded, the device driver can be loaded. Why does this cause a
problem? If you use FDISK while under the control of the device driver, and
change any partitions, when you reboot, the device driver won't be around,
and the partition table will look corrupted.
How do you fix this problem? It depends. You must get your BIOS and your
device driver to agree on the geometry. You may be able to change settings
to modify the BIOS geometry (some computers have user defined disk geometry
settings in CMOS), or you may be able to pass a parameter to your device
driver to modify the DD geometry. If you are using the IBM1S506 device driver,
you can have it do automatic geometry translation for you. For example, if
your drive is 8100 cylinders * 16 heads * 63 sectors/track, and BIOS used
translation to allow DOS to use the entire disk, it might have used the
translated geometry of 526 Cylinders * 255 heads * 63 sectors/track. To have
IBM1S506 do the same thing, use the command:
BASEDEV=IBM1S506 /A:0 /U:0 /GEO:(8100,16,63),(526,255,63)
The switch /A:0 specifies the first IDE adapter
The switch /U:0 specifies the first IDE drive on that adapter.