Click to See Complete Forum and Search --> : Hard drive data storage
SuperSparks
April 28th, 2005, 09:37 PM
This is a question that's been keeping me awake for many a night :D How is data physically written to the disk platters? When a sector is filled is the next bit of data written to the next sector on the same platter or does it move to a sector on the next platter in a vertical fashion? I've never been able to find out the answer to that question.
http://pel.cs.byu.edu/~sorenson/research/geometry.gif
DrMDJ
April 29th, 2005, 08:33 AM
Well, first off lets move the starting point for a write operation up a level. Even though the sector is the smallest unit on the hard drive, OSes deal in clusters. So all writes are going to be for one or more clusters. Also, the OS has influence on where successive clusters are writen. The OS looks in the FAT (or equivalent) table to find a free cluster. If it needs additional clusters it will typically try to find/use the next adjacent cluster (in the same track). If that's not free then it will typically look for the next most adjacent. It should be noted though that OSes can have their nuances or even tweaks that can effect the selection process when multiple clusters are needed for a write.
Now in terms of the hard drive itself actually doing the writing, it has intelligence to try to reorganize and optimize the write operations it has been given to perform (subject to the fact of course that in the end it must write the clusters its been told to). In so doing it will first attempt to write adjacent clusters (really the sectors comprising them) on the same track. The next level of (attempted) optimization would be to write the next track in the same cylinder (because of the vertical alignment of the neads). So if a track on a platter filled, ideally the drive wants to write to the next track in that same cylinder.
Hope this makes sense.
Platypus
April 29th, 2005, 10:02 AM
The easiest way to confirm in your own mind that the drive is "filled up" one complete cylinder at a time is to find some test graphs of the data transfer rate across the full capacity of drives. Normally the DTR will be high at the start of the drive, and taper down steadily to the last clusters on the drive.
Since drives stopped having the same number of sectors around each track, and became "zoned", with the number of sectors stepping up a number of times as the circumference of each track increases towards the edge, the DTR is greater on the outer tracks, decreasing toward the centre. The first track is at the outer edge, so the DTR starts out being high (the first partition on a drive will have the best performance, a seldom-mentioned reason for partitioning, so you can put static files on the slowest part of the drive). If the drive filled up across each platter surface, then "wrapped around" to the start of the next platter surface, the DTR graph would be a series of sawtooth falls and sudden rises. The normal graph droops steadily downward, with some downward spikes (due to things like latency and error corrections) and probably some steps indicating zones. So we can deduce that the drive is being accessed sequentially cylinder by complete cylinder.
It's done this way for performance, since the mechanical movement of a head seek is slower than electronically switching to another head to move along the cylinder. So for contiguous data, a series of head switches and minimal seeks is much faster than a lot of seeks and a few head switch actions. It also means less mechanical activity, minimising wear. Of course this strategy is negated to some degree by such things as fragmented files, and the inevitable need to access multiple files on different parts of the drive. The theoretical action of accessing within a cylinder or minimal number of cylinders can only be sure for a single task dealing with contiguous data (so defrag!).
There is some brief interesting information on drive access strategies in this article:
http://www.cs.umd.edu/class/fall2004/cmsc412/mwh-lectures/storage-daveho.pdf
SuperSparks
April 30th, 2005, 03:28 PM
This is excellent stuff, just what I was after :)
To move the question on, what about disk defragmenters? How do they fit in with this, presumably they will have an effect on the physical placement of data on the drive? I know from my own experience that if you do a defrag witrh one make of defrgamenter and then do an analysis immediately afterwards with another, the second will indicate a certain amount of fragmentation, because of the different strategies employed. What are these strategies?
virtualdr.com
Copyright 2007 Jupitermedia Corporation All Rights Reserved.