3

Recently I came into a problem with partitioning WD20EARS disk (with 4k sectors). I needed partitions to be aligned correctly so I just used parted in "unit s" mode and started all partitions at mod8 sector (drive itself reports, that sector is 512b) and ended all of them at mod8-1 sector.

But then I thought, that may be I should take into account also the cylinder boundaries (I've seen some posts on the net where fdisk complains about partitions not to start/end on cylinder boundary). And then... I thought, that if drive lies about it's sector size, may be it's lying about the whole geometry?

Should I care about partitions to be aligned against cylinder boundaries? If so, how do I find these boundaries? I guess each drive model can contain different sectors per track/cylinder... Or sector alignment is all I should take care of?

Vladislav Rastrusny
  • 2,581
  • 12
  • 39
  • 56

2 Answers2

4

You don't need to worry about cylinder alignment on a modern (post-1998, approximately) hard drive. The C/H/S values have nothing whatsover to do with the actual drive geometry. Your BIOS is choosing and reporting some convenient fictional values for backward compatibility's sake. (You may be able to alter those values through a CMOS setting, at boot time, too.)

Unless you're using a mid-1990s-era OS or something even more ancient (e.g., MS-DOS), the C/H/S values reported by the BIOS are basically irrelevant. Modern Linux and Windows variants use LBA (logical block addressing) for disk I/O, so they address disk sectors, directly, as sector numbers. Disk operations and performance will be exactly the same, regardless of what the C/H/S values are in relation to your partition boundaries.

The 'fdisk' utility may complain, but you can safely ignore it.

Ryan B. Lynch
  • 2,006
  • 1
  • 12
  • 13
  • fdisk will not complain if you switch off those depricated modes manually. Use fdisk -cu -l /dev/mydrive. You have to use the new fdisk (post 01/2010) which understands those flags. Ayway, you have to do it manually, as the depricated C/H/S mode is still set as default. – esc1729 Jul 03 '10 at 17:02
  • Can anybody here maybe answer this question: http://superuser.com/questions/1111952/how-does-linux-get-the-geometry-of-a-compact-flash-card ? – dummzeuch Aug 15 '16 at 08:53
  • *Modern Linux and Windows variants use LBA*. Can you provide any source for this? I haven't found any reliable info on this. I also don't know which linux kernel component is reading the partitions... – goulashsoup Aug 10 '22 at 10:34
  • @goulashsoup ... Did you read the wikipedia article? https://en.wikipedia.org/wiki/Logical_block_addressing#Operating_system_dependencies ... Looks like I was wrong about Windows, too. – Ryan B. Lynch Aug 12 '22 at 01:27
  • I have read the wiki article, you propably mean the paragraph *Some operating systems do not require any translation...* which has NO sources provided, thats basically hearsay... **Or does the article provide a referenced info that i missed?** – goulashsoup Aug 12 '22 at 08:18
1

Wrong, it sould care in case you use Grub4DOS map onto memory, it uses C/H/S not LBA and with a lot of VHD files the MBR say C/H/S value different from the partition C/H/S value.

That when the VHD file is created with windows native tool Diskpart and the partitions its self are also created with such tool.

So sometimes C/H/S matter also on year 2017.

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
Laura
  • 11
  • 1