Method and system for determining the data layout geometry of a disk drive

A system and method for determining the disk drive parameters of any disk drive that may be encountered. A novel access pattern is applied to the disk drive and a novel technique used to interpret the measured results. In order to determine a data layout geometry of a disk drive, a plurality of sectors on the disk drive are accessed in sequentially decreasing order, starting from an initial sector. A completion time for each access is measured and parameters related to the data layout geometry of the disk drive are determined based on the measured access times. In order to determine the layout geometry, sectors immediately preceding track and cylinder skews are identified and a number of sectors per track and a number of tracks per cylinder are determined based on the identified sectors.

FIELD OF THE INVENTION
 The present invention relates to a method of determining the data layout
 geometry of a disk drive by applying a novel access pattern and
 interpretation of the measured results.
 BACKGROUND OF THE INVENTION
 Modem disk drives store data in blocks with a fixed size. The physical
 block in a drive are termed sectors. The sectors are arranged in tracks,
 each track having a fixed number of sectors, and the tracks are arranged
 in cylinders. Many of today's magnetic disk drives employ zone recording,
 where all tracks within a zone have the same number of sectors per track.
 The sectors may be skewed from track to track and from cylinder to
 cylinder.
 These disk drive parameters, namely, a number of tracks per cylinder,
 number of zones, number of sectors per track in each zone, track skew, and
 cylinder skew, define the data layout geometry of a disk drive. These
 parameters affect the performance characteristics of a disk drive. An
 additional parameter that affects the disk drive performance is the
 drive's rotational speed. A need arises for a technique with which these
 disk drive parameters may be quickly and easily determined, for any disk
 drive encountered.
 SUMMARY OF THE INVENTION
 The present invention is a system and method for determining the disk drive
 parameters of any disk drive that may be encountered. By applying a
 special access pattern to the disk drive and a special technique of
 interpreting the measured results, the present invention can determine the
 number of data tracks per cylinder, the number of recording zones, number
 of sectors per track in each zone, the track skew, the cylinder skew, and
 the rotational speed of the disk drive.
 In order to determine a data layout geometry of a disk drive, a plurality
 of sectors on the disk drive are accessed in sequentially decreasing
 order, starting from an initial sector. A completion time for each access
 is measured and parameters related to the data layout geometry of the disk
 drive are determined based on the measured access times. In order to
 determine the layout geometry, sectors immediately preceding track and
 cylinder skews are identified and a number of sectors per track and a
 number of tracks per cylinder are determined based on the identified
 sectors.
 In order to identify the sectors, an average completion time of all
 measured access times is determined. All measured access times that are
 less than the average completion time by at least a predefined threshold
 are identified. A standard completion time, which is an average of all
 measured access times, excluding those measured access times that are less
 than the average completion time by at least the predefined threshold, is
 determined. Logical block addresses corresponding to the measured access
 times that are less than the average completion time by at least the
 predefined threshold are identified. A skew time for each identified
 logical block address is determined by subtracting the measured access
 time for the logical block address from the standard reference time and
 each skew time is identified as either a track skew or a cylinder skew
 based on the size of the skew time.
 A number of sectors per track is determined based on a sector distance
 between identified sectors immediately preceding track skews and a number
 of tracks per cylinder is determined based on a number of tracks between
 identified sectors immediately preceding cylinder skews. A rotational
 speed of the disk drive is determined based on the determined number of
 sectors per track and the determined standard reference time in accordance
 with:
EQU rpm=60.times.(S-l)/(S.times.T),
 where rpm is the rotational speed of the disk drive, S is the number of
 sectors per track and T is the standard reference time.
 In another embodiment of the present invention, a zone layout of the disk
 drive is determined by repeatedly determining a number of sectors per
 track at a plurality of locations on the disk drive. Each determination is
 made using a different initial sector sector. The initial sector to be
 used for each determination is selected from the set {0, W/X, 2W/X, 3W/X,
 . . . , (X-1)W/X)}, wherein W is the maximum logical block address of the
 disk drive and X is a positive integer.

DETAILED DESCRIPTION OF THE INVENTION
 A typical conventional disk drive 100 is shown in FIG. 1. Disk drive 100
 includes at least one disk 102, upon which data is recorded. Disk 102 may
 be a rigid disk, as shown, or it may be a floppy disk. Data may be
 recorded magnetically, optically, or magneto-optically. There may be only
 one disk 102, as shown, or there may be a plurality of disks, typically
 arranged in a coaxial stack. Each disk 102 has two surfaces 104 and 106.
 On some disks, such as that shown, data may be recorded on both surfaces,
 while, on other disks, data may be recorded only on one surface. Data is
 written to, and read from, disk 102 by head 108, which includes a
 mechanism and circuitry appropriate for the recording technique used.
 There is at least one head for each surface on which data is recorded.
 Head 108 is moved across the surface of disk 102 by actuator 110.
 Typically, all heads are moved simultaneously by the actuator.
 The organization of data recorded on a disk drive, such as drive 100, is
 shown in FIG. 2. Typically, data is stored on a disk in fixed size blocks.
 The physical blocks on a disk are referred to as sectors, such as sector
 202, shown in FIG. 2. The sectors that pass under a recording head during
 one revolution of the disk are called a track, such as track 204.
 Typically, physical sectors are mapped to logical sectors or block, and
 logical blocks are manipulated by the host computer system.
 In a common data layout for magnetic disk drives, the first logical block
 (with a Logical Block Address or LBA of 1) is located on the first
 physical track (accessed by recording head 1) at the outermost diameter of
 the first recording surface. The next logical block 2 is physically the
 next sector that follows LBA 1. This continues until the end of the track
 is reached. In the example of FIG. 2 there are 24 sectors per track.
 As shown in FIG. 3, the next logical block after the last block of track 1
 is located on the first physical track at the outermost diameter of the
 next recording surface (accessed by recording head 2). Typically this
 first block of the second track is not located at the same relative
 angular position as the first block of the first track, but is offset by a
 small angular amount, as illustrated in FIG. 3. This offset is referred to
 as a track skew. The reason is to allow the disk drive time to switch from
 accessing data using recording head 1 to recording head 2, which takes a
 non-zero amount of time. This way, the drive can continuously access
 logically contiguous data without missing revolutions.
 This data layout scheme continues until the last sector in the first track
 of the last recording surface is reached. The first track of each of the
 recording surface collectively form the first cylinder of the disk drive.
 The next logical block after the last sector of cylinder 1 is located on
 the second physical track of the first recording surface. Once again, this
 first sector is offset by a small angular amount from the first sector of
 the last track of the previous cylinder. This offset is referred to as a
 cylinder skew. The reason is the same as that for track skew. However,
 cylinder skew is typically larger than track skew because an actuator
 movement (a one cylinder seek) is involved.
 Many of today's magnetic disk drives employ zone recording, where each
 recording surface is divided into concentric rings of recording areas or
 zones. The purpose is to increase the data storage efficiency of the disk
 drive. All the tracks within a zone have the same number of sectors per
 track. The outermost zone has the most number of sectors per track. As one
 moves from the outer-diameter of the disk towards the inner-diameter, the
 number of sectors per track decreases from zone to zone.
 These disk drive parameters, namely, number of tracks per cylinder, number
 of zones, number of sectors per track in each zone, track skew, and
 cylinder skew, define the data layout geometry of a disk drive. These
 parameters affect the performance characteristics of a disk drive. The
 present invention determines these parameters by measuring certain
 performance characteristics of the disk drive.
 A system 400 which determines the data layout geometry of a disk drive,
 according to the present invention, is shown in FIG. 4. System 400
 includes computer system 402 and the disk drive 404, which is under test.
 Computer system 402 is typically a personal computer or workstation, but
 may be a minicomputer or mainframe computer. Computer system 402 includes
 processor (CPU) 406, input/output circuitry 408, disk drive adapter 410,
 and memory 412. CPU 406 executes program instructions in order to carry
 out the functions of the present invention. Typically, CPU 406 is a
 microprocessor, such as an INTEL PENTIUM.RTM. processor, but may also be a
 minicomputer or mainframe computer processor. Input/output circuitry 408
 provides the capability to input data to, or output data from, computer
 system 402. For example, input/output circuitry may include input devices,
 such as keyboards, mice, touchpads, trackballs, scanners, etc., output
 devices, such as video adapters, monitors, printers, etc., and
 input/output devices, such as, modems, network adapters, etc. Disk adapter
 410 provides computer system 402 with the capability to read, write and
 control disk drive 404. Typically, disk adapter 410 is an integrated drive
 electronics (IDE) based device, or a variation or enhancement thereof,
 such as enhanced IDE (EIDE) or ultra direct memory access (UDMA), or a
 small computer system interface (SCSI) based device, or a variation or
 enhancement thereof, such as fast-SCSI, wide-SCSI, fast and wide-SCSI,
 etc, or a fiber channel-arbitrated loop (FC-AL) device.
 Memory 412 stores program instructions that are executed by, and data that
 is used by, CPU 406 to perform the functions of the present invention.
 Memory 412 may include electronic memory devices, such as random-access
 memory (RAM), read-only memory (ROM), programmable read-only memory
 (PROM), electrically erasable programmable read-only memory (EEPROM),
 flash memory, etc., and electromechanical memory, such as magnetic disk
 drives, tape drives, optical disk drives, etc. Memory 412 includes a
 plurality of blocks of program instructions, such as disk drivers 414,
 disk layout and geometry routines 416, user interface routines 418, and
 operating system 420. Disk drivers 414 provide a software interface
 between software and the hardware, such as disk adapter 410 and disk drive
 404. Disk layout and geometry routines 416 perform a determination of the
 data layout of disk drive 404, according to the present invention. Disk
 layout and geometry routines 416 include command timing routine 422, which
 determines the elapsed time from when an I/O command is issued to disk
 drive 404 to when the command is completed. Typically, this timing is done
 by observing the system clock at the time the command is issued and again
 when the computer receives command complete indication. Alternatively, a
 hardware command timer may be provided instead.
 User interface routines 418 provide interface between software and the
 user, such as keyboard input and screen output. Operating system 420
 provides overall system functionality.
 Disk drive 404 is typically a separate disk drive that is connected to
 computer system 402 for the purpose of determining the data layout
 geometry of disk drive 404. However, since memory 412 may include a disk
 drive, the data layout geometry of that disk drive may likewise be
 determined with the present invention. Thus, the present invention may be
 used to determine the data layout geometry of any disk drive connected to
 computer system 402, whether internal or external, and whether or not the
 disk drive contains data and/or program instructions used by computer
 system 402.
 A process 500, for determining the data layout geometry of a disk drive,
 according to the present invention, is shown in FIG. 5. FIG. 5 is best
 viewed in conjunction with FIG. 6. The process begins with step 502, in
 which the appropriate caching is disabled and/or flushed. Any system
 caching in the computer must be bypassed. If the disk accesses to be used
 are write commands, the write cache in the disk drive is disabled. If the
 disk accesses to be used are read commands, and the disk drive under test
 does zero-latency reads, the read cache in the disk drive is disabled. If
 the disk accesses to be used are read commands, and the disk drive under
 test does not do zero-latency reads, the read cache is either flushed or
 disabled. If the disk drive supports a flush cache command, the read cache
 is flushed by issuing a flush cache command. If the disk drive does not
 support a flush cache command, flushing of the cache is simulated by
 issuing many read commands to the drive to many different LBA's that are
 far away from the LBA's used in the test pattern of the next step. This
 will ensure that the cache is filled with data that are not associated
 with the test pattern of the next step, guaranteeing that when the test
 pattern is issued, the data will not be found in the cache.
 Either type of access, read or write, may be used. Thus, alternative
 embodiments of the processes use write operations, or combinations of read
 and write operations. Read operations are preferred as they do not alter
 the data recorded on the disk drive, but where the data may be altered,
 write operations may be used.
 In step 504, the computer system accesses (reads or writes) a plurality of
 sectors, in sequentially decreasing order, starting from an initial
 sector, LBA N. The computer system accesses M sectors, starting at LBA
 N+M, and decrements down to LBA N+1. Thus, the sequence of accesses in
 step 504 is as follows:
 Read LBA N+M for 1 sector
 Read LBA N+M-1 for 1 sector
 Read LBA N+M-2 for 1 sector
 Read LBA N+M-3 for 1 sector
 Read LBA N+M-4 for 1 sector
 Read LBA N+4 for 1 sector
 Read LBA N+3 for 1 sector
 Read LBA N+2 for 1 sector
 Read LBA N+1 for 1 sector
 For example, if N=0 and M=100, the pattern would look like:
 Read LBA 100 for 1 sector
 Read LBA 99 for 1 sector
 Read LBA 98 for 1 sector
 Read LBA 97 for 1 sector
 Read LBA 96 for 1 sector
 Read LBA 4 for 1 sector
 Read LBA 3 for 1 sector
 Read LBA 2 for 1 sector
 Read LBA 1 for 1 sector
 Each command is issued to the disk drive by the computer which waits for
 its completion before the next command is issued. In other words, no
 command is queued in the disk drive. The computer issues the next command
 without any delay as soon as the current command is completed. The command
 completion time of each access is timed.
 An exemplary timing pattern, for a disk drive having the data layout
 geometry shown in FIG. 3, is shown in FIG. 6. In this example, N=1 and
 M=100. As shown, the pattern formed is generally a straight line.
 Additionally, there are a plurality of dips, such as dip 602 and dip 603.
 For ease of identification, each dip in FIG. 6 is labeled with its
 associated LBA number. Except for the dips, each point is the time of one
 disk revolution minus one sector time, identified as 601 in FIG. 6. In
 other words, if S is the number of sectors per track and R is the time of
 one revolution, then the value of 601 is R*(S-1)/S. This time is termed
 the standard reference time. For the example given in FIG. 6, where R=10
 msec and S=24, the standard reference time is 9.583 msec.
 Each dip represents the last sector of a track, caused by either a track
 skew or a cylinder skew. The value of the dip from the standard reference
 time represents the amount of the skew. Thus, in FIG. 6, the dip labeled
 602, with a value of 2.083 msec., represents the track skew, while the
 larger dip labeled 603, with a value of 3.333 msec., represents the
 cylinder skew.
 In step 506, a time termed the overall average completion time is
 determined. This time is the average access completion time of all M
 sectors that have been accessed. This average time will be slightly lower
 than the standard reference time because of the dips caused by the skews.
 For the example shown in FIG. 6, this average value is 9.475 msec
 In step 508, the standard reference time is determined. This is done by
 determining the average command completion time of all those commands
 whose completion time deviates from the overall average time by less than
 some threshold. This threshold, which can be user specified, represents a
 value slightly less than the smallest skew found in today's disk drives.
 In the example of FIG. 6, and also for most of today's drives, a threshold
 of 1 msec. can be used. By excluding those command completion times that
 exceed this threshold, the dips are eliminated in calculating this average
 command completion time. Therefore, the average command completion time
 computed in this step is the desired standard reference time.
 In step 510, the LBA's corresponding to the dips are identified. These are
 the LBA's whose command completion time deviates from the standard
 reference time by more than the threshold described in step 508.
 In step 512, for each LBA identified in step 510, the skew is calculated by
 subtracting the command completion time of the LBA from the standard
 reference time. For example, in FIG. 6, the command completion time for
 LBA 24 is 7.5 msec. Subtracting that from the standard reference time of
 9.583 msec yields a skew time of 2.083 msec. Likewise, for LBA 48, the
 command completion time is 6.25 msec and the skew time is 3.333 msec. In
 step 514, the dips corresponding to track and cylinder skew are
 identified. The dips corresponding to cylinder skew have greater skew time
 than the dips corresponding to track skew. For example, in FIG. 6, dip 602
 corresponds to a track skew, and dip 603 corresponds to a cylinder skew.
 Thus, LBA 24, which is associated with dip 602, is the last sector of a
 track and is the sector immediately preceding the skew between the track
 including LBA 24 and the next track. Likewise, LBA 48, which is associated
 with dip 603, is the last sector of a cylinder, and is the sector
 immediately preceding the skew between the cylinder including LBA 48 and
 the next cylinder.
 In step 516, the sectors per track and tracks per cylinder of the disk
 drive are determined. The distance, in sectors, between the LBA's
 associated with dips, is the number of sectors per track. The number of
 tracks between cylinder skews is the number of tracks per cylinder.
 In step 518, the rotational speed of the drive is determined. The rpm of
 the drive is given by the equation:
EQU rpm=60 sec..times.(S-1)/(S.times.T),
 where S is the number of sectors per track and T is the standard reference
 time, both determined in above. For the example of FIGS. 6, since T=9.583
 msec. and S=24, the rpm=60.times.(24-1)/9.583.times.24=6000.
 To determine the data geometry layout of a disk at the outer diameter,
 process 500 is performed using N=0 and M being a number larger than the
 largest number of sectors per cylinder in typical modern disk drives, such
 as 8000.
 A process 700 for determining the zoning information of the disk drive is
 shown in FIG. 7. Essentially, the disk drive is sampled, using steps
 504-516 of FIG. 5, at a plurality of starting sectors through out the
 drive. Process 700 begins with step 702, in which caching is disabled
 and/or flushed, as in step 502 of FIG. 5. In step 704, steps 504-516 are
 performed for a plurality of starting sectors N. Sampling is accomplished
 by selecting LBA N to be at various part of the disk drive. For example,
 if W is the maximum LBA of the entire drive, repeat steps 504-516 using N
 from the set {0, W/100, 2W/100, 3/100, . . . , 99W/100}. Since the number
 of tracks per cylinder is fixed throughout a drive, and is determined in
 the first performance of process 500, it does not need to be determined
 here again. For zoning information, one is only interested in the number
 of sectors per track for each zone. Therefore, a smaller value of M can be
 selected than in process 500.
 In step 706, the zone layout of the disk drive is determined by determining
 the number of sectors per track for each sample value of N.
 Although specific embodiments of the present invention have been described,
 it will be understood by those of skill in the art that there are other
 embodiments that are equivalent to the described embodiments. Accordingly,
 it is to be understood that the invention is not to be limited by the
 specific illustrated embodiments, but only by the scope of the appended
 claims.