Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a RHEL 6 fileserver. It contains two identical 2TB SATA drives. Both are supposed to contain one partition that takes up all the space on the drive (and this used to be the case). When I had set up the system, this meant I had a /dev/sda1 and a /dev/sdb1 that constituted the two active members of my raid array. Both partitions, at that time, spanned all the cylinders on the drive. /dev/md0 maps to /. (There are no separate partitions for /boot or anything else.)

sda got removed from the raid recently due to an lba addressing failure, and - after verifying the drive - I mindlessly added /dev/sda to the raid instead of /dev/sda1. When I realized my mistake, I set /dev/sda to faulty, removed it from the raid, and decided to recreate /dev/sda1 as a single partition that covers the whole drive and re-add that to the raid.

I'm failing in this mission because I can't get the /dev/sda1 partition to match the size of the /dev/sdb1 partition.

Both drives are identical, as previously stated, and so they have the same number of cylinders. Let's say this number is X. fdisk will let me create a /dev/sda1 partition that goes from cylinder 1 to cylinder X. Great. But md won't let me add that to the array, because it says the sizes aren't the same. So I looked at /dev/sdb1 via fdisk, and here's the thing: it goes from cylinder 1 to cylinder X+1! Huh?

Can someone explain what's going on to me and tell me how to fix this?

share|improve this question
"Fdisk -l" shows things using cylinder resolution, could you post the output of "fdisk -lu" for both /dev/sda and /dev/sdb? That will give sector resolution. – kbyrd Nov 2 '11 at 14:16
fdisk -lu shows identical information for the two drives (other than their serial number). It's hard for me to post the data here, since I'm not running a browser on the fileserver. – clu Nov 2 '11 at 15:57

You may be encountering a rounding error when selecting the final cylinder. Try specifying a slightly smaller partition size and let the partition software round up for you.

share|improve this answer
Tried that; no-go. It still stays one cylinder smaller than needed. – clu Nov 2 '11 at 15:57

Update: I did the opposite. I removed /dev/sdb1 from md0, tried re-partitioning it, and then re-adding /dev/sdb1. This didn't work either, since /dev/sda is now one cylinder bigger than /dev/sdb1, and /dev/sda is part of md0. So I added /dev/sdb (and not its partition) to md0. That worked. So now I have /dev/sda and /dev/sdb added to /dev/md0. At least, there's symmetry. Now I have a new problem regarding grub, and I've posted a follow-up question for it.

share|improve this answer

First off, I have no idea what is going on. But I think you can still end up with your RAID made up of partitions. First, wipe the beginning of /dev/sda to clear out any partition table or RAID signature or anything with (Be careful, this will destroy data on sda)

dd if=/dev/zero of=/dev/sda bs=1M count=10

Then try one of the following

Interactive fdisk:

  1. Do 'fdisk -lu /dev/sdb' to figure out the exact sectors /dev/sdb1 starts and ends on.
  2. Do interactive fdisk on /dev/sdaa with 'fdisk /dev/sda'. Type 'u' so you can work in sectors. Create a new primary partition using the beginning/end sectors shown from step 1.
  3. Save in fdisk, then either verify with 'fdisk -l' or try mdadm again with /dev/sda1.

Brute force:

  1. Copy the partition table from /dev/sda to /dev/sdb with 'dd if=/dev/sdb of=/dev/sda bs=512 count=1'.
  2. Either reboot or run 'partprobe' to get the system to recognize the new /dev/sda1. Try to add /dev/sda1 with mdadm


  1. Create sda1 the size you want (slightly smaller is fine).
  2. Recreate a new RAID array (md1) with /dev/sda1 and a missing device. 'mdadm --create /dev/md1 --level 1 --raid-devices=2 missing /dev/sda1'
  3. Create a filesystem on /dev/md1 and mount both /dev/md0 and /dev/md1.
  4. Copy the contents of /dev/md0 to /dev/md1.
  5. Repartition /dev/sdb1 to be the size you used in step 1.
  6. Add /dev/sdb1 to /dev/md1.
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .