LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   how many HDD cylinders = 1 megabyte? (https://www.linuxquestions.org/questions/slackware-14/how-many-hdd-cylinders-%3D-1-megabyte-430257/)

asilentmurmur 03-31-2006 03:59 AM

how many HDD cylinders = 1 megabyte?
 
hey everyone this is a general question.

I am using Fdisk to partition my drive so i can install slack 10.2. the units its giving me are in cylinders. I wanted to know how many cylinders equal 1 megabyte. Also in cfdisk how do i create an extended partition?

cor67393 03-31-2006 04:24 AM

Why do you want to use both fdisk and cfdisk?
I suggest sticking with cfdisk, and so does the manpage of fdisk ;).

With cfdisk, to make an extended partition, just make a logical partition. Under linux, /dev/hdx[1-4] are primary partitions, and /dev/hdx[n>4] are logical partitions, which automatically reside in an extended partition. I think, if you use logical partitions you can't use /dev/hdx4, and are limited to three primary partitions.

Using cfdisk, you just specify the partition size in bytes and don't worry about cylinders and all that stuff. To make a logical partition, just make a partition with number larger than (or equal to) 5.

weibullguy 03-31-2006 04:35 AM

Actually fdisk allows you to set partition sizes in MB as well. When fdisk asks you for the ending cylinder, just type +XXXXM to set the size in MB.

Randux 03-31-2006 06:04 AM

Actually, it isn't MB if you say +.M It's disk-drive manufacturers' megabytes = 1 million bytes, not 1024x1024 bytes like everyone else in the world thinks. That way they get to rip you off a few billion bytes on a "40G" hard drive.

To answer the original question, when you do fdisk -l it tells you the size of your drive based on how it was configured. For example:

Disk /dev/hda: 40.0 GB, 40000776920 bytes (see what I mean, this is NOT 40 GB!!!)
255 heads, 63 sectors/track, 4864 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

So your answer is 1M / 8225280 = number of cylinders per "manufacturer's megabyte" since each cylinder has 8225280 bytes.

A better way, using the suggestions above is to remember that real megabytes are approx. equal to 1024 "manufacturer's megabytes." So you can just say +1024M for 1G, +2048M for 2G, etc.

Alien_Hominid 03-31-2006 11:43 AM

Quote:

Originally Posted by Randux
It's disk-drive manufacturers' megabytes = 1 million bytes, not 1024x1024x1024

Actually 1 megabyte is 1024 kilobytes, where 1 kilobyte is 1024 bytes. So 1 megabyte is 1024*1024 bytes.
Quote:

Originally Posted by Randux
Disk /dev/hda: 40.0 GB, 4000776920 bytes (see what I mean, this is NOT 40 GB!!!)

Yeap. You only have 4GB drive. ;) You missed one number, because if you have 40GB drive, that is 40,000,000,000 bytes. There are 11 numbers not 10.

I don't know if all the cylinders have the same size (because the tracks which they consist of are different length). So I don't know if the size of cylinder could be counted. I guess that cylinders which are nearer the center of the hard disk circle are smaller than the outer ones. Maybe somebody could clarify this to me?

onebuck 03-31-2006 12:53 PM

Quote:

Originally Posted by cor67393
Why do you want to use both fdisk and cfdisk?
I suggest sticking with cfdisk, and so does the manpage of fdisk ;).

With cfdisk, to make an extended partition, just make a logical partition. Under linux, /dev/hdx[1-4] are primary partitions, and /dev/hdx[n>4] are logical partitions, which automatically reside in an extended partition. I think, if you use logical partitions you can't use /dev/hdx4, and are limited to three primary partitions.

Using cfdisk, you just specify the partition size in bytes and don't worry about cylinders and all that stuff. To make a logical partition, just make a partition with number larger than (or equal to) 5.

Hi,

As for your description about the extended partition requirement for /dev/hdx4 is not correct! You can create an extended partition for any device assignment, be it for /dev/hdx1, /dev/hdx2, /devhdx3 or /dev/hdx4.

If you make /dev/hdx3 the extended partition then the first logical will be /dev/hdx5. With space allocation for each desired logical up to the amount of the extended space.

HTH!

gnashley 03-31-2006 01:21 PM

Cylinders don't stand for any particular size. Usually a drive can be set up with more than one cylinder, head and sector geometries.

Randux 04-01-2006 11:38 AM

Quote:

Originally Posted by Alien_Hominid
Actually 1 megabyte is 1024 kilobytes, where 1 kilobyte is 1024 bytes. So 1 megabyte is 1024*1024 bytes.

Yeap. You only have 4GB drive. ;) You missed one number, because if you have 40GB drive, that is 40,000,000,000 bytes. There are 11 numbers not 10.

I don't know if all the cylinders have the same size (because the tracks which they consist of are different length). So I don't know if the size of cylinder could be counted. I guess that cylinders which are nearer the center of the hard disk circle are smaller than the outer ones. Maybe somebody could clarify this to me?

Couple of typos- so sue me :D

Alien_Hominid 04-01-2006 11:47 AM

I have only noticed this because hdd architecture is rather interesting thing for me (I don't know much about it) so I have analyzed your post and saw some minor typos. I have revealed them that they wouldn't confuse the newbies. ;)

Randux 04-01-2006 11:53 AM

I'm glad somebody read it! In answer to your question, I think all cylinders and tracks contain the same number of bytes by definition. Otherwise nobody could plan allocation. I'm not sure how it works because as you mention, rotational speed is different on various parts of the platter. This is a very old problem (disks have been around for 40 years?) and I'm sure they have elegant solutions by now. Maybe the sectors have different sizes in different parts of the platter.

Alien_Hominid 04-01-2006 12:06 PM

I think that sectors can't have different sizes otherwise you wouldn't know the way how to adress them.
Quote:

Originally Posted by http://en.wikipedia.org/wiki/Cylinder-head-sector
Cylinder-head-sector, also known as CHS, is a method of addressing data on a hard drive.

Every hard drive consists of platters and read-write heads. If a drive has four platters, it has eight read-write heads, one on each side of each platter. The head value is the number of read-write heads in the drive.

Each platter is divided into tracks. The cylinder value is the number of tracks on one side of each platter. There are the same number of cylinders on each side of each platter. The sector value is the number of sectors in each cylinder (or track), each sector consisting of (normally) 512 bytes.

Older hard drives, such as MFM and RLL drives, divided each cylinder into an equal number of sectors and the CHS values matched the physical makeup of the drive. A drive with a CHS value of 500 x 4 x 32 would have 500 tracks per side of each platter, two platters, and 32 sectors per cylinder, with a total of 32,768,000 bytes (about 31 megabytes). Most modern drives have a surplus space that doesn't make a cylinder boundary. Each partition should always start and end at a cylinder boundary. Only some of the most modern operating systems may disregard this rule, but this can cause some compatibility problems, especially if the user wants to boots up to more than one OS on the same drive.

IDE drives have replaced the MFM and RLL drives, and are much more efficient at storing data. They use Zone Bit Recording (ZBR), where the number of sectors in a cylinder varies with its location on the drive. Cylinders nearer to the edge of the platter contain more sectors than cylinders near the spindle because there is more space in a given track near the edge of the platter. The CHS addressing system does not work on these drives because of the varying number of sectors per cylinder. An IDE drive can be configured in system BIOS with any configuration of cylinders, heads, and sectors that does not exceed the capacity of the drive. The drive converts the given CHS address into the actual address for the specific hardware configuration.

So as you see the size of sector is the same, only there are a different number of sectors in each track.

Randux 04-01-2006 03:57 PM

This explanation doesn't sound reasonable either- the geometry is included in the fdisk output. It shows the number of sectors/track as a fixed number!

Alien_Hominid 04-01-2006 11:55 PM

It only show's that for compatibility with software purposes (make CHS addressing possible). Do you really think that my:
Code:

Disk /dev/sda: 120.0 GB, 120030944768 bytes
255 heads, 63 sectors/track, 14592 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

has 255 heads? So there would be around 123 platters. In reality there are 3.


All times are GMT -5. The time now is 11:23 PM.