Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

After a crash I had to replace one of my HDDs (namely sdd). The old one (and the one left - sdc - and the md0 itself) use a blocksize of 512 Bytes. The new drive has a physical blocksize of 4K.

The question now is, can I add the new drive to the RAID and will it work out?

Here some info from fdisk: (where md0 is the raid, sdc is active, and sdd is the new one that will be used for replacement):

# fdisk -l /dev/md0 /dev/sdc /dev/sdd

Platte /dev/md0: 1000.2 GByte, 1000202174464 Byte
2 Köpfe, 4 Sektoren/Spur, 244189984 Zylinder
Einheiten = Zylinder von 8 × 512 = 4096 Bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Festplatte /dev/md0 enthält keine gültige Partitionstabelle

Platte /dev/sdc: 1000.2 GByte, 1000204886016 Byte
255 Köpfe, 63 Sektoren/Spur, 121601 Zylinder
Einheiten = Zylinder von 16065 × 512 = 8225280 Bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x31eb0cf1

   Gerät  boot.     Anfang        Ende     Blöcke   Id  System
/dev/sdc1               1      121601   976760001   fd  Linux raid autodetect

Platte /dev/sdd: 1000.2 GByte, 1000204886016 Byte
255 Köpfe, 63 Sektoren/Spur, 121601 Zylinder
Einheiten = Zylinder von 16065 × 512 = 8225280 Bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

Festplatte /dev/sdd enthält keine gültige Partitionstabelle

The only other way i can imagine would be creating another md1, adding the new drive to that, copy (rsync -avl) all files to the new md, repartition the old drive to fit the 4K blocksize, disassemble md0, and add the old drive to the new md1.

But this would take a lot of time, so i'd like to avoid that.

share|improve this question
    
What's the problem with standard mdadm's replacement procedure? –  poige Aug 2 '12 at 4:26
    
The thing is, I dont know if the raid will work at all when the drives have different block- and I/O-sizes. –  Peter Aug 2 '12 at 7:24
    
btw. what is your raid stripe size? if it is bigger than 4K and divisible with 4K you can probably just replace the disk. –  Markus Mikkolainen Aug 2 '12 at 7:24
    
@MarkusMikkolainen: It is a RAID1, stripe/chunk size is not used with that kind of RAID. –  Peter Aug 2 '12 at 7:27
    
RAID works with block devices, period. –  poige Aug 2 '12 at 10:13
show 1 more comment

migrated from stackoverflow.com Aug 2 '12 at 3:54

This question came from our site for professional and enthusiast programmers.

2 Answers

It seems to work, without any problems.

What I did:

  1. add the new drive to the RAID and let mdadm sync the drives
  2. remove the new drive from the RAID again after sync is done
  3. run fsck. on the drive
  4. mount the drive and test some directories and files manually
  5. unmount and re-add the drive to the RAID

All these steps worked without any problems. The filesystem worked as expected.

So the answer finally is (without guaranteeing its generality): You can add a device with differing block- and I/O size to a RAID1.

share|improve this answer
add comment

buy another disk. That will cost money but save time.

share|improve this answer
    
Well, this is of course an option, but the drive I need will take some time to ship to my place. TB drives with 512 B block size are not so common. And I would be interested in a technical solution anyways, if there is one. –  Peter Aug 2 '12 at 7:18
    
btw. you dont want to rsync the stuff. I would just dd it over. It will be as fast/faster unless your disk is almost empty and it will guarantee that everything is exactly as it was. –  Markus Mikkolainen Aug 2 '12 at 7:21
    
I've heard that dd will probably not work on drives with different blocksizes, that's why I would go for rsync. –  Peter Aug 2 '12 at 7:28
    
it should work if you dd from md0 to md1 –  Markus Mikkolainen Aug 2 '12 at 7:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.