[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

amd64 debian wheezy installation: software raid: partition misaligned by 512 bytes



Hi,

I built my current desktop and installed debian etch a few years ago. Then in time I successfully upgraded to lenny and squeeze when they were both officially released at the time. A couple of weeks ago I updated to wheezy, and that screwed up grub configuration and debian refused to boot from mdraid devices (I am running software RAID-1). Spent some time fixing it, but by that time my drives started failing, so I decided to upgrade.
I ordered 2 1T WD Blue WD10EZEX. These drives apparently use Advanced Format, which I didn't pay attention to at the time.

So, I reinstalled Debian Wheezy using netinst.iso. I configured during installation 3 partitions:

/dev/sda1 50G /
/dev/sda2 10G swap
/dev/sda3 (rest of the drive ~940G) /home

Then same with /dev/sdb

/dev/sdb1 50G /
/dev/sdb2 10G swap
/dev/sdb3 ~940G /home

then used the installer to configure software RAID-1 like that:
/dev/sda1 + /dev/sdb1 -> /dev/md0
/dev/sda2 + /dev/sdb2 -> /dev/md1
/dev/sda3 + /dev/sdb3 -> /dev/md2

With that installation proceeded nicely and I have debian wheezy now installed. The problem is that after I logged in Gnome I see in Disk Utility, for all 3 RAID md devices:

WARNING: The partition is misaligned by 512 bytes. This may result in very poor performance. Repartitioning is suggested.

Now, when I check the partitions that we created during installation on the disk seem to actually be aligned properly with the offset of 2048 sectors (x 512 bytes = 1M?):

root@sonata:~# fdisk -l /dev/sda /dev/sdb

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00030b9a

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048    97656831    48827392   fd  Linux raid autodetect
/dev/sda2        97656832   117188607     9765888   fd  Linux raid autodetect
/dev/sda3       117188608  1953523711   918167552   fd  Linux raid autodetect

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x0006affd

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048    97656831    48827392   fd  Linux raid autodetect
/dev/sdb2        97656832   117188607     9765888   fd  Linux raid autodetect
/dev/sdb3       117188608  1953523711   918167552   fd  Linux raid autodetect

On the other hand, when I check the RAID-1 devices I get the misalignment:

root@sonata:~# fdisk -l /dev/md0 /dev/md1 /dev/md2

Disk /dev/md0: 50.0 GB, 49965563904 bytes
255 heads, 63 sectors/track, 6074 cylinders, total 97588992 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x000cfa3c

    Device Boot      Start         End      Blocks   Id  System
/dev/md0p1   *          63    97578809    48789373+  83  Linux
Partition 1 does not start on physical sector boundary.

Disk /dev/md1: 9991 MB, 9991749632 bytes
255 heads, 63 sectors/track, 1214 cylinders, total 19515136 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x000e0613

    Device Boot      Start         End      Blocks   Id  System
/dev/md1p1              63    19502909     9751423+  82  Linux swap / Solaris
Partition 1 does not start on physical sector boundary.

Disk /dev/md2: 940.1 GB, 940069158912 bytes
255 heads, 63 sectors/track, 114290 cylinders, total 1836072576 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x0001ead5

    Device Boot      Start         End      Blocks   Id  System
/dev/md2p1              63  1836068849   918034393+  83  Linux
Partition 1 does not start on physical sector boundary.

Now, the questions :)

1. Should the /dev/md{0,1,2}p1 devices Start at 64 and not 63? Or some other cylinder number to be properly aligned? That would explain the exact 512 bytes misalignment (1 sector)?

2. How did that happen? The partitiions on the disk were properly aligned, the sda1 sda2 sda3 sdb1 sdb2 sdb3? If they were properly aligned why weren't md devices created with proper alignment?

3. How significant of a performance drag are we talking in this particular case?

4. What are my options right now? How do I fix it? Can I fix it without reinstalling Debian Wheezy again?

5. If I have to go through the process of reinstalling again using debian wheezy netinst.iso, what exactly (and how) I am supposed to choose to make sure that md0 Starts at 64 and NOT 63? I didn't see these options during the installation? Also, since the partitions on the disk have 1M offset, should the MD devices also have 1M offset? Or that 63 offset starts AFTER the 1M offset? What should the proper Start be for the MD device in this case then? 64? Or a larger number? Another 2048 (1M)?


Would appreciate any insight here :)


--
Sincerely yours,
Alexandru Cardaniuc

Reply to: