Software RAID after the fact?

Associate
Joined
24 Jun 2007
Posts
1,869
Location
Landan.
Does anyone know how to do this? I've bought two more 1Tb Samsung F1's and want to software RAID the existing 1Tb disk with another.

I've been told by colleagues that it's certainly possible, but haven't got a clue how I'd go about implementing it. Also, the server is pretty important now, and I can't really afford to do anything risque and lose the data. I'd Google it - but can't really think of how to term it?

Also, can anyone recommend the best way of doing a full disk backup?

I have a 1Tb disk - 100-200GB (the root partition, and the boot partition etc) of it are important. /opt is just a place for downloads and inconsequential stuff - and makes up the other 600GB of the disk. I was thinking of just ghosting it using Ghost or Acronis, but I'd rather make it a regular thing if possible, and ideally would like for the system to stay online whilst it's done (moon on the stick maybe).
 
So do you have two disks in total, or three?

If either way - create a degraded RAID (i.e. a RAID missing a disk), clone the data onto the degraded RAID and then add the old disk to the array once copy verification of the data is complete.

Once it has rebuilt, you have a fully functional, very almost in-place RAID.

Also - I tend to build LVM volumes on RAIDs in case I want to increase the size of the array at a later date.
 
Cheers for the reply - I've been reading guides all afternoon - I think I'm too scared about losing the original partition though and will end up bottling it.

5.6 RAID-1

You have two devices of approximately same size, and you want the two to be mirrors of each other. Eventually you have more devices, which you want to keep as stand-by spare-disks, that will automatically become a part of the mirror if one of the active devices break.
Set up the /etc/raidtab file like this:
raiddev /dev/md0
raid-level 1
nr-raid-disks 2
nr-spare-disks 0
persistent-superblock 1
device /dev/sdb6
raid-disk 0
device /dev/sdc5
raid-disk 1
If you have spare disks, you can add them to the end of the device specification like device /dev/sdd5
spare-disk 0
Remember to set the nr-spare-disks entry correspondingly. Ok, now we're all set to start initializing the RAID. The mirror must be constructed, eg. the contents (however unimportant now, since the device is still not formatted) of the two devices must be synchronized.
Issue the
mkraid /dev/md0
command to begin the mirror initialization. Check out the /proc/mdstat file. It should tell you that the /dev/md0 device has been started, that the mirror is being reconstructed, and an ETA of the completion of the reconstruction.
Reconstruction is done using idle I/O bandwidth. So, your system should still be fairly responsive, although your disk LEDs should be glowing nicely.
The reconstruction process is transparent, so you can actually use the device even though the mirror is currently under reconstruction.
Try formatting the device, while the reconstruction is running. It will work. Also you can mount it and use it while reconstruction is running. Of Course, if the wrong disk breaks while the reconstruction is running, you're out of luck.
So if I was to follow the above, at the point in bold - it wouldn't wipe anything off hda - but just copy it exactly as is to hdb? And then once it's finished syncing, I could carry on as normal?

I'm scared :(
 
So do you have two disks in total, or three?

If either way - create a degraded RAID (i.e. a RAID missing a disk), clone the data onto the degraded RAID and then add the old disk to the array once copy verification of the data is complete.

Once it has rebuilt, you have a fully functional, very almost in-place RAID.

Also - I tend to build LVM volumes on RAIDs in case I want to increase the size of the array at a later date.

Sorry, I didn't see this reply.

I've now got the two new disks in RAID-1, but mdstat tells me I've got almost 9 days until they're synced :(

I intended to do almost as you said - create the two disk array, copy the current disk to the array and let them sync, remove the old disk and do a grub-install /dev/md0.

Do you think that would work?
 
Ah, sorry - missed the point about booting from the RAID... I've not done that from a software RAID, but apparently it is possible.

Have a look here: linky

Basically - you need to make sure that your a) your kernel supports it and b) your initramfs (if you use one) also supports it.

Full disk backups - I usually use dd (needs some downtime though).

Code:
# dd if=/dev/zero of=/tmp/meep ; rm /tmp/meep
>>>>>> creates a file containing zero bytes until the drive is full, then deletes the file
>>> downtime needed here - boot into livecd.  You *can* use the running filesystem... but you're *going* to get weird stuff happening if you restore from it.
# dd if=/dev/sda | gzip -1 - | scp [email protected]:/path/to/backup/location/backup.gz
>>>>>> go for a cuppa or two here....
 
Last edited:
Cheers for the post. Yep, was considering using DD but as you say doing it live will no doubt cause some bad errors upon a restore =/ Think I might give Acronis a shot, just for peace of mind.

And bah:

Code:
root@zivi:/opt/raid/dump# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdc1[1] sdb1[0]
      976759936 blocks [2/2] [UU]
      [>....................]  resync =  1.9% (18880192/976759936) finish=11908.3min speed=1340K/sec

unused devices: <none>

That's taken about six hours - notice the crappy write speed :(
 
There are several articles (for different Linux distributions) on Howtoforge on how to convert an existing Linux system from single disk to software mirrored disks for booting with minimal disruption (maybe one reboot and no restores). Seem fairly striaght forward if you know, and understand, what you are doing.

I haven't tried them but you may want to have a look (but remember to back up any data/configuration files before you do anything Just in case it all goes the way of the pear).

edit: on Howtoforge do a search for mdadm and it'll return results for configuring RAID1 (mirroring) on various linux flavours with and without LVM.
 
Last edited:
You don't have to pay for MondoRescue. Online backups of chosen parts of the filesystem and very flexible indeed.

Apt-get'ing the mondo package as we speak :D Thanks for the heads up :)

There are several articles (for different Linux distributions) on Howtoforge on how to convert an existing Linux system from single disk to software mirrored disks for booting with minimal disruption (maybe one reboot and no restores). Seem fairly striaght forward if you know, and understand, what you are doing.

I haven't tried them but you may want to have a look (but remember to back up any data/configuration files before you do anything Just in case it all goes the way of the pear).

edit: on Howtoforge do a search for mdadm and it'll return results for configuring RAID1 (mirroring) on various linux flavours with and without LVM.

Thanks for the tipoff - I should have thought to look there :o

Found one that looks like it'll do it:

http://www.howtoforge.org/how-to-se...ing-system-incl-grub-configuration-centos-5.3
 
Hmmm - just noticed this after doing a dmesg:

Code:
[76422.222609] ata7: hard resetting link
[76422.570063] ata7: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
[76422.610448] ata7.00: configured for UDMA/33
[76422.610469] ata7: EH complete
[76422.628041] sd 6:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[76422.631361] ata7.00: exception Emask 0x12 SAct 0x0 SErr 0x1000500 action 0x6
[76422.631367] ata7.00: BMDMA stat 0x5
[76422.631370] ata7: SError: { UnrecovData Proto TrStaTrns }
[76422.631377] ata7.00: cmd 25/00:00:3f:d4:54/00:04:0a:00:00/e0 tag 0 dma 524288 in
[76422.631378]          res 51/84:3f:00:00:00/84:d8:00:00:00/e0 Emask 0x12 (ATA bus error)
[76422.631382] ata7.00: status: { DRDY ERR }
[76422.631384] ata7.00: error: { ICRC ABRT }
[76422.631402] ata7: hard resetting link
[76422.980060] ata7: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
[76423.020447] ata7.00: configured for UDMA/33
[76423.020468] ata7: EH complete
[76423.042946] ata7.00: exception Emask 0x12 SAct 0x0 SErr 0x1000500 action 0x6
[76423.042951] ata7.00: BMDMA stat 0x5
[76423.042954] ata7: SError: { UnrecovData Proto TrStaTrns }
[76423.042962] ata7.00: cmd 25/00:00:3f:d8:54/00:04:0a:00:00/e0 tag 0 dma 524288 in
[76423.042964]          res 51/84:3f:00:00:00/84:dc:00:00:00/e0 Emask 0x12 (ATA bus error)
[76423.042967] ata7.00: status: { DRDY ERR }
[76423.042970] ata7.00: error: { ICRC ABRT }
[76423.042989] ata7: hard resetting link

Repeated ad nauseum. Doesn't look to good =/ The sync is now at 8%. Anyone ever seen anything like the above before?
 
Hmmm, after some quick digging it looks like it might be something to do with the PCI SATA controller I'm using (a no make VIA chipset one). Anyone got any ideas what could be the problem? :confused:

More checking...

Looks like it could be a problem with sdb, even though it's brand new :(

Code:
Error 2414 occurred at disk power-on lifetime: 0 hours (0 days + 0 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  84 51 3f 00 b8 00 e0  Error: ICRC, ABRT 63 sectors at LBA = 0x0000b800 = 47104

Anyone any ideas other than RMA'ing it?
 
Last edited:
I had something very similar - I got three 1.5TB F2s and had issues with one of them. You can run badsectors to be sure before the rma, but that does take a long time (make sure you use verbose mode, or you get no progress indicator!!).
 
Back
Top Bottom