{"id":284,"date":"2020-08-18T19:23:47","date_gmt":"2020-08-18T20:23:47","guid":{"rendered":"http:\/\/www.linux-tutorial.info\/?page_id=77"},"modified":"2020-08-22T19:26:01","modified_gmt":"2020-08-22T20:26:01","slug":"this-is-the-page-title-toplevel-119","status":"publish","type":"page","link":"http:\/\/www.linux-tutorial.info\/?page_id=284","title":{"rendered":"Hard Disks"},"content":{"rendered":"\n<title>Hard Disks<\/title>\n<p>\nYou&#8217;ve got to have a hard disk. You could actually run Linux from a floppy (even\na high-density 5.25&#8243; floppy), but life is so much easier when you run from the\nhard disk. Not only do you have space to save your files, you have access to all\nthe wonderful tools that Linux provides.\n<!-- START copyrightDavid Rusling:1996-1999:GNU General Public License -->\nDisk drives provide a more permanent method for storing data, keeping it on\nspinning disk platters.\nTo write data, a tiny head magnetizes minute particles on the platter&#8217;s surface.\nThe data is read by a head, which can detect whether a particular minute\nparticle is magnetized.\n<!-- END copyrightDavid Rusling:1996-1999:GNU General Public License -->\n(Note that running Linux off of a floppy, such as as a router or fire wall is not a\nbad idea. You still have the basic functionality you need and there is very little to\nhack.)\n<p>\nA hard disk is composed of several physical disks, called platters,\nwhich are made of aluminum, glass or ceramic-composites and coated with either\nan &#8220;oxide&#8221; media (the stuff on the disks) or &#8220;thin film&#8221; media. Because &#8220;thin\nfilm&#8221; is thinner than oxide, the denser (that is, larger) hard disks are\nmore likely to have thin film. The more platters you have, the more data you can store.\n<\/p>\n<p>\nPlatters are usually the\nsame size as floppies. Older platters were 5.25&#8243; round, and the newer ones are\n3.5&#8243; round. (If someone knows the reason for this, I would love to hear it.) In\nthe center of each platter is a hole though which the spindle sticks. In other\nwords, the platters rotate around the spindle. The functionality is the same as\nwith a phonograph record. (Remember those?)\n<!-- START copyright David Rusling:1996-1999:GNU General Public License -->\nThe platters spin at a constant speed that\ncan vary between 3000 and 15,000 RPM depending on the model.\nCompare this to a floppy disk which only spins at 360 RPM.\nThe disk&#8217;s read\/write heads are responsible for reading and writing data and\nthere is a pair for each platter, one head for each surface.\nThe read\/write heads do not physically touch the surface of the platters,\ninstead they float on a very thin (10 millionths of an inch) cushion of air.\nThe read\/write heads are moved across the surface of the platters by an\nactuator. All of the read\/write heads are attached together, they all move across the\nsurfaces of the platters together.\n<!-- END copyright David Rusling:1996-1999:GNU General Public License -->\n<p>\nThe media that coats the\nplatters is very thin. about 30 millionths of an inch. The media has magnetic\nproperties that can change its alignment when it is exposed to a magnetic field.\nThat magnetic field comes in the form of the hard disks read\/write heads. It is\nthe change in alignment of this magnetic media that enables data to be stored on\nthe hard disk.\n<\/p>\n<p>\nAs I said earlier, a read\/write head does just that: it\nreads and writes. There is usually one head per surface of the platters (top and\nbottom). That means that there are usually twice as many heads as platters.\nHowever, this is not always the case. Sometimes the top- and bottom-most\nsurfaces do not have heads.\n<\/p>\n<p>\nThe head moves across the platters that are\nspinning several <i><em>thousand<\/em> <\/i>times a minute (at least 60 times a\nsecond!). The gap between the head and platter is smaller that a human hair,\nsmaller than a particle of smoke. For this reason, hard disks are manufactured\nand repaired in rooms where the number of particles in the air is fewer than 100\nparticles per cubic <i><em>meter<\/i><\/em>.\n<\/p>\n<p>\nBecause of this very small gap\nand the high speeds in which the platters are rotating, if the head comes into\ncontact with the surface of a platter, the result is (aptly named) a head crash.\nMore than likely this will cause some physical damage to your hard disk.\n(Imagine burying your face into an asphalt street going even only 20 MPH!)\n<\/p>\n<p>\nThe heads move in and out across the platters by the older stepping motor\nor the new, more efficient voice-coil motor. Stepping motors rotate and monitor\ntheir movement based on notches or indentations. Voice-coil motors operate on\nthe same principle as a stereo speaker. A magnet inside the speaker causes the\nspeaker cone to move in time to the music (or with the voice). Because there are\nno notches to determine movement, one surface of the platters is marked with\nspecial signals. Because the head above this surface has no write capabilities,\nthis surface cannot be used for any other purpose.\n<\/p>\n<p>\nThe voice-coil motor\nenables finer control and is not subject to the problems of heat expanding the\ndisk because the marks are expanded as well. Another fringe benefit is that\nbecause the voice-coil operates on electricity, once power is removed, the disk\nmoves back to its starting position because it no longer is resisting a\n&#8220;retaining&#8221; spring. This is called &#8220;automatic head parking.&#8221;\n<\/p>\n<p>\n<!-- START copyright David Rusling:1996-1999:GNU General Public License -->\nEach surface of the platter is divided into narrow, concentric circles called\n<em>tracks<\/em>. Track 0 is the outermost track and the highest numbered track is the track\nclosest to the central spindle. A <em>cylinder<\/em> is the set of all tracks with the\nsame number. So all of the 5th tracks from each side of every platter in the disk is known\nas cylinder 5. As the number of cylinders is the same as the number of tracks, you\noften see disk geometries described in terms of cylinders. Each track is divided\ninto <em>sectors<\/em>.\nA sector is the smallest unit of data that can be written to or read from\na hard disk and it is also the disk&#8217;s block size.\nA common sector size is 512 bytes and the sector size was set when the disk was\nformatted, usually when the disk is manufactured.\n<!-- END copyright David Rusling:1996-1999:GNU General Public License -->\n<p>\nSince data is stored physically on the disk in concentric rings, the head does\nnot spiral in like a phonograph record but rather moves in and out across the\nrings (the tracks). Because the heads move in unison across the\nsurface of their respective platters, data are usually stored not in consecutive\ntracks but rather in the tracks that are positioned directly above or below\nthem. Therefore, hard disks read from successive tracks on\nthe same <glossary>cylinder<\/glossary> and not the same surface.\n<\/p>\n<p>\nThink of it this way. As the\ndisk is spinning under the head, it is busy reading data. If it needs to read\nmore data than what fits on a single track, it has to get it from a different\ntrack. Assume data were read from consecutive tracks. When the disk finished\nreading from one track, it would have to move in (or out) to the next track\nbefore it could continue. Because tracks are rings and the end is the beginning,\nthe delay in moving out (or in) one track causes the beginning of the next track\nto spin past the position of the head before the disk can start reading it.\nTherefore, the disk must wait until the beginning comes around again. Granted,\nyou could stager the start of each track, but this makes seeking a particular\nspot much more difficult.\n<\/p>\n<p>\nLet&#8217;s now look at when data are read from\nconsecutive tracks (that is, one complete <glossary>cylinder<\/glossary>\nis read before it goes on).\nOnce the disk has read the entire contents of a track and has reached the end,\nthe beginning of the track just below it is just now spinning under the head.\nTherefore, by switching the head it is reading from, the disk can begin to read\n(or write) as though nothing was different. No movement must take place and the\nreads occur much faster.\n<\/p>\n<p>\nEach track is broken down into smaller chunks\ncalled sectors. The number of sectors into which each track is divided is called\nsectors per track, or sectors\/track. Although any value is possible, common\nvalues for sectors\/track are 17, 24, 32, and 64. (These are shown graphically in\nFigure 0-12.)<\/p>\n<p>\nEach <glossary>sector<\/glossary>\ncontains 512 bytes of data. However, each sector\ncan contain up to 571 bytes of information. Each <glossary>sector<\/glossary>\ncontains information\nthat indicates the start and end of the <glossary>sector<\/glossary>,\n which is only ever changed by a\nlow-level format. In addition, space is reserved for a <glossary>checksum<\/glossary>\ncontained in the\ndata portion of the <glossary>sector<\/glossary>.\n If the calculated <glossary>checksum<\/glossary>\ndoes not match the\nchecksum in this field, the disk will report an error.\n<\/p>\n<p>\n<img decoding=\"async\" src=\"harddisk.png\" width=490 height=379 border=0 usemap=#harddisk_map>\n<map name=\"harddisk_map\">\n<area shape=\"RECT\" coords=\"297,52,435,116\" href=\"popup#Hard disk Sector#A track is divided into sectors, which are data blocks of 512 bytes.\">\n<area shape=\"POLY\" coords=\"184,89,199,376,321,352,322,108,230,74\" href=\"popup#Hard disk Sector#A track is divided into sectors, which are data blocks of 512 bytes.\">\n<area shape=\"RECT\" coords=\"117,43,246,88\" href=\"popup#Hard disk#A hard disk rotates on a central spindel.\">\n<area shape=\"RECT\" coords=\"121,131,188,150\" href=\"popup#Hard disk#A hard disk rotates on a central spindel.\">\n<area shape=\"RECT\" coords=\"126,195,188,211\" href=\"popup#Hard disk#A hard disk rotates on a central spindel.\">\n<area shape=\"RECT\" coords=\"126,255,188,270\" href=\"popup#Hard disk#A hard disk rotates on a central spindel.\">\n<area shape=\"RECT\" coords=\"126,195,188,211\" href=\"popup#Hard disk#A hard disk rotates on a central spindel.\">\n<area shape=\"RECT\" coords=\"126,315,188,333\" href=\"popup#Hard disk#A hard disk rotates on a central spindel.\">\n<area shape=\"RECT\" coords=\"4,2,66,377\" href=\"popup#Hard disk Cylinder#Cylinders are concentric rings and measure the distance from the central spindel.\">\n<area shape=\"RECT\" coords=\"323,200,489,337\" href=\"popup#Hard disk Platter#A platter is a metal disk coating with a material similar to video tapes. Made of metal, this is what gives a hard disk its name.\">\n<area shape=\"RECT\" coords=\"10,21,346,375\" href=\"popup#Hard disk Platter#A platter is a metal disk coating with a material similar to video tapes. Made of metal, this is what gives a hard disk its name.\">\n<area shape=\"RECT\" coords=\"235,123,450,170\" href=\"popup#Hard disk Sector#A track is divided into sectors, which are data blocks of 512 bytes.\">\n<\/map>\n<p>\n<icaption>Image &#8211; Logical Components of a Hard Disk (<b>interactive<\/b>)<\/icaption>\n<p>\nThis difference between the total number of bytes per\nsector and the actual amount of data has been cause for a fair amount of grief.\nFor example, in trying to sell you a hard disk, the salesperson might praise the\ntremendous amount of space that the hard disk has. You might be amazed at the\nlow cost of a 1G drive.\n<\/p>\n<p>\nThere are two things to watch out for. Computers\ncount in twos, humans count in tens. Despite what the salesperson wants you to\nbelieve (or believes himself), a hard disk with 1 billion bytes is <em>not<\/em>\na 1 <glossary>gigabyte<\/glossary>\ndrive it is only 10<sup>9 <\/sup>bytes. One gigabyte means 2<sup>30\n<\/sup>bytes. A hard disk with 10<sup>9 <\/sup>(1 billion) is only about 950\nmegabytes. This is five percent smaller!\n<\/p>\n<p>\nThe next thing is that seller\nwill often state is the <i>unformatted<\/i> storage capacity of a drive. This is\nthe number that you would get if you multiplied all the sectors on the disk by\n571 (see the preceding discussion). Therefore, the unformatted size is\nirrelevant to almost all users. Typical formatted MFM drives give the user 85\npercent of the unformatted size, and RLL drives give the user about 89 percent.\n(MFM and RLL are formatting standards, the specifics of which are beyond the\nscope of this book. )<\/p>\n<p>\nThis brings up an interesting question. If the\nmanufacturer is telling us the unformatted size and the formatted size is\n<i>about <\/i>85 percent for MFM and 89 percent for <glossary>SCSI<\/glossary>\n\/<glossary>IDE<\/glossary> (using RLL), how can\nI figure out how much usable space there really is? Elementary, my dear Watson:\nIts a matter of multiplication.\n<\/p>\n<p>\nLets start at the beginning. Normally when\nyou get a hard disk, it comes with reference material that indicates how many\ncylinders, heads, and sectors per track there are (among other things). The set\nof all tracks at the same distance from the spindle is a <glossary>cylinder<\/glossary>.\n The number of\ncylinders is therefore simply the number of tracks because a track is on one\nsurface and a <glossary>cylinder<\/glossary>\nis all tracks at the same distance. Because you can only\nuse those surfaces that have a head associated with them, you can calculate the\nnumber of total tracks by multiplying the number of cylinders by the number of\nheads. In other words, take the number of tracks on a surface and multiply it by\nthe number of surfaces. This gives you the total number of tracks.\n<\/p>\n<p>\nFrom our discussion of tracks, you know that each track is divided into a specific\nnumber of sectors. To find the total number of sectors, simply multiply the\nnumber of total tracks that we calculated above by the sectors per track. Once\nyou have the total number of sectors, multiply this by 512 (the number of bytes\n<i>of data <\/i>in a sector). This give us the total number of <em>bytes<\/em> on\nthe hard disk. To figure out how may megabytes this is, simply divide this\nnumber by 1,048,576 (1024 x 1024 = 1MB).\n<\/p>\n<!--<p>\nFor those of you who need to see it as an equation (I always hated word problems myself)\n<\/p> -->\n<p>\n<!-- START copyright David Rusling:1996-1999:GNU General Public License -->\nHard disks can be further subdivided into <em>partitions<\/em>. A partition is a large group of\nsectors allocated for a particular purpose. Partitioning a disk allows the disk to be used by\nseveral operating system or for several purposes. A lot of Linux systems have a single disk with\nthree partitions; one containing a DOS filesystem,\nanother an EXT2 filesystem and a third for the swap partition.\nThe partitions of a hard disk are described by a partition table; each entry\ndescribing where the partition starts and ends in terms of heads, sectors and cylinder\nnumbers. For DOS formatted disks, those formatted by fdisk,\nthere are four primary disk partitions. Not all four entries in the partition table have\nto be used. There are three types of partition supported by fdisk, primary, extended and\nlogical.Extended partitions are not real partitions at all, they contain any number of\nlogical parititions. Extended and logical partitions were invented as a way around the\nlimit of four primary partitions. The following is the output from fdisk for a disk\ncontaining two primary partitions:\n<pre>\nDisk \/dev\/sda: 64 heads, 32 sectors, 510 cylinders\nUnits = cylinders of 2048 * 512 bytes\n   Device Boot   Begin    Start      End   Blocks   Id  System\n\/dev\/sda1            1        1      478   489456   83  Linux native\n\/dev\/sda2          479      479      510    32768   82  Linux swap\nExpert command (m for help): p\nDisk \/dev\/sda: 64 heads, 32 sectors, 510 cylinders\nNr AF  Hd Sec  Cyl  Hd Sec  Cyl   Start    Size ID\n 1 00   1   1    0  63  32  477      32  978912 83\n 2 00   0   1  478  63  32  509  978944   65536 82\n 3 00   0   0    0   0   0    0       0       0 00\n 4 00   0   0    0   0   0    0       0       0 00\n<\/pre>\n<p>\nThis shows that the first partition starts at cylinder or track 0, head 1 and\nsector 1 and extends to include cylinder 477, sector 32 and head 63.\nAs there are 32 sectors in a track and 64 read\/write heads, this partition is a\nwhole number of cylinders in size. fdisk alligns partitions on cylinder boundaries by\ndefault. It starts at the outermost cylinder (0) and extends inwards, towards the\nspindle, for 478 cylinders. The second partition, the swap partition, starts at the\nnext cylinder (478) and extends to the innermost cylinder of the disk.\n<p>\n<!-- END copyright David Rusling:1996-1999:GNU General Public License -->\n<p>\nAll PC-based operating systems need to break down the hard disk into partitions.\n(In fact, all operating systems I can think of that use the same kind of hard disks\nneed to create partitions.)\nA <glossary>partition<\/glossary> can be any size, from just a couple of megabytes to the\nentire disk. Each <glossary>partition<\/glossary>\nis defined in a <i>partition table<\/i> that appears\nat the very beginning of the disk. This <glossary>partition<\/glossary>\ntable contains information\nabout the kind of <glossary>partition<\/glossary>\nit is, where it starts, and where it ends. This\ntable is the same whether you have a DOS-based PC, <glossary>UNIX<\/glossary>, or both.\n<\/p>\n<p>\nBecause the table is the same for <glossary>DOS<\/glossary>\nand <glossary>UNIX<\/glossary>, there can be only four partitions total\nbecause there are four entries in the table. <glossary>DOS<\/glossary>\ngets around this by creating <i>logical<\/i> partitions within one physical\n<glossary>partition<\/glossary>. This is a\ncharacteristic of DOS,\n<i>not<\/i> the <glossary>partition<\/glossary> table.\nBoth DOS and UNIX must\nfirst <glossary>partition<\/glossary>\nthe drive before installing the <glossary>operating system<\/glossary>\nand provide the mechanism during the installation process in the form of the fdisk program.\nAlthough their appearances are very different, the <glossary>DOS<\/glossary>\nand Linux fdisk commands perform the same function.\n<\/p>\n<p>\nWhen you run the Linux fdisk utility, the\nvalues you see and input are all in tracks. To figure out how big each fdisk\npartition is, simply multiply that value by 512 and by the number of sectors per\ntrack. (Remember that each <glossary>sector<\/glossary> holds 512 bytes of data.)<\/p>\n<p>\n<!-- START copyright David Rusling:1996-1999:GNU General Public License -->\nA disk is usually described by its geometry, the number of cylinders, heads and\nsectors. For example, at boot time Linux describes one of my IDE disks as:\n<pre>\nhdb: Conner Peripherals 540MB - CFS540A, 516MB w\/64kB Cache, CHS=1050\/16\/63\n<\/pre>\n<p>\nThis means that it has 1050 cylinders (tracks), 16 heads (8 platters) and 63\nsectors per track. With a sector, or block, size of 512 bytes this gives the disk a storage\ncapacity of 529200 bytes. This does not match the disk&#8217;s stated capacity of 516 Mbytes as\nsome of the sectors are used for disk partitioning information. Some disks automatically find\nbad sectors and re-index the disk to work around them.\n<p>\n<!-- END copyright David Rusling:1996-1999:GNU General Public License -->\n<p>\nTo physically connect itself to the rest of the computer, the hard disk has several choices:\nST506\/412, , <glossary>ESDI<\/glossary>, <glossary>SCSI<\/glossary>,\n<glossary>Integrated Drive Electronics(IDE)<\/glossary>\/<glossary>Advanced Technology Attachment (ATA)<\/glossary>, Enhanced IDE (EIDE), Fast IDE,  and the newer Serial ATA (SATA). However, the interface the <glossary>operating system<\/glossary>\nsees for ST506\/412 and IDE are identical, and\nthere is no special option for an IDE drive. At the hardware level, though,\nthere are some differences that I need to cover for completeness.\n<\/p>\n<p>\nThe older IDE\/ATA devices could be considered Parallel ATA, because data is transfered in parallel. The Serial ATA (SATA) bus is not simply a modification of PATA, but it is safer to think of it as a completely new interface type. IDE, Fast IDE and EIDE are basically the same interface, the only significant difference is the interface cable which can allow the system to access more physical disk space as well as increases the speed of the data transfer. For more details see the\n<site id=\"328\">section on SATA<\/site>.\n<\/p>\n<p>\nTo be quite honest, only <glossary>ESDI<\/glossary>\nand ST506\/412 are really disk interfaces. <glossary>SCSI<\/glossary>\nand IDE are referred to as &#8220;system-level interfaces&#8221; and they incorporate ESDI\ninto the circuitry physically located on the drive.\n<\/p>\n<p>\nThe ST506\/412 was\ndeveloped by Seagate Technologies (hence the ST) for its ST506 hard disk, which\nhad a whopping 5Mb formatted capacity. (This was in 1980 when 360K was a\n<i>big<\/i> floppy.) Seagate later used the same interface in their ST412, which\ndoubled the drive capacity (which is still less hard disk space than\nmost people <glossary>RAM<\/glossary>.\nOh well). Other drive manufacturers decided to incorporate this technology, and\nover the years, it has become a standard. One of its major drawbacks is that is\n15-year-old technology, which can no longer compete with the demands of todays\nhard disk users.\n<\/p>\n<p>\nIn 1983, the Maxtor Corporation established the Enhanced\nSmall Device Interface (ESDI) standard. The enhancements <glossary>ESDI<\/glossary>\nprovided offered\nhigher reliability because Maxtor had built the encoder\/decoder directly into\nthe drive and therefore reduced the noise, high transfer rates, and the ability\nto get drive parameters directly from this disk. This meant that users no longer\nhad to run the computer setup routines to tell the <glossary>CMOS<\/glossary>\nwhat kind of hard disk\nit had.\n<\/p>\n<p>\nOne drawback that I have found with <glossary>ESDI<\/glossary>\ndrives is the physical\nconnection between the controller and the drive itself. Two cables were needed:\na 34-pin control cable and a 24-pin data cable. Although the cables are\ndifferent sizes and can&#8217;t (easily) be confused, the separation of control and\ndata is something of which I was never a big fan. The connectors on the drive\nitself were usually split into two unequal halves. In the connector on the\ncable, a small piece of plastic called a key prevented the connector from being\ninserted improperly. Even if the key was missing, you could still tell which end\nwas which because the pins on the hard disk were labeled and the first line on\nthe cable had a colored stripe down its side. (This may not always be the case,\nbut I have <em>never<\/em> seen a cable that wasn&#8217;t colored like this.)\n<\/p>\n<p>\nAnother drawback that I have found is that the physical location on the\ncable determines which drive is which. The primary drive is located at the end\nof the cable, and the secondary drive is in the middle. The other issue is the\nnumber of cables: <glossary>ESDI<\/glossary>\ndrives require three separate cables. Each drive has its\nown data cable and the drives share a common control cable.\n<\/p>\n<p>\nAlthough\noriginally introduced as the interface for hard cards (hard disks directly\nattached to expansion cards), the <glossary>IDE<\/glossary>\n(integrated drive electronics) interface\nhas grown in popularity to the point where it is perhaps the most commonly used\nhard-disk interface today (rapidly being replaced by SCSI). As its name implies,\nthe controller electronics are <i>integrated <\/i>onto the hard disk itself. The\nconnection to the motherboard is made through a relatively small adapter,\ncommonly referred to as a &#8220;paddle board.&#8221; From here, a single cable\nattaches two hard disks in a daisy chain, which is similar to the way floppy\ndrives are connected, and often, <glossary>IDE<\/glossary>\ncontrollers have connectors and control\nelectronics for floppy drives as well.\n<\/p>\n<p>\nIDE drives often play tricks on\nsystems by presenting a different face to the outside world than is actually on\nthe disk. For example, because <glossary>IDE<\/glossary>\ndrives are already pre-formatted when they\nreach you, they can have more physical sectors in the outer tracks, thereby\nincreasing the overall amount of space on the disk that can be used for storage.\nWhen a request is made to read a particular block of data on the drive, the IDE\nelectronics translate this to the actual physical location.\n<\/p>\n<p>\nBecause IDE\ndrives come pre-formatted, you should never low-level format an <glossary>IDE<\/glossary>\ndrive unless\nyou are specifically permitted to do so by the manufacturer. You could\npotentially wipe out the entire drive to the point at which it must be returned\nto the factory for &#8220;repair.&#8221; Certain drive manufacturers, such as\nMaxtor, provide low-level format routines that accurately and <i>safely<\/i>\nlow-level format your drive. Most vendors that I am aware of today simply\n&#8220;zero&#8221; out the data blocks when doing a low-level format. However,\n<em>don&#8217;t<\/em> take my word for it! Check the vendor.\n<\/p>\n<p>\nOnly two IDE drives can be connected with a single cable, but there is nothing special about\nthe position of the drive on the cable. Therefore, the system needs some other way of\ndetermining which drive is which. This is done with the drives themselves. Most commonly, you\nwill find a <glossary>jumper<\/glossary> or set up jumpers used to determine if the drive is the\nmaster, slave or master-only\/single-drive. On (much) older system, you could only have a single\nIDE controller, which meant only two drive. Today, it is common to find two IDE controllers\nbuild onto the mother board and some system allow you to add extra IDE controllers, thereby\nincreasing the number of IDE drives even further.\n<\/p>\n<p>\nThe next great advance in hard disk technology was <glossary>SCSI<\/glossary>. SCSI is not a disk interface, but rather a semi-independent <glossary>bus<\/glossary>. More than just hard disks can be attached to a SCSI-Bus. Because of its complex nature and the fact that it can support such a\nwide range of devices, I talked in more detail about <glossary>SCSI<\/glossary>\nearlier in this chapter. However, a few specific <glossary>SCSI<\/glossary>\nissues relate to hard disks in general and\nthe interaction between <glossary>SCSI<\/glossary>\nand other types of drives.\n<\/p>\n<p>\nThe thing to note is that the <glossary>BIOS<\/glossary>\ninside the PC knows nothing about <glossary>SCSI<\/glossary>.\nWhether this is an\noversight or intentional, I don&#8217;t know. The SCSI spec is more than 10 years old,\nso there has been plenty of time to include it. Because the <glossary>BIOS<\/glossary>\nis fairly standard from machine to machine, including SCSI support might create problems\nfor backward compatibility.\n<\/p>\n<p>\nOn the other hand, the <glossary>BIOS<\/glossary>\nis for <glossary>DOS<\/glossary>.\nDOS makes BIOS calls. To be able to access all the possible <glossary>SCSI<\/glossary>\ndevices through the\nBIOS, it must be several times larger. Therefore, every PC-based operating\nsystem needs to have extra drivers to be able to access SCSI\ndevices.\n<\/p>\n<p>\nBecause the <glossary>BIOS<\/glossary>\ndoes not understand about <glossary>SCSI<\/glossary>,\nyou have to trick the PCs <glossary>BIOS<\/glossary>\na little to <glossary>boot<\/glossary> from a <glossary>SCSI<\/glossary>\ndevice. By telling the PCs BIOS that no drives are installed as either C: or D:,\n you force it to quit before it\nlooks for any of the other types. Once it quits, the <glossary>BIOS<\/glossary>\non the <glossary>SCSI<\/glossary>\n<glossary>host adapter<\/glossary> has a chance to run.\n<\/p>\n<p>\nThe <glossary>SCSI<\/glossary>\n<glossary>host adapter<\/glossary> obviously knows how to\nboot from a <glossary>SCSI<\/glossary>\nhard disk and does so wonderfully. This is assuming that you\nenabled the <glossary>BIOS<\/glossary>\non the <glossary>host adapter<\/glossary>. If not, you&#8217;re hosed.\n<\/p>\n<p>\nThere is also the flip side of the coin. The official doctrine says that if you have a\nnon-SCSI <glossary>boot<\/glossary>\ndriver, you <i>have<\/i> to disable the <glossary>SCSI<\/glossary>\n<glossary>BIOS<\/glossary>\nbecause this can cause problems. However, I know people who have <glossary>IDE<\/glossary>\n<glossary>boot<\/glossary>\ndrives and still leave the SCSI <glossary>BIOS<\/glossary>\nenabled. Linux normally reacts as though the SCSI BIOS were not\nenabled, so, what do to? I suggest that you see what works. I can only add that\nif you have more than one <glossary>host adapter<\/glossary> , only one should have the BIOS\nenabled.\n<\/p>\n<p>\nAnother thing is that once the <glossary>kernel<\/glossary>\nboots from a <glossary>SCSI<\/glossary>\ndevice, you loose access to other kinds of drives. Just because it doesn&#8217;t <glossary>boot<\/glossary>\nfrom the IDE (or whatever), does this mean you cannot access it at all? Unfortunately,\nyes. This is simply the way the kernel is designed. Once the kernel has\ndetermined that it has booted off a SCSI hard disk, it can no longer access a\nnon-SCSI hard disk.\n<\/p>\n<p>\nThe newest member of the hard disk family is Enhanced\nIDE, or <glossary>EIDE<\/glossary>.\n The most important aspect of this new hard disk interface is its\nability to access more than 504 megabytes. This limitation is because the IDE\ninterface can access only 1024 cylinders, 16 heads, and 63 sectors per track.\nIf you multiply this out using the formula I gave you earlier, you get\n504Mb.\n<\/p>\n<p>\nEIDE also has other advantages such as higher transfer rates,\nability to connect more than just two hard disks, and attach more than just hard\ndisks. One drawback the <glossary>EIDE<\/glossary>\nhad at the beginning was part of its very nature.\nTo overcome the hard disk size limit that <glossary>DOS<\/glossary>\nhad, <glossary>EIDE<\/glossary>\ndrives employ a method\ncalled <i>logical block addressing<\/i> (LBA).\n<\/p>\n<p>\nBefore we talk about LBA, we need to backtrack a little. Old operating systems that accessed the BIOS directly would use <glossary>interrupt<\/glossary> 13 (INT13h) to access the disk. This limited the size of the hard disk because using INT13h you could only access up to 1024 cylinders, 256 heads and 63 sectors per track, for a total of 528 MB of disk space.  (Cylinders * Heads * Sectors * 512 bytes = Disk Capacity) Note the combination of cylinders, heads and sectors per track is referred to as the disk &#8220;geometry&#8221; and is commonly referred to as CHS (Cylinders-Heads-Sectors).\n<\/p>\n<p>\nTo overcome this limitation, the BIOS was modified to supported something called &#8220;large mode&#8221;. or more acurately Extended Cylinders Heads Sectors (ECHS).  This introducted a so-called &#8220;translation layer&#8221; between the  INT13h and the BIOS, allowing for disks up to 8GB. (very large for the time) What ECHS did was to calcualte a &#8220;best fit&#8221; of the disk geometry to fit into the 1024 cylinder limitation. By changing the other values (i.e. heads and sectors per track) the BIOS could come much closer to the actual size of the disk.\n<\/p>\n<p>\nThe next step was <i>logical block addressing<\/i> (LBA). Like ECHS,  the idea behind <glossary>LBA<\/glossary> is that is that the systems\n<glossary>BIOS<\/glossary> would &#8220;rearrange&#8221; the drive geometry so that drives larger\nthan 528Mb could still <glossary>boot<\/glossary>. Because Linux does not use the\nBIOS to access the hard disk, the fact that the <glossary>BIOS<\/glossary> could handle\nthe <glossary>EIDE<\/glossary> drivemeant nothing. New drivers needed to be added\nto <glossary>account<\/glossary>for this.\n<\/p>\n<p>\nMore and more you find the (E)IDE controllers built directly onto the motherboard. On the one\nhand this is a good thing, since you do not need to use a <glossary>expansion card<\/glossary> slot\nfor the controller. However, you need to be careful where it is located. I have had a few\nmotherboards, where the <glossary>IDE<\/glossary> controller was stuck between the\n<glossary>PCI<\/glossary> and <glossary>ISA<\/glossary> slots. This made it extremely difficult to\naccess the pins without removing either of the cards in either of the PCI or ISA slot (sometimes\nboth).\n<\/p>\n<p>\nAlthough this might not seem like a big deal, but it may become one the next time you do\nanything with that machine. It is not uncommon when adding a harddisk or something else to the\nsystem that you accidentally pull on the harddisk cable. All you need to do is pull it no more than\nquarter of an inch before some plugs are no longer connected to the pins. Because this connection is\nalmost impossible to see, you don&#8217;t notice that the cable has come loose. When you reboot the\nmachine nothing works as the system is getting signals through only some of the lines. If the pins\nfor the <glossary>IDE<\/glossary> controller are out in the open, you may still pull on the cable,\nbut it is easier to see and far easier to fix.\n<\/p>\n<p>\nThere is much more to choosing the right harddisk\nthat its size. Although size determines how much data you can store, it tells you nothing about the\nspeed at which you can access that data. How quickly you can access your data is the true measure of\nperformance.\n<\/p>\n<p>\nUnfortunately, there is no one absolute measure of harddisk performance. The reason\nis simply that data access occurs in some many different ways, it is often difficult for even the\nexperienced <glossary>administrator<\/glossary> to judge which drive is better. However, there are\nseveral different characteristics of harddisks, which, when viewed together give you a good idea of\nthe overall performance of a drive.\n<\/p>\n<p>\nOne character that is often quoted is the seek time. This\nrefers to the time need to move the read\/write head between tracks. If the data is not on the same\ntrack, it could mean moving the head a couple thousand tracks in either direction. Movement from one\ntrack to the next adjacent one might take only 2 ms, whereas moving the entire diameter of the drive\nmight take 20ms.\n<\/p>\n<p>\nSo which one do you use? Typically, neither. When access times are specified,\nyou normally see the average seek time. This is measured as the average time between randomly\nlocated tracks on the disk. Typical rages at the time of this writing are between 8ms and 14ms. The\nproblem is that disk access is often (usually?) not random. Depending on how you work, you read\nlarge a number of blocks at once, such as to load a WordPerfect file. Therefore, average seek time\ndoes not reflect access of large pieces of data.\n<\/p>\n<p>\nOnce the head has moved to the track you need,\nyou are not necessarily read to work. You need to wait until the right block is under the read\/write\nhead. The time the drive takes to reach that point is called rotational latency. The faster the\ndrive speeds, the more quickly the block is underneath the head. Therefore, rotational latency is\ndirectly related to the rotational speed (rpm) of your drive.\n<\/p>\n<p>\nBy increasing the rotational speed\nof a drive you obviously decrease the time the drive has to wait. The fastest drives as I am writing\nthis spin at least 7200 times per minutes, which means that have an average rotational latency is\nabout 4.2 ms.\n<\/p>\n<p>\nYou can also decrease the rotational latency by staggering the start of the start\nof each track. This is especially effective when doing sequential reads across tracks. If the start\nof all tracks were at the same place, the head would move to the new track and the start of the\ntrack would have already spin out from underneath. If the tracks are staggered, the head has to wait\nless time (less rotational latency) until the start of the track is underneath.\n<\/p>\n<p>\nThink back to our\ndiscussion of harddisks and the concept of a <glossary>cylinder<\/glossary>.  This is all of the\ntracks at the same distance from the spindle. To physically move heads from one track to another\ntakes more time than simple switch which head you are using. However, because switch heads does not\noccur instantaneously, there is a certain amount of rotational latency. Therefore, the start of each\ntrack is staggered as one moves up and down the cylinder, as well as across the cylinders.\n<\/p>\n<p>\nBy\ndecreasing the rotational latency, we increase the speed at which the head reaches the right\nposition. Once we are there, we can begin reading, this is the average access time. This, too, is\nmeasured in milliseconds.\n<\/p>\n<p>\nStill, this is not the complete measure of the performance of our\ndrive. Although it is nice that the drive can quickly begin to read, this does not necessarily mean\nthat it will read the data fast. The faster the harddisk can read the data, the faster your\nWordPerfect file is loaded. This is due to the transfer rate. This is normally measured in megabytes\nper second.\n<\/p>\n<p>\nHowever, the actual transfer is not necessarily what the harddisk manufacturer says\nit is. They may have given the transfer rate in terms of the maximum or average sustained transfer\nrate. This is important to understand. If you have one huge 200Mb file that you are reading on a new\ndrive, the entire drive might be contiguous. Therefore, there is very little movement of the heads\nas the file is read. This would obviously increase the average transfer rate. However, if you have\ntwo hundred 1 <glossary>Mb<\/glossary> files spreads out all over the disk, you will definitely\nnotice a lower transfer rate.\n<\/p>\n<p>\nIn addition, this is another case of the chain being as strong as\nits weakest link. The actual transfer rate dependant on other factors, as well. A slow harddisk\ncontroller or slow system <glossary>bus<\/glossary> can make a fast harddisk display bad performance.\n<\/p>\n<p>\nAnother aspect is how much of the date is being re-read. For example, if you read the same one\n<glossary>Mb<\/glossary> file two hundred times, the head won&#8217;t move much. This is not a bad thing,\nas data is often read repeatedly. Harddisk manufacturers are aware of this and therefore will add\ncaches to the harddisk to improve performance. Data that is read from the harddisk can be stored in\nthe <glossary>cache<\/glossary> so if it is needed again, it can be accessed more quickly than if it\nmust be first read from the drive. Data that is written, may also be needed again, so it too can be\nre-read from the cache.\n<\/p>\n<p>\nThis is also called a <glossary>cache<\/glossary>\n<glossary>buffer<\/glossary>,  because it also serves to buffer the data. Sometimes the harddisk\ncannot keep up with the <glossary>CPU<\/glossary>.  It may be the disk is writing someone as new data\ncomes in. Rather than making the CPU wait, the data is written to the cache, which the harddisk can\nread when it can. Other times, the CPU is doing something else as the data is from the harddisk is\nready. The harddisk can write it to the buffer and the CPU can take it when it can.\n<\/p>\n<p>\nFinally,\nthere is data <glossary>throughput<\/glossary>.  This is a measure of the total amount of data the\n<glossary>CPU<\/glossary> can access in a given amount of time. Since the data is going through the\nharddisk controller and through the system <glossary>bus<\/glossary>,  this may not be a good measure\nof performance of the drive itself. However, if the other components can process the data as quickly\nas the drive can provide it, it is a good measure of the complete system.\n<\/p>\n<p>\nThis is why you will\nsee references to Seagate drives on the Adaptec web site. Adaptec understands the relationship\nbetween the components in your system. Therefore, they suggest drives that can keep up with the\nother components such as the appropriate ones from Seagate.\n<\/p>\n<p>\nAnother aspect of the administration\ncosts that a lot of people do not think about is the drive designation. Although calling a harddisk\n&#8220;WhirlWind&#8221; or &#8220;Falcon&#8221; might be pleasing to the marketing people or the IT manager who has no clue\nabout the technical details. However, the <glossary>administrator<\/glossary> is not interested in\nwhat name it has but rather its characteristics it has. If it takes a long time to figure out the\ncharacteristics, the total cost of owner ship has increased.\n<\/p>\n<p>\nHow often have you had to wade\nthrough pages and pages on a company&#8217;s Internet site to figure out how big a particular model was?.\nAlthough many (most?) companies have a 1:1 relationship between the model designation and the\ncharacteristics, you have to first figure out the scheme, as often it is not posted anywhere on the\nsite.\n<\/p>\n<p>\nThis is one reason why I keep coming back to Seagate. Without thinking I can come up with\nthe model number or something very close. The general format is:\n<\/p>\n<p>\nST&lt;F&gt;&lt;MB&gt;&lt;INT&gt;\n<\/p>\n<p>\nWhere: <br \/>\n&lt;F&gt; = Form factor, such as 3&#8243;, 3&#8243; half-high, 5&#8243;, etc. <br \/>\n&lt;B&gt; =\nApproximate size in megabytes. <br \/>\n&lt;INT&gt; = Interface.\n<\/p>\n<p>\nSo, looking at my drive, which is a\nST39140A, I can quickly tell that it is a form factor 3 (3&#8243; drive and 1&#8243; high), it has approximately\n9140 MB and an ATA interface. Granted some of the abbreviations used for the interface take a little\nto get used to. However, the naming scheme is consistent and very easy to figure out.\n<\/p>\n<p>\nAs with\nother hardware, your choice of harddisk is also guided by the reputation of the company. This\napplies not only to what you have heard, but also your own personal experiences. Often it is more\nthan just having heard or reading that a particular manufacturer is bad, but rather an issue of\nbeing &#8220;sure.&#8221;  This is why I will never buy an IBM harddisk again. All three I have bought were\ndefective. Although other people have claimed not to have problems with them, I do not want to risk\nmy data on them. Three times is too much of a coincidence and I would not feel safe if I installed\nan IBM harddisk on any of my machines, nor would I have a clear conscience if I installed it in a\ncustomer&#8217;s machine.\n<\/p>\n<p>\nOn the other hand, I have had a proportionally large number of Seagate drives\nsince I first started working with computers. None of which have ever given me problems. So far, all\nof my Seagate drives have been replaced with larger drives, not because they have failed, but they\nhave grown, too small. There are only so many bays in a computer case and filling them up with small\ndrives is not worth it. Instead, I got larger drives.\n<\/p>\n<p>\nIn addition to the size and speed of your\ndrive, one important consideration is the interface to the harddisk. Typically,\n<glossary>SCSI<\/glossary> harddisks are more expensive than ATA drives, even if you ignore the extra\ncosts for the SCSI <glossary>host adapter<\/glossary>. Even if you want to ignore the extra costs to\nacquire the drive, you need to consider the costs to install and manage the\n<glossary>host adapter<\/glossary>,  the performance increase you get with SCSI is negligible for work stations.\nGenerally, you do not need the extra <glossary>throughput<\/glossary> that SCSI can provide.\n<\/p>\n<p>\nIn\nmost cases, space will be an issue. Although you need just a few hundred megabytes for the\n<glossary>operating system<\/glossary>, you are getting larger and larger applications, with dozens\nof components which quickly fill up space on your harddisk. Buying and installing a new ATA harddisk\nis generally simpler than adding a <glossary>SCSI<\/glossary> harddisk particularly if your first\nharddisk is ATA. In addition, on newer system you can have up to four ATA devices, including\n<glossary>CD-ROM<\/glossary> drives, which is generally sufficient for a workstations, as well as\nmobile users.\n<\/p>\n<p>\nOn the other hand, if you are in an <glossary>environment<\/glossary> where you need\nmore than four device or need  devices that do not support ATA, then you will have to go with\n<glossary>SCSI<\/glossary>.  In addition, SCSI is basically a must when talking about your server.\nSize isn&#8217;t an issue as what is available is generally the same for ATA and SCSI. The key difference\nis performance. This is particularly important in a <glossary>multi-user<\/glossary> environment.\n<\/p>\n<p>\nLet&#8217;s take the Seagate Cheetah as an example. As of this writing it is the fastest available on\nthe market with10,000 <glossary>RPM<\/glossary>.  It has a maximum internal transfer rate of\n306Mbits\/s, which means it is even faster than the 80Mbits\/s of the Ultra <glossary>SCSI<\/glossary>\ninterface. This is a result of an average seek time of 6 milliseconds and 2.99 average latency. This\nmeans the average access time is under 9 milliseconds. To compensate, the Cheetah series has default\n<glossary>buffer<\/glossary> size of 1Mb. In addition, the <glossary>throughput<\/glossary> is too\nhigh to use anything other than SCSI or Fibre Channel, so it is not available with an ATA interface.\n<\/p>\n<p>\nThere are also a few other reasons why something like the Cheetah is the perfect solutions for a\nserver. First, it supports up to 15 devices on a single wide <glossary>SCSI<\/glossary>\n<glossary>bus<\/glossary>.  Using the Fibre Channel versions, you can get up to 126 devices, which\nare also hot swappable.\n<\/p>\n<p>\nAnother thing to consider is the maintenance and administration. Low-end\nMedalist drives have an expected mean-time between failures (MTBF) of 400,000 hours. Which is about\n45 years. The MTBF for the Cheetah is approximately 1,000,000 hours or over 100 years. No wonder I\nhaven&#8217;t ever had a harddisk <glossary>crash<\/glossary>.\n<\/p>\n<p>\nThe Seagate drives also do something else to reduce maintenance and administration costs. First,\nthere is something Seagate calls SeaShield and is something other harddisk manufacturers should\nadopt. This is simply a protective cover around the electronics that are exposed on other harddisks.\nThis protects the electronics from static electrical discharge, as well as damage caused by bumping\nthe drive against something. In addition, this cover provides the perfect space for installation\ninstructions, like the jumper settings. There is no need to go hunting around for the data sheet,\nwhich often isn&#8217;t supplied with the drive. Talk about saving administration costs!\n<\/p>\n<p>\nSome of you might be saying that names like Cheetah go against my desire to have understandable\nmodel names.  My answer is that the opposite is true. As of this writing Seagate has four primary\nseries: Medalist, Medalist Pro, Barracuda and Cheetah. This simply tells the rotation rate, which is\n5400, 7200, 7200 and 10,000 RPM respectively. The Medalist is Ultra ATA. The\nMedalist Pro is either ATA or <glossary>SCSI<\/glossary>. The Barracuda and Cheetah are either SCSI\nor Fibre Channel. Okay, this requires you to use your brain a little, but it is far easier than many\nother vendors.\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hard Disks You&#8217;ve got to have a hard disk. You could actually run Linux from a floppy (even a high-density 5.25&#8243; floppy), but life is so much easier when you run from the hard disk. Not only do you have &hellip; <a href=\"http:\/\/www.linux-tutorial.info\/?page_id=284\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-284","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/pages\/284","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=284"}],"version-history":[{"count":1,"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/pages\/284\/revisions"}],"predecessor-version":[{"id":569,"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/pages\/284\/revisions\/569"}],"wp:attachment":[{"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=284"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}