分类: 服务器与存储
2010-07-08 15:24:44
HDIO_GETGEO - Returns the BIOS disk parameters in the following structure:
struct hd_geometry {
unsigned char heads;
unsigned char sectors;
unsigned short cylinders;
unsigned long start;
};
A pointer to this structure is passed as the (2) parameter.
The information returned in the parameter is the disk geometry of the drive as understood by DOS! This geometry is not the physical geometry of the drive. It is used when constructing the drive's partition table, however, and is needed for convenient operation of (1), (1), and (1). If the geometry information is not available, zero will be returned for all of the parameters.
BLKGETSIZE Returns the device size in sectors. The (2) parameter should be a pointer to a long.
On Mon, May 22, 2000 at 04:47:16PM +0100, David Woodhouse wrote: > said: > > > What if BLKGETSIZE/(H*S) isn't an integer? > > / is the C operator. It rounds down. > > Sorry, what I meant to say was: > > What if (BLKGETSIZE / (H*S)) * (H*S) != BLKGETSIZE? > > Is there anything that's likely to get confused by that? No. It happens all the time: # hdparm -g /dev/hda geometry = 2100/255/63, sectors = 33750864, start = 0 and 2100*255*63 = 33736500 < 33750864. It just means that if you use an fdisk that likes partitions to start and end on cylinder boundaries, the last partial cylinder is wasted. In this case that would be 7 MB.