{"id":511,"date":"2010-08-11T21:07:27","date_gmt":"2010-08-12T01:07:27","guid":{"rendered":"http:\/\/www.databook.bz\/?page_id=511"},"modified":"2014-05-06T12:41:37","modified_gmt":"2014-05-06T16:41:37","slug":"anatomy-of-a-disk-drive","status":"publish","type":"page","link":"http:\/\/www.linux-databook.info\/?page_id=511","title":{"rendered":"Anatomy of a Disk Drive"},"content":{"rendered":"<p>It is not really necessary to understand the physical or logical structure of a disk drive or how it works\u00a0 in order to use Linux or any other operating system. Such knowledge can be quite helpful, however, when you are attempting to perform problem determination on a system which is responding sluggishly. One of the first places to look when you are troubleshooting a performance issue is at disk performance.<\/p>\n<p>Only by understanding the function and structure of disk drives can you hope to improve performance.<\/p>\n<div id=\"attachment_2121\" style=\"width: 492px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2121\" class=\"size-full wp-image-2121\" title=\"Inside a Disk Drive\" src=\"http:\/\/www.linux-databook.info\/wp-content\/uploads\/2009\/01\/HardDrivePic.png\" alt=\"Inside a Disk Drive\" width=\"482\" height=\"319\" \/><p id=\"caption-attachment-2121\" class=\"wp-caption-text\">Figure 1: Inside a Disk Drive<\/p><\/div>\n<p>A hard drive, aka disk drive, consists of one or more metal or glass platters coated with a magnetic recording medium. Each platter has two surfaces, top and bottom, on which data can be recorded. Read\/write heads write data onto the recording surface and read it back when requested by the operating system. The data is recorded on circular tracks on each platter.<\/p>\n<p>In the illustration above, the drive has three platters and six read\/write heads. The heads are aligned vertically so that they are each lined up over the same data track on their respective platters. There are hundreds of tracks on each surface and the six vertically aligned tracks under the read\/write heads are known as a cylinder.<\/p>\n<p>The\u00a0 actuator moves the heads across the disk surface to align the heads with different cylinders to read and write data.<\/p>\n<h2>Disk Space Allocation<\/h2>\n<p>The cylinder is the minimum increment of space that can be allocated to a partition when installing Linux or creating partitions from free disk space. This is the reason that a requested allocation of 1000MB for a partition might actually become 1985MB. The output from fdisk below, shows that a cylinder is about 8MB in size.<\/p>\n<pre>[root@david 20]# <strong>fdisk \/dev\/sda<\/strong>\r\n\r\nWelcome to fdisk (util-linux 2.24.1).\r\nChanges will remain in memory only, until you decide to write them.\r\nBe careful before using the write command.\r\n\r\nCommand (m for help): <strong>u<\/strong>\r\n\r\nChanging display\/entry units to cylinders (DEPRECATED!).\r\n\r\nCommand (m for help): <strong>p<\/strong>\r\nDisk \/dev\/sda: 298.1 GiB, 320072933376 bytes, 625142448 sectors\r\nGeometry: 255 heads, 63 sectors\/track, 38913 cylinders\r\nUnits: cylinders of 16065 * 512 = 8225280 bytes\r\nSector size (logical\/physical): 512 bytes \/ 4096 bytes\r\nI\/O size (minimum\/optimal): 4096 bytes \/ 4096 bytes\r\nDisklabel type: dos\r\nDisk identifier: 0x000aa325\r\n\r\nDevice    Boot Start       End    Blocks  Id System\r\n\/dev\/sda1          1       262   2097152  83 Linux\r\n\/dev\/sda2        262     38914 310473048  8e Linux LVM\r\n<\/pre>\n<p>Note that it is necessary to change the units to cylinders in order to see this. The option to display disk space in cylinders is deprecated and may not work in the future.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It is not really necessary to understand the physical or logical structure of a disk drive or how it works\u00a0 in order to use Linux or any other operating system. Such knowledge can be quite helpful, however, when you are&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/www.linux-databook.info\/?page_id=511\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":412,"menu_order":3,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-511","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"http:\/\/www.linux-databook.info\/index.php?rest_route=\/wp\/v2\/pages\/511","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.linux-databook.info\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/www.linux-databook.info\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/www.linux-databook.info\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.linux-databook.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=511"}],"version-history":[{"count":12,"href":"http:\/\/www.linux-databook.info\/index.php?rest_route=\/wp\/v2\/pages\/511\/revisions"}],"predecessor-version":[{"id":4156,"href":"http:\/\/www.linux-databook.info\/index.php?rest_route=\/wp\/v2\/pages\/511\/revisions\/4156"}],"up":[{"embeddable":true,"href":"http:\/\/www.linux-databook.info\/index.php?rest_route=\/wp\/v2\/pages\/412"}],"wp:attachment":[{"href":"http:\/\/www.linux-databook.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=511"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}