Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
WD Green drive (4K sectors), LBA 63, sector alignment ??
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
theosib
Apprentice
Apprentice


Joined: 09 Mar 2004
Posts: 207

PostPosted: Fri Feb 12, 2010 5:17 am    Post subject: WD Green drive (4K sectors), LBA 63, sector alignment ?? Reply with quote

I got one of those WD "Green" drives that has the 4KiB physical sectors. There are warnings about older versions of Windows having problems where they start the partition at LBA 63 and therefore have every 4K cluster one sector out of alignment from the physical disk.

When I use fdisk under Linux to create a "primary" partition, I find that it starts the partition at LBA 63. I've read that Linux is supposedly unaffected, but if the partition starts at LBA 63, doesn't that mean that it's out of alignment?

Is this a bug in fdisk, or does Linux magically do the right thing and align clusters to multiples of 8?
Back to top
View user's profile Send private message
theosib
Apprentice
Apprentice


Joined: 09 Mar 2004
Posts: 207

PostPosted: Fri Feb 12, 2010 2:02 pm    Post subject: Ran an experiment Reply with quote

I ran an experiment. I created a write test that does random 4096-byte writes to the block device with O_SYNC. The block offset is varied in 512-byte increments, and I compare the time it takes to write (and sync) 1000 completely random writes. It's slow because O_SYNC means EVERY write must hit the disk, but it proves the point.

When writing blocks with LBA offsets in multiples of 8, it takes about 7 seconds. When writing blocks with LBA offsets not multiples of 8, it takes about 23 seconds.

Now, this tells me nothing about whether or not ext3 is smart enough to align things differently, although that would violate the partition abstraction, so I'm going to guess that it's doing it wrong.
Back to top
View user's profile Send private message
cyrillic
Watchman
Watchman


Joined: 19 Feb 2003
Posts: 7313
Location: Groton, Massachusetts USA

PostPosted: Sat Feb 13, 2010 1:23 am    Post subject: Reply with quote

You could use parted instead of fdisk to do what you want.

Check man parted for the --align option.
Back to top
View user's profile Send private message
cwr
Veteran
Veteran


Joined: 17 Dec 2005
Posts: 1969

PostPosted: Mon Feb 15, 2010 11:47 am    Post subject: Reply with quote

www.osnews.com has a recent article on this; it looks as if a lot of Linux
tools aren't fully aware of the problem, so you may have to do some
juggling to get partitions correctly aligned. You can get a slowdown
of a factor of 3 or so, so it's worth some tinkering.

Will
Back to top
View user's profile Send private message
jonfr
Veteran
Veteran


Joined: 20 Jul 2003
Posts: 1008
Location: Denmark

PostPosted: Mon Feb 15, 2010 12:28 pm    Post subject: Reply with quote

How does cfdisk handle this type of hard drive ?
Back to top
View user's profile Send private message
Hupf
Tux's lil' helper
Tux's lil' helper


Joined: 11 Sep 2005
Posts: 112
Location: Germany

PostPosted: Mon Feb 15, 2010 1:46 pm    Post subject: Reply with quote

Taken from the /. and osnews forum discussions: the main problem seems to be that the drive is reporting a sector size of 512 bytes (for compatibility e.g. with Windows XP). You have to use a tool where this can be overridden manually (parted does this) or use this method.
Back to top
View user's profile Send private message
theosib
Apprentice
Apprentice


Joined: 09 Mar 2004
Posts: 207

PostPosted: Mon Feb 15, 2010 1:48 pm    Post subject: cfdisk, etc. Reply with quote

cfdisk is part of the same tool suite as fdisk. Besides having a curses interface, it only has a few other minor differences. So I'm sure it does not automatically handle this problem. It's developed by the same people.

BTW, I'm the one who wrote the OSnews article.
Back to top
View user's profile Send private message
cwr
Veteran
Veteran


Joined: 17 Dec 2005
Posts: 1969

PostPosted: Tue Feb 16, 2010 2:33 pm    Post subject: Re: cfdisk, etc. Reply with quote

theosib wrote:
BTW, I'm the one who wrote the OSnews article.


Synchronicity!

Will
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum