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.

So I have 1and1 dedicated host with RAID 1 setup. One of the drive went bad, and they had just replaced it with a good one. Now I need to the build, but I'm not sure which drive is the old one, and which one is the new blank one. Please help. Here's the instruction: http://help.1and1.com/servers-c37684/linux-server-c37687/system-recovery-c37690/how-do-i-rebuild-my-software-raid-array-after-a-drive-replacement-a730894.html

As I understand it correctly, I *think* my old drive is /dev/sda, which means I should proceed with step 7 as:

sfdisk -d /dev/sda | sfdisk /dev/sdb

Am I correct? Here's my console stuff. Please help and thank you.

[root@u16365582 ~]# fdisk -l

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


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

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1         523     4194304   fd  Linux raid autodetect
Partition 1 does not end on cylinder boundary.
/dev/sda2             523         784     2097152   82  Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3             784      121602   970470104   fd  Linux raid autodetect
Partition 3 does not end on cylinder boundary.

Disk /dev/md3: 993.8 GB, 993761296384 bytes
2 heads, 4 sectors/track, 242617504 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/md1: 4294 MB, 4294901760 bytes
2 heads, 4 sectors/track, 1048560 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg00-usr: 34.4 GB, 34359738368 bytes
255 heads, 63 sectors/track, 4177 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg00-var: 871.9 GB, 871878361088 bytes
255 heads, 63 sectors/track, 105999 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg00-home: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

[root@u16365582 ~]# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sda1[0]
      4194240 blocks [2/1] [U_]
      bitmap: 1/1 pages [4KB], 65536KB chunk

md3 : active raid1 sda3[1]
      970470016 blocks [2/1] [_U]
      bitmap: 206/232 pages [824KB], 2048KB chunk

unused devices: <none>
[root@u16365582 ~]#
share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

/dev/sda is your "good" drive as reported by mdstat. It also is the one with valid partition data on it as reported by fdisk.

Copying the partitioning information over to /dev/sdb using sfdisk as proposed by the guide should be safe if you did not use /dev/sdb for anything before where you would need to retain its data. After you've done this (and probably after an additional partprobe call) you should be able to mdadm manage [...] --add [...] the partitions /dev/sdb1 and /dev/sdb3 to md1 and md3 respectively.

share|improve this answer
    
Thank you very much! I'm not a huge Linux user, and touching this stuff could potentially wipe out the entire thing, that's why I'm reluctant. –  aZn137 May 20 '13 at 20:03
4  
@aZn137 you should have a backup so wiping out the entire thing would not be that much of a problem - except for the work, downtime and annoyance factor resulting from the restore operation that is. –  the-wabbit May 20 '13 at 20:10
    
very good idea! I have the server running the nightly backup of the entire web root dir, but I'd never thought of backing it up before doing the sync. Then again, I shouldn't have to deal with this as often... I hope. –  aZn137 May 20 '13 at 20:39
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.