Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

When I first installed Ubuntu a couple years ago, I set it up with a software RAID using the Ubuntu alternate install disk. I have two 500 GB drives in the RAID.

A few days ago, one of the drives failed. I had to switch the boot order of the drives in the computer's BIOS, but other than that, the computer kept on truckin'. All my data is safe on the remaining drive.

I bought a new drive to replace the defective one, and it is installed in my computer. If I look at it with gParted Partition Manager, I can see it's there with all its space unallocated.

How do I get Ubuntu to see it as part of the RAID and begin mirroring the other drive?

dave@homebase:~$ sudo fdisk -lu

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00078955

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *          63    39070079    19535008+  fd  Linux raid autodetect
/dev/sda2        39070080    46877669     3903795   fd  Linux raid autodetect
/dev/sda3        46877670   781449794   367286062+  fd  Linux raid autodetect
/dev/sda4       781449795   976768064    97659135   83  Linux

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/sdb doesn't contain a valid partition table

Disk /dev/md2: 376.1 GB, 376084365312 bytes
2 heads, 4 sectors/track, 91817472 cylinders, total 734539776 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/md2 doesn't contain a valid partition table

Disk /dev/md1: 3997 MB, 3997368320 bytes
2 heads, 4 sectors/track, 975920 cylinders, total 7807360 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/md1 doesn't contain a valid partition table

Disk /dev/md0: 20.0 GB, 20003749888 bytes
2 heads, 4 sectors/track, 4883728 cylinders, total 39069824 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/md0 doesn't contain a valid partition table
dave@homebase:~$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/md0               19G  4.5G   13G  26% /
none                  1.8G  708K  1.8G   1% /dev
none                  1.8G  752K  1.8G   1% /dev/shm
none                  1.8G  332K  1.8G   1% /var/run
none                  1.8G     0  1.8G   0% /var/lock
/dev/sda4              92G  211M   87G   1% /tmp
/dev/md2              345G  237G   91G  73% /home
192.168.0.12:/home/mythbuntu
                      651G  174G  444G  29% /home/dave/Mythbuntu
dave@homebase:~$ cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] 
md0 : active raid1 sda1[1]
      19534912 blocks [2/1] [_U]

md1 : active (auto-read-only) raid1 sda2[1]
      3903680 blocks [2/1] [_U]

md2 : active raid1 sda3[1]
      367269888 blocks [2/1] [_U]

unused devices: <none>
share|improve this question
1  
That depends on your existing partition layout. Edit your question to include the output of sudo fdisk -lu and df -h and cat /proc/mdstat –  psusi Jul 13 '11 at 13:48
    
You have a very strange setup. Why do you have /tmp mounted on /dev/sda4? You seem to have 3 raid arrays, but are not using md1. Why is this? –  psusi Jul 13 '11 at 15:20

2 Answers 2

You need to first copy the partition table from sda to sdb. You can do it manually, or this explains a clever way to do it:

http://www.sharktooth.de/doku.php/linux:clone_disc_partition

Once thats done, you need to use the raid admin utility, mdadm, to add the partitions into each raid:

mdadm -a /dev/md0 /dev/sdb1
mdadm -a /dev/md1 /dev/sdb2
mdadm -a /dev/md2 /dev/sdb3

This should hot-add the new partitions in and start to rebuild onto them.

share|improve this answer
up vote 1 down vote accepted

Answer found here.

Basically, just use gnome-disk-utility (Under System->Administration in Gnome). Point and click. Nice and easy.

share|improve this answer
    
Accept your answer! –  djeikyb Aug 8 '11 at 12:29
    
Whatever happened to "please"? –  Questioner Aug 8 '11 at 14:55

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.