• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Partition alignment on large (2TB) drives

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

HankB

Member
Joined
Jan 27, 2011
Location
Beautiful Sunny Winfield
It gives me a headache. The problem results because the drives lie to the BIOS/OS about sector size because some vendors were slow to accommodate 2048 byte sectors. :rolleyes:

I thought that if I kept (512 byte) sectors on 8 sector boundaries, everything was good. I'm trying to fix this on one of my drives and am getting the following result (with units in sectors)

Code:
(parted) mkpart logical linux-swap 3901074272 3907029127                
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel?

I don't understand why this is not aligned.

Start => 3901074272/8 => 487634284 - evenly divisible by 8.
End => (3907029127 +1) => 488378641 - evenly divisible by 8
488378641 - 487634284 => 744357 - ???

Are there other rules for partition size? Does the resulting partition have to be some certain multiple of sectors? (This is swap but I'll also need to move some EXT4 partitions.)

I'm working at the sector level because this is half of a mirrored set. It is going to be a lot easier to complete this work if I do not resize the partitions when I move them.

I've searched on this and cannot find the rules for determining good partition alignment (at least in terms of sector counts.)

thanks,
hank
 
Wow, what a PITA.

2048 byte sectors must result in a lot of wasted slack space.

Wouldn't you want 512 bytes on 4 sector boundaries? Not 8?
 
Wow, what a PITA.
Yes!
2048 byte sectors must result in a lot of wasted slack space.
I have no idea. At one point I recall talk about using the extra space in whatever minimum allocation space the OS uses. I have no idea if any modern OS/FS does that.

Wouldn't you want 512 bytes on 4 sector boundaries? Not 8?
You really want to use the physical disk block size. Otherwise if the OS writes a smaller block, the drive has to read the physical block that holds the data, update the portion that the OS requested the write for and then write the physical block back. If that isn't bad enough, if the OS requests a write of a block that crosses two physical blocks, then two read/modify/write cycles are required. I think that SSDs require erase over a larger block yet, making the situation even worse when an SSD gets close to full (AKA write amplification.)

But back to your question, I'm not really sure what is needed, but I know it is at minimum starting the first block on a 2048 byte boundary.

Or am I confusing bytes and blocks. Yes I am. :rolleyes: Alignment (and probably allocation size) needs to be done on 8x512kb boundaries.
 
run parted -a optimal /dev/sdX

mklabel gpt (answer yes)

unit TB

mkpart primary 0% 100%


The above is what I had to do with my 4TB drives and that prevented any errors from coming up about being misaligned.
 
Back