Results 1 to 10 of 10

Thread: 4K vs 512B alignment?

  1. #1
    Join Date
    Jun 2008
    Location
    Prescott, AZ
    Posts
    1,191

    Default 4K vs 512B alignment?

    I just ghosted a hard drive containing Win7 and OS11.4 to a new WD hard drive with 4K byte alignment. WD provides a tool to align Win7 (and it apparently needed it) but reports other partition types (Ext3/4) as corrupt. Here's the question: is there a way to get 4K byte alignment in Ext3/4 after installation, or do I need to reinstall? Is there an authoritative page on this for OpenSuSE/Kubuntu?

    Thanks!
    PattiMichelle

  2. #2
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,683
    Blog Entries
    4

    Default Re: 4K vs 512B alignment?

    After installation is too late. You have to align it at the partitioning stage. Do a search for 4kB block alignment linux.

  3. #3
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    32,347
    Blog Entries
    15

    Default Re: 4K vs 512B alignment?

    Quote Originally Posted by ken yap
    After installation is too late. You have to align it at the partitioning
    stage. Do a search for 4kB block alignment linux.
    Hi
    I would also ensure that you have the latest firmware on the drive as
    well, and make sure you have a backup drive for your data.

    --
    Cheers Malcolm °¿° (Linux Counter #276890)
    openSUSE 11.4 (x86_64) Kernel 2.6.37.6-0.5-desktop
    up 2 days 21:09, 3 users, load average: 0.06, 0.08, 0.05
    GPU GeForce 8600 GTS Silent - Driver Version: 270.41.06


  4. #4
    Join Date
    Jun 2008
    Location
    Prescott, AZ
    Posts
    1,191

    Default Re: 4K vs 512B alignment?

    Thanks - I will search. I was hoping for a tool that would do the alignment - Acronis does it for NTFS...

  5. #5
    Join Date
    Jun 2008
    Location
    Prescott, AZ
    Posts
    1,191

    Default Re: 4K vs 512B alignment?

    >After installation is too late. You have to align it at the partitioning stage.
    >

    Ahhh... maybe that explains why Acronis WD-aligh could not align my NTFS partition that's within the extended partition? (It did ok in the Win7 system partition) Do all the current flavors of Linux do the correct (4K) byte alignments during a standard install? (I didn't find any information more recent than 2010) I wonder if gparted is getting close to dealing with this problem?

  6. #6
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,683
    Blog Entries
    4

    Default Re: 4K vs 512B alignment?

    I don't think that all Linux distro installers are 4kB savvy yet, but don't quote me.

  7. #7

    Default Re: 4K vs 512B alignment?

    PattiMichelle wrote:
    >> After installation is too late. You have to align it at the

    > partitioning stage.
    >
    > Ahhh... maybe that explains why Acronis WD-aligh could not align my
    > NTFS partition that's within the extended partition? (It did ok in the
    > Win7 system partition) Do all the current flavors of Linux do the
    > correct (4K) byte alignments during a standard install? (I didn't find
    > any information more recent than 2010) I wonder if gparted is getting
    > close to dealing with this problem?


    There is no way that Linux or any other installer can automatically deal
    with all WD drives, because some of them *lie* about their block size.
    You need to be very careful about the exact model number. Google for wd
    4k block size problem or somesuch and you will find lots of info.

  8. #8
    Join Date
    Jan 2009
    Location
    Switzerland
    Posts
    1,529

    Default Re: 4K vs 512B alignment?

    I wonder if gparted is getting close to dealing with this problem?
    Well, sort of. I have quite a number of those WD - xx EARS drives in use and I do format all of them with parted before installing any OS. The trick is to start the first partition with sector 64 (63 would be the default) and then make every partition a multiple of 8 blocks (yes, parted believes that the drive has 512 byte blocks).
    Technology is 'stuff that doesn't work yet.' -- Bran Ferren

  9. #9
    Join Date
    Jun 2008
    Location
    Prescott, AZ
    Posts
    1,191

    Default Re: 4K vs 512B alignment?

    Quote Originally Posted by vodoo View Post
    Well, sort of. I have quite a number of those WD - xx EARS drives in use and I do format all of them with parted before installing any OS. The trick is to start the first partition with sector 64 (63 would be the default) and then make every partition a multiple of 8 blocks (yes, parted believes that the drive has 512 byte blocks).
    Thank you everyone for the discussion!!

    OK, so the linux install *won't* install correctly without knowledgable user intervention, yes? I've taken to installing multiple OS's, and lately I keep the Win7 bootloader... I guess I could partition with Win7's partitioner (I don't think it's as powerful as parted). Correct me if I'm wrong, but I *think* if Win7 already has put its 4K-aligned partition in-place on a HD, then subsequent partitions are forced by parted to be 4K aligned? When I've created partitions in parted (during install) and I've only just give size roughly (like 12.9GB) - I'm wondering if parted translates that into 512B-sized numbers, like 1291776B or if it is smart enough to make that size = 1290240B (divisible by 4K) so that the next partition is 4K aligned? I just don't know enough about hard drive bytestacking to know whether this is too simplistic.

    Maybe I have to declare every partition's size (starting and ending) in parted to be a number divisible by 4096? Wait, doesn't parted ask for "cylinders?"

    Does starting a root partition at 64B really force the entire drive (all subsequent partitions) to be 4K aligned?

  10. #10
    Join Date
    Jan 2009
    Location
    Switzerland
    Posts
    1,529

    Default Re: 4K vs 512B alignment?

    OK, so the linux install *won't* install correctly without knowledgable user intervention, yes?
    correct.

    Correct me if I'm wrong, but I *think* if Win7 already has put its 4K-aligned partition in-place on a HD
    You could use parted to check that Win7 has created properly aligned partitions.

    ...then subsequent partitions are forced by parted to be 4K aligned?
    No. They will be properly aligned when every subsequent partition has a size which is a multiple of 8 (512B) sectors. Parted does not know about the internal 4K blocks of the drive and it displays the number of 512B sectors. To the outside world the drive pretends to have 512B blocks. This was made by the manufacturer to make the drives "compatible" but the effect is a misalignment of the partitions in most cases.

    When I've created partitions in parted (during install) and I've only just give size roughly (like 12.9GB) - I'm wondering if parted translates that into 512B-sized numbers, like 1291776B or if it is smart enough to make that size = 1290240B (divisible by 4K) so that the next partition is 4K aligned?
    No. It is manual work. You must enter the desired partition size in numbers of 512 Byte sectors and these numbers must divide by 8. Use the 'unit s' command to make parted display sector counts. This is an example:

    Code:
    GNU Parted 2.2
    Using /dev/sda
    Welcome to GNU Parted! Type 'help' to view a list of commands.
    (parted) unit s                                                           
    (parted) print                                                            
    Model: ATA WDC WD10EARS-00Y (scsi)
    Disk /dev/sda: 1953525168s
    Sector size (logical/physical): 512B/512B
    Partition Table: msdos
    
    Number  Start       End          Size        Type     File system     Flags
     1      64s         4112639s     4112576s    primary  ext2            boot, type=83
     2      4112640s    963899999s   959787360s  primary  ext4            type=83
     3      963900000s  974182399s   10282400s   primary  linux-swap(v1)  type=82
     4      974182400s  1953523711s  979341312s  primary  ext4            type=83
    
    (parted) unit chs                                                         
    (parted) print
    Model: ATA WDC WD10EARS-00Y (scsi)
    Disk /dev/sda: 121601,80,62
    Sector size (logical/physical): 512B/512B
    BIOS cylinder,head,sector geometry: 121601,255,63.  Each cylinder is 8225kB.
    Partition Table: msdos
    
    Number  Start        End           Type     File system     Flags
     1      0,1,1        255,254,62    primary  ext2            boot, type=83
     2      256,0,0      59999,254,62  primary  ext4            type=83
     3      60000,0,0    60640,12,43   primary  linux-swap(v1)  type=82
     4      60640,12,44  121601,57,55  primary  ext4            type=83
    Every partition size divides by 8. Can you see that parted detects a logical/physical sector size of 512B? It's up to you to take the hidden internal block size into account.
    Technology is 'stuff that doesn't work yet.' -- Bran Ferren

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •