View previous topic :: View next topic |
Author |
Message |
srunni Guru


Joined: 26 Dec 2007 Posts: 365
|
Posted: Tue Aug 05, 2008 5:31 pm Post subject: Migrating to RAID 1 [SOLVED] |
|
|
Hi,
I've got a system running on one 500 GB hard drive, and I'd like to migrate it to two 500 GB hard drives, running in RAID 1. I found this guide, but it has warnings about checking other information before attempting to migrate to RAID 1. Is there anything else that I need to read before I begin the migration? I have all my data backed up, but I'd like this to go smoothly if possible.
Thanks!
Last edited by srunni on Wed Aug 06, 2008 4:41 pm; edited 1 time in total |
|
Back to top |
|
 |
NeddySeagoon Administrator


Joined: 05 Jul 2003 Posts: 55015 Location: 56N 3W
|
Posted: Tue Aug 05, 2008 5:59 pm Post subject: |
|
|
srunni,
That guide looks mostly harmless. The idea is this.
Using the new drive, you create your raid1 install in degraded mode.
Its very important you know which drive is which as you must only partition and make the raid sets on partitions belonging to the new drive. You tell mdadm that the raid1 partitions that will be on the existing drive are missing.
There is no need to make partitions on the new drive the same size as the old drive as you will use cp-a, rsync or whatever to copy files over.
Eventually, you have your old single drive install still running and a tested bootable raid1 install in degraded mode on the new drive.
The correct grub entries allow you to boot either. This is an important test. The next step wipes your single drive install.
Boot into the raid1 install, partition the old drive to match the new drive (with the raid install on) and add its partition to the working degraded raid to bring it up to full strenght. This is what you do to replace a failed drive too, so you get to practice at no extra charge.
If the degraded raid and single drive install get out of step while you are testing, because you allowed the single drive install to be used, for example, you need to fix the the differences before you migrate for real or the changes will be lost. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
 |
srunni Guru


Joined: 26 Dec 2007 Posts: 365
|
Posted: Tue Aug 05, 2008 6:24 pm Post subject: |
|
|
NeddySeagoon wrote: | There is no need to make partitions on the new drive the same size as the old drive as you will use cp-a, rsync or whatever to copy files over. | Isn't that what Code: | sfdisk -d /dev/sda | sfdisk /dev/sdb | does though?
NeddySeagoon wrote: | If the degraded raid and single drive install get out of step while you are testing, because you allowed the single drive install to be used, for example, you need to fix the the differences before you migrate for real or the changes will be lost. | This won't happen if I just boot up to test the degraded RAID system without modifying any files, right? |
|
Back to top |
|
 |
wilf Tux's lil' helper


Joined: 12 Feb 2006 Posts: 131 Location: West Sussex, UK
|
Posted: Tue Aug 05, 2008 6:56 pm Post subject: |
|
|
Hello srunni,
I like NeddiSeagoons comments - I run all my machines off software mirrors, although I have never converted as you are doing. I'd recommend you also have a look at HOWTO Install on Software RAIDwhich has an excellent section on Installing Grub onto both MBRs. This only becomes useful when your one and only boot drive fails
You hopefully have partitioned your new drive with partitions as you wanted them of type fd, formatted the partitions, mounted them and copied over the data from your old drive, as per the HOWTO. Hence Code: | sfdisk -d /dev/sda | sfdisk /dev/sdb | is copying the new structure to your old drive - and destroying whatever was there in the first place at the same time. So make sure you have got it right before doing this.
Best of luck, Paul. |
|
Back to top |
|
 |
NeddySeagoon Administrator


Joined: 05 Jul 2003 Posts: 55015 Location: 56N 3W
|
Posted: Tue Aug 05, 2008 7:24 pm Post subject: |
|
|
srunni,
I didn't check the drive letters to know exactly what the Code: | sfdisk -d /dev/sda | sfdisk /dev/sdb | does. It does copy the the partition table between drives though.
My point was that if you need to resize partitions during the single drive to raid1 migration, you may do so, as you will copy the files the partitions contain, not make partition images (underlying file system, empty space and so on)
Before you add the old drive to the raid set, it must be partitioned in the same way as the existing member of the raid set. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
 |
srunni Guru


Joined: 26 Dec 2007 Posts: 365
|
Posted: Tue Aug 05, 2008 7:24 pm Post subject: |
|
|
wilf wrote: | I'd recommend you also have a look at HOWTO Install on Software RAIDwhich has an excellent section on Installing Grub onto both MBRs. This only becomes useful when your one and only boot drive fails  | Yeah, I saw a link to that on the page on migration. It says you can do that after the initial setup. I'll have to look into it after I've got RAID 1 running.
wilf wrote: | You hopefully have partitioned your new drive with partitions as you wanted them of type fd, formatted the partitions, mounted them and copied over the data from your old drive, as per the HOWTO. Hence Code: | sfdisk -d /dev/sda | sfdisk /dev/sdb | is copying the new structure to your old drive - and destroying whatever was there in the first place at the same time. So make sure you have got it right before doing this. |
Are you sure about that? There is a step later on in the process called "Copy the partition map from the new drive to the old drive", and it says to do this:
Code: | sfdisk -d /dev/sdb | sfdisk /dev/sda |
Isn't that the step where the RAID setup is copied back?
NeddySeagoon wrote: | My point was that if you need to resize partitions during the single drive to raid1 migration, you may do so, as you will copy the files the partitions contain, not make partition images (underlying file system, empty space and so on) | I actually did need to resize some partitions, but I did that when I installed Gentoo a few weeks ago. I decided to wait a while before attempting the RAID migration, so all I have to do now is convert my single hard drive setup to a RAID 1 setup. |
|
Back to top |
|
 |
srunni Guru


Joined: 26 Dec 2007 Posts: 365
|
Posted: Tue Aug 05, 2008 9:02 pm Post subject: |
|
|
OK, I've started the process and I have some questions.
There are two main differences between my setup and the setup in the HOWTO.
1. I have a partition /dev/sdc, which has the existing data. I'm trying to copy it over to /dev/sdb, which is the new hard drive.
2. I have 4 partitions, instead of just one.
These are my questions:
1. Should I have /dev/md0 as the first RAID device even though the physical partition devices start at 1? I'm specifically referring to the command Code: | mdadm -C /dev/md0 -l 1 -n 2 missing /dev/sdb1 |
2. I need to complete this section for every partition I have, correct?
3. I can use the partition type "Linux raid autodetect" for all partitions except extended. That includes swap, correct?
4. In the command Code: | echo "ARRAY /dev/md0 UUID=deadbeef:deadbeef:deadbeef:deadbeef" >> /etc/mdadm.conf | is 'ARRAY' supposed to be literally typed in?
Sorry if these questions seem redundant; I just don't want to make any mistakes ;/
Edit: Since the power might go out when a big storm gets here in an hour or so, I decided to go ahead with the process, and I'm getting this error when I rsync the root directory: Code: | rsync: writefd_unbuffered failed to write 4092 bytes [sender]: Broken pipe (32)
rsync: write failed on "/mnt/raid-md2/usr/portage/distfiles/pth-2.0.7.tar.gz": No space left on device (28)
rsync error: error in file IO (code 11) at receiver.c(298) [receiver=3.0.2]
rsync: connection unexpectedly closed (934748 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(635) [sender=3.0.2] |
Any ideas?
According to df, the partitions are exactly the same size. |
|
Back to top |
|
 |
NeddySeagoon Administrator


Joined: 05 Jul 2003 Posts: 55015 Location: 56N 3W
|
Posted: Wed Aug 06, 2008 8:41 am Post subject: |
|
|
srunni,
In answer to your first 3 questions - yes.
Partition type 0xfd tells the kernel that the partition is part of a raid set, so it can be auto assembled during boot.
In the echo command, the syntax is correct - you need the ARRAY keyword but you need your own UUIDs, not the recurring deadbeef. (Thats a valid hex number by the way) _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
 |
srunni Guru


Joined: 26 Dec 2007 Posts: 365
|
Posted: Wed Aug 06, 2008 4:40 pm Post subject: |
|
|
Yeah, I made sure I changed 'deadbeef'. Everything seems to be working now. Thanks for all your help!! |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|