Archive for April, 2009
Create a RAID 1 Array with an Existing Drive
Posted by: Trent Gardner in Linux on April 8th, 2009
So, last month the IT department at DIRC was made redundant due to funding issues (The joys of working for the not-for-profit sector), as a result myself and colleague David were out of a job. If you’re looking for a new media consultant, Dave’s your man.
Luckily, after a weeks vacation and procrastinating about updating my resume / beginning to find a new source of income to cover my rent, I was offered a new job at http://www.tobacco.net.au – Cheap Cigarettes made in Australia. The work’s completely different, so it’s a great new learning curve, and hopefully the addictive qualities of nicatine should keep me in a job!
I’ve got a new HP DL585 server that I’m using for development, and let me say, this thing is a beast. I set it up about 2 weeks ago with Fedora Core 10, but the problem was all our hard drives didn’t arrive with the server, and I needed to get it up and running. I needed to create a RAID 1 mirror of the 36GB 15k SAS system drive but only had 1 of the drives.
This morning, the second drive arrived and I had to figure out how to create a mirror of the existing drive, without having to reinstall the entire OS again or lose any data. Thanks to the power of the command line it made light work of a seemingly daunting problem.
First, create an image of your drive onto another temporary drive:
Mount a partition to store the backup image of the system drive, in this case I used /dev/cciss/c0d1p1
mkdir /media/backup
mount -t ext3 /dev/cciss/c0d1p1 /media/backup
Create an image of the drive you’re wanting to use for the RAID array (/dev/cciss/c0d0)
dd bs=4k if=/dev/cciss/c0d0 of=/media/backup/backup.img conv=noerror,sync
Secondly, install the new drive being used as the mirror and create the RAID 1 array using the controller.
Finally, reboot with the Fedora CD in the drive and enter recovery mode. Just skip past any menus that come up until you’re presented with a command prompt.
Now mount the partition with the backup image
mkdir /mnt/backup
mount -t ext3 /dev/cciss/c0d1p1 /mnt/backup
Restore the system drive
dd bs=4k if=/mnt/backup/backup.img of=/dev/cciss/c0d0
Once complete, take the Fedora CD out of the drive and reboot, and the system should be like you never touched it.
This new job has me doing 12 hour days when including travel to and from, so I’ve barely had time to myself. When I get a few days off, I’ll try and get a new update on Flickr Manager pushed out.