[opensuse] fdisk calculations
Hello :-) I'm revising the partition HOWTO, using openSUSE 11.1 as example. I try to understand fdisk output. namely this one from an USB key: .......................... Disk /dev/sdb: 2012 MB, 2012217344 bytes 47 heads, 46 sectors/track, 1817 cylinders Units = cylinders of 2162 * 512 = 1106944 bytes Disk identifier: 0x04030201 Device Boot Start End Blocks Id System /dev/sdb1 1 1818 1964932 6 FAT16 ....................... I can't understand the underlying calculus. How is the byte number found? 47 heads * 46 s/t = 2162, ok 2162 * 512 = 1106944, ok but 1817 cyl * 1106944 bytes = 2011317248, not 2012217344 as shown any idea? thanks jdd -- http://www.dodin.net http://valerie.dodin.org http://www.youtube.com/watch?v=t-eic8MSSfM http://www.facebook.com/profile.php?id=1412160445 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Mon, 16 Mar 2009, jdd wrote:
Hello :-)
I'm revising the partition HOWTO, using openSUSE 11.1 as example.
I try to understand fdisk output. namely this one from an USB key:
.......................... Disk /dev/sdb: 2012 MB, 2012217344 bytes 47 heads, 46 sectors/track, 1817 cylinders Units = cylinders of 2162 * 512 = 1106944 bytes Disk identifier: 0x04030201
Device Boot Start End Blocks Id System /dev/sdb1 1 1818 1964932 6 FAT16 .......................
I can't understand the underlying calculus. How is the byte number found? 47 heads * 46 s/t = 2162, ok 2162 * 512 = 1106944, ok but 1817 cyl * 1106944 bytes = 2011317248, not 2012217344 as shown
any idea?
2012217344/512/46/47 = 1817.813... 2012217344 is the disk size. And that's independent of the 'geometry'. Steffen -- Der frühe Wirt holt sich den Wurm. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Monday, 2009-03-16 at 09:11 +0100, jdd wrote:
Hello :-)
I'm revising the partition HOWTO, using openSUSE 11.1 as example.
I try to understand fdisk output. namely this one from an USB key:
.......................... Disk /dev/sdb: 2012 MB, 2012217344 bytes 47 heads, 46 sectors/track, 1817 cylinders Units = cylinders of 2162 * 512 = 1106944 bytes Disk identifier: 0x04030201
Device Boot Start End Blocks Id System /dev/sdb1 1 1818 1964932 6 FAT16 .......................
I can't understand the underlying calculus. How is the byte number found? 47 heads * 46 s/t = 2162, ok 2162 * 512 = 1106944, ok but 1817 cyl * 1106944 bytes = 2011317248, not 2012217344 as shown
any idea?
Maybe the real size is 2012217344, ie, 1919 MiB. The head/cyls/sector count is an aproximation for the shake of old bios functions. New disk use LBA addressing, ie, sector counts. You can use "u" to change the units in fdisk. Also, you can use "v" to do a verification, which usually gives a number of non allocated sectors; I'm not sure, but could be related to that mismatch. One of mine: Disk /dev/hdb: 40.0 GB, 40020664320 bytes 255 heads, 63 sectors/track, 4865 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0x7bdf8b0e or: Disk /dev/hdb: 40.0 GB, 40020664320 bytes 255 heads, 63 sectors/track, 4865 cylinders, total 78165360 sectors Units = sectors of 1 * 512 = 512 bytes Disk identifier: 0x7bdf8b0e Command (m for help): v 9321 unallocated sectors But: 255*63*4865 = 78156225 sectors 78165360 - 78156225 = 9135 - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAkm+R70ACgkQtTMYHG2NR9X82wCaA1yB1CQpbbQOF03k2YRzzJLN mZQAn1IC6lyIs9dqsx64flodVvhbeHns =dQxR -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Hello, On Mon, 16 Mar 2009, Carlos E. R. wrote:
Disk /dev/hdb: 40.0 GB, 40020664320 bytes 255 heads, 63 sectors/track, 4865 cylinders, total 78165360 sectors Units = sectors of 1 * 512 = 512 bytes Disk identifier: 0x7bdf8b0e
Command (m for help): v 9321 unallocated sectors
But:
255*63*4865 = 78156225 sectors
78165360 - 78156225 = 9135
There are 62 unallocated sectors after the MBR, and after each EPBR (before each logical partition) -- but I don't know if fdisk counts these as such. Show the complete 'fdisk -l' output (via PM) ... -dnh -- Troll, troll, troll along gently down the feed. Merrily, merrily, merrily a life is what you need. -- Stephan Lange in dang -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Mon, Mar 16, 2009 at 4:11 AM, jdd
Hello :-)
I'm revising the partition HOWTO, using openSUSE 11.1 as example.
I try to understand fdisk output. namely this one from an USB key:
.......................... Disk /dev/sdb: 2012 MB, 2012217344 bytes 47 heads, 46 sectors/track, 1817 cylinders Units = cylinders of 2162 * 512 = 1106944 bytes Disk identifier: 0x04030201
Device Boot Start End Blocks Id System /dev/sdb1 1 1818 1964932 6 FAT16 .......................
I can't understand the underlying calculus. How is the byte number found? 47 heads * 46 s/t = 2162, ok 2162 * 512 = 1106944, ok but 1817 cyl * 1106944 bytes = 2011317248, not 2012217344 as shown
any idea?
thanks jdd
jdd, I would simply have th how-to say something like: == The Cylinder / Head / Sector concept is an anachronism from the 1980's and early 1990's. The CHS concept can only describe disks with a max capacity of approximately 4 GB. (ie. (2^16-1)*(2^8 -1)*(2^5-1)*512 bytes). (You need to verify the number of bits available per field, I'm working from memory.) Thus the vast majority of currently shipping disks simply use the maximum allowed value for the number of cylinders, heads, and sectors in an effort to allow low-level legacy code to access as much of the disk drive as possible. Boot loaders were some of the last generally used programs to only support disk access via CHS. For this reason even into the early 21st century the boot partition had to be in this early portion of the disk. One specific legacy remnant of this design you may need to be concerned with is that during the 1980s and 1990's, the first partition was typically located at cylinder 0, head 1, sector 0 to ensure the partition alignment was consistent with the physical disk. With most disk drives today, that is sector 63. This location for the start of the first partition continues to be a common starting point, but when Microsoft introduced Vista they started placing the first partition at the 1MiB point. Thus sector 2048 is now a common starting sector for the first partition. This has caused a conundrum that is being faced by hard drive manufacturers in the early 2009 timeframe. They are working on disk drives that continue to support a 512 byte sector size on the interface side, but use 4K sectors on the actual platter. This means that all physical reads and writes to the platters will take place with 4K of data at a time. This 4K size works well with most modern OS'es because they use a 4K page size internally (or a multiple thereof). The issue is alignment, when a page is written by the OS to the hard drive it will be important from a performance perspective that the page not overlap two separate physical 4K sectors. Unfortunately hard drive manufacturers have two common, but contradictory alignment needs. They can either have the 4K physical sectors be aligned with sector 63 that has historically been used for the start of the first partition, or they can be aligned with partitions that start on sector 2048 that Vista uses. At present it appears that manufacturers are leaning toward having the hard drives configured in the factory to have one alignment or the other. And the user will have no ability to change it. Thus if you are attempting to partition a new generation hard drive that has 4K physical sectors, you should pay special attention to where your partitions start. The specific desire is that all partitions be aligned with the 4K physical sectors of the drive. To the best of my knowledge, as of Mar. 2009 none of the Linux Userspace partitioning tools have been updated to address this issue because shipping disk drives are not yet available to test with. === Hope that makes sense Greg -- Greg Freemyer Head of EDD Tape Extraction and Processing team Litigation Triage Solutions Specialist http://www.linkedin.com/in/gregfreemyer First 99 Days Litigation White Paper - http://www.norcrossgroup.com/forms/whitepapers/99%20Days%20whitepaper.pdf The Norcross Group The Intersection of Evidence & Technology http://www.norcrossgroup.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Hello, On Mon, 16 Mar 2009, Greg Freemyer wrote:
On Mon, Mar 16, 2009 at 4:11 AM, jdd
wrote: I'm revising the partition HOWTO, using openSUSE 11.1 as example.
I try to understand fdisk output. namely this one from an USB key:
.......................... Disk /dev/sdb: 2012 MB, 2012217344 bytes 47 heads, 46 sectors/track, 1817 cylinders Units = cylinders of 2162 * 512 = 1106944 bytes Disk identifier: 0x04030201
Device Boot Start End Blocks Id System /dev/sdb1 1 1818 1964932 6 FAT16 .......................
I can't understand the underlying calculus. How is the byte number found? 47 heads * 46 s/t = 2162, ok 2162 * 512 = 1106944, ok but 1817 cyl * 1106944 bytes = 2011317248, not 2012217344 as shown
any idea?
Cylinders of 2162 sectors don't map to exactly 2012217344 Bytes. $ echo 'sz=2012217344;cyl=(2162*512);c=sz/cyl;u=c*cyl; print c," Cyls = ", u, " Bytes\n",\ sz-u, " Bytes ~= ", (sz-u)/512, " unused Sectors\n";\ print 2012217344 - 2011317248, " Bytes\n";' | bc 1817 Cyls = 2011317248 Bytes 900096 Bytes ~= 1758 unused Sectors 900096 Bytes You're missing exactly the bytes that don't match to the geometry. You could use a different geometry to minimize the unused portion of the disk. BTW: 47 heads / 46 sectors is a very weird geometry. fdisk will tell you this when you "verify" the partitioning. You could try the other "standard" geometry of * Cyls/16 Heads/63 Sectors. That leaves only 928 unused Sectors (~464 KB).
I would simply have th how-to say something like:
== The Cylinder / Head / Sector concept is an anachronism from the 1980's and early 1990's. The CHS concept can only describe disks with a max capacity of approximately 4 GB. (ie. (2^16-1)*(2^8 -1)*(2^5-1)*512 bytes).
Correct is: ( 2^10 * 2 ^ 8 * 2 ^ 6 ) - 1 sectors. The 2 highest bits of the sector-byte are used as the highest bits of the cylinder. Thus yielding a max of 16777215 sectors = 8589934080 B = 8191 MB that are theoretically adressable via CHS. IIRC though, the highest values were/are used as a "this is a dummy value", thus it's only 1022 * 254 * 63 sectors ~= 7985 MB.
(You need to verify the number of bits available per field, I'm working from memory.)
Once you've reconstructed an MBR from scratch, using pencil, paper, a calculator for hex->bin->dec conversions and DOS debug.com, you won't forget that fast ;)
Thus the vast majority of currently shipping disks simply use the maximum allowed value for the number of cylinders, heads, and sectors in an effort to allow low-level legacy code to access as much of the disk drive as possible.
A C/H/S of 1023/255/63 marks the CHS-Entry as a "dummy"-Entry, i.e. only the LBA should be used (which only addresses up to 127 GB, as only 28 bits are used). The LBA-48 extension (from Maxtor, specified since ATA-6 IIRC) fixes that for now, addressing up to 128 petabytes.
Boot loaders were some of the last generally used programs to only support disk access via CHS. For this reason even into the early 21st century the boot partition had to be in this early portion of the disk.
Or inside the first 127 GB, more recently, when LBA-48 support is missing. [..]
Hope that makes sense
dito, -dnh PS@jdd: which howto? URL? -- "Human beings make life so interesting. Do you know, that in a universe so full of wonders, they have managed to invent boredom." -- Death -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
David Haller wrote:
Hello,
On Mon, 16 Mar 2009, Greg Freemyer wrote:
On Mon, Mar 16, 2009 at 4:11 AM, jdd
wrote: I'm revising the partition HOWTO, using openSUSE 11.1 as example.
I try to understand fdisk output. namely this one from an USB key:
.......................... Disk /dev/sdb: 2012 MB, 2012217344 bytes 47 heads, 46 sectors/track, 1817 cylinders Units = cylinders of 2162 * 512 = 1106944 bytes Disk identifier: 0x04030201
Device Boot Start End Blocks Id System /dev/sdb1 1 1818 1964932 6 FAT16 .......................
I can't understand the underlying calculus. How is the byte number found? 47 heads * 46 s/t = 2162, ok 2162 * 512 = 1106944, ok but 1817 cyl * 1106944 bytes = 2011317248, not 2012217344 as shown
any idea?
Cylinders of 2162 sectors don't map to exactly 2012217344 Bytes.
$ echo 'sz=2012217344;cyl=(2162*512);c=sz/cyl;u=c*cyl; print c," Cyls = ", u, " Bytes\n",\ sz-u, " Bytes ~= ", (sz-u)/512, " unused Sectors\n";\ print 2012217344 - 2011317248, " Bytes\n";' | bc 1817 Cyls = 2011317248 Bytes 900096 Bytes ~= 1758 unused Sectors 900096 Bytes
You're missing exactly the bytes that don't match to the geometry.
You could use a different geometry to minimize the unused portion of the disk. BTW: 47 heads / 46 sectors is a very weird geometry.
fdisk will tell you this when you "verify" the partitioning.
You could try the other "standard" geometry of * Cyls/16 Heads/63 Sectors. That leaves only 928 unused Sectors (~464 KB).
I would simply have th how-to say something like:
== The Cylinder / Head / Sector concept is an anachronism from the 1980's and early 1990's. The CHS concept can only describe disks with a max capacity of approximately 4 GB. (ie. (2^16-1)*(2^8 -1)*(2^5-1)*512 bytes).
Correct is: ( 2^10 * 2 ^ 8 * 2 ^ 6 ) - 1 sectors. The 2 highest bits of the sector-byte are used as the highest bits of the cylinder. Thus yielding a max of 16777215 sectors = 8589934080 B = 8191 MB that are theoretically adressable via CHS. IIRC though, the highest values were/are used as a "this is a dummy value", thus it's only 1022 * 254 * 63 sectors ~= 7985 MB.
(You need to verify the number of bits available per field, I'm working from memory.)
Once you've reconstructed an MBR from scratch, using pencil, paper, a calculator for hex->bin->dec conversions and DOS debug.com, you won't forget that fast ;)
Thus the vast majority of currently shipping disks simply use the maximum allowed value for the number of cylinders, heads, and sectors in an effort to allow low-level legacy code to access as much of the disk drive as possible.
A C/H/S of 1023/255/63 marks the CHS-Entry as a "dummy"-Entry, i.e. only the LBA should be used (which only addresses up to 127 GB, as only 28 bits are used). The LBA-48 extension (from Maxtor, specified since ATA-6 IIRC) fixes that for now, addressing up to 128 petabytes.
Boot loaders were some of the last generally used programs to only support disk access via CHS. For this reason even into the early 21st century the boot partition had to be in this early portion of the disk.
Or inside the first 127 GB, more recently, when LBA-48 support is missing.
[..]
Hope that makes sense
dito, -dnh
PS@jdd: which howto? URL?
For what its worth windows 98se worked better with an 80G hard drive when the chs values in the partition table were set to 0:0:0 and only the sector values were true. Regards Dave P -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Tue, 2009-03-17 at 04:42 +0100, opensuse +bounces-85590-cwsiv=myrealbox.com@opensuse.org wrote:
Hello,
On Mon, 16 Mar 2009, Greg Freemyer wrote:
On Mon, Mar 16, 2009 at 4:11 AM, jdd
wrote: I'm revising the partition HOWTO, using openSUSE 11.1 as example.
I try to understand fdisk output. namely this one from an USB key:
In place of the authors address I am getting this bounces nonsense since March 17 Lately only half the email is getting through when I check the backup subscription when I compare them. CWSIV -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (7)
-
Carl Spitzer
-
Carlos E. R.
-
Dave Plater
-
David Haller
-
Greg Freemyer
-
jdd
-
Steffen Winterfeldt