I want to mirror an existing 40GB data only drive using software Raid1 on my new CentOS 4 server. The existing drive is connected to a Promise Ultra 100 TX2 controller (non-raid). I have read about mdadm and understand how to create the Raid1 on /dev/mdxx devices. However I would like to know if the existing data on the orignal 40GB drive in the system will be destroyed when I create the raid with mdadm. Also do the 2 drives after being setup with mdadm have to be reformated? Both the 40GB drives are now formated with ext3. If not, will the added 40GB drive assigned to the Raid1 atomaticly sync to the original 40GB drive. If so, what do I need to do to assure this will happend automaticly? Your comments are appreciated, as this is my first time to setup a software Raid1. Lee __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Lee Parmeter wrote:> I want to mirror an existing 40GB data only drive using > software Raid1 on my new CentOS 4 server. The existing > drive is connected to a Promise Ultra 100 TX2 controller > (non-raid). I have read about mdadm and understand how to > create the Raid1 on /dev/mdxx devices. However I would like > to know if the existing data on the orignal 40GB drive in > the system will be destroyed when I create the raid with > mdadm. Also do the 2 drives after being setup with mdadm > have to be reformated? Both the 40GB drives are now > formated with ext3. If not, will the added 40GB drive > assigned to the Raid1 atomaticly sync to the original 40GB > drive. If so, what do I need to do to assure this will > happend automaticly? Your comments are appreciated, as this > is my first time to setup a software Raid1.You'd need to resize file systems after you import partitions into MD. An e2fsck/resize2fs would take care of that. Do an "fsck -f /dev/md0" (for example). It will complain that information in superblock is wrong (partition size fsck sees is smaller than what it found in superblock). Just answer "no" to abort question. After you did fsck, you need to do "resize2fs /dev/md0". Repeat for all md devices you created. For above, the file systems should be either unmounted, or mounted read only. The best thing to do is to boot from CD into rescue mode, and do all job from it. The reason is that MD uses couple of last blocks for metadata information, and that space is no longer usable for file system data. So your /dev/md* metadisks will be slightly smaller than partitions you created them on. When you are creating mirrors, make sure you list devices in right order. Data is always copied from first disk you specify to second disk. If you get them the wrong way around, you loose data. There are some rather good HOWTOs on this question (with much longer, detailed and better descriptions of migration process). Use the Google Luke. -- Aleksandar Milivojevic <amilivojevic at pbl.ca> Pollard Banknote Limited Systems Administrator 1499 Buffalo Place Tel: (204) 474-2323 ext 276 Winnipeg, MB R3T 1L7
--- Les Mikesell <lesmikesell at gmail.com> wrote:> On Wed, 2005-04-27 at 10:44, Aleksandar Milivojevic > wrote: > > > You'd need to resize file systems after you import > partitions into MD. > > An e2fsck/resize2fs would take care of that. Do an > "fsck -f /dev/md0" > > (for example). It will complain that information in > superblock is wrong > > (partition size fsck sees is smaller than what it found > in superblock). > > Just answer "no" to abort question. After you did > fsck, you need to > > do "resize2fs /dev/md0". Repeat for all md devices you > created. > > > > For above, the file systems should be either unmounted, > or mounted read > > only. The best thing to do is to boot from CD into > rescue mode, and do > > all job from it. > > > > The reason is that MD uses couple of last blocks for > metadata > > information, and that space is no longer usable for > file system data. > > So your /dev/md* metadisks will be slightly smaller > than partitions you > > created them on. > > What happens if existing files are on these blocks before > you > convert? > > > When you are creating mirrors, make sure you list > devices in right > > order. Data is always copied from first disk you > specify to second > > disk. If you get them the wrong way around, you loose > data. > > Another approach that might be safer is to create a > 'broken' mirror > first by specifying the 2nd device as 'missing'. Then > you can build > a filesystem on the md device and mount it somewhere and > copy the > files over from the existing partition. Then unmount the > old partition, > remount the raid device in its place (adjusting > /etc/fstab to match) > and use mdadm to add the old partition into the new raid, > which will > hot-sync it to match the new setup.Good idea, I will give this a try this evening. Thanks for your input concerning this issue.> > There are some rather good HOWTOs on this question > (with much longer, > > detailed and better descriptions of migration process). > Use the Google > > Luke. > > I looked for this and found lots of info on building > RAIDs but none > about preserving an existing filesystem while converting > to a mirror. > Can you provide a link or a good search term to pick that > up? Also, > I have noticed that after syncing the mirrored drives, > you can split > them and mount a single drive from it into another > machine without > making an md device first. (For example, if one part is > on a > USB/firewire drive, you can plug it into a different > machine and mount > the /dev/sda? partition it becomes.) However, I don't > know if this is > harmful or not. Does anyone know if, after running a > while in this mode > it will still work correctly if detected as an md? device > (with or > without resyncing to a partner)? > > -- > Les Mikesell > les at futuresource.com > > > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos >-- Lee Parmeter Emperor, linXos - The Flying Penguin http://www.linXos.com Linux Registered User #337161 'It's free. It works. Duh.'" - Eric Harrison The United States is NOT a democracy, it was founded as a Republic! God is not a republican or a democrat nor is His government a democracy! - Lee Parmeter __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
--- Les Mikesell <lesmikesell at gmail.com> wrote:> On Fri, 2005-04-29 at 12:20, Lee Parmeter wrote: > > > I did not find any information on the web concerning > the > > requirement of the mdadm.conf file and the relationship > to > > the auto start of the raid. I had to work a bit in the > dark > > to get it to work as I thought it should. > > I think if you set the partition type to FD with fdisk, > the > system is supposed to figure everything out automatically > at boot time. I have, however, had some trouble when > moving > pairs of disks built on one machine to a different one > and > would generally prefer to control it with a definition in > a > file if possible instead of having the system guess. If > you > have both, I'm not sure which wins. If you find > documentation > on the detection order or how to move devices, please > post > a link.I did not mark the parition type to FD so apparently the kernel or mdadm just executes and looks in the ndadm.conf file. When trying to start the raid manually, I found that the raid would fail unless I passed the partion assignments on the commandline to mdadm. However, when the DEVICE and ARRAY are defined in the mdadm.conf, the partion info was not required, just the device name, "/dev/md0". So, I think the raid failed to start at boot due to not enough information being available for it to startup, thus the mdadm.conf file being required. Anyway, that's what my experince told me!> -- > Les Mikesell > les at futuresource.com > > > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos >-- Lee Parmeter Emperor, linXos - The Flying Penguin http://www.linXos.com Linux Registered User #337161 'It's free. It works. Duh.'" - Eric Harrison The United States is NOT a democracy, it was founded as a Republic! God is not a republican or a democrat nor is His government a democracy! - Lee Parmeter __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
--- Aleksandar Milivojevic <amilivojevic at pbl.ca> wrote:> Lee Parmeter wrote: > > I did not mark the parition type to FD so apparently > the > > kernel or mdadm just executes and looks in the > ndadm.conf > > file. > > > > When trying to start the raid manually, I found that > the > > raid would fail unless I passed the partion assignments > on > > the commandline to mdadm. However, when the DEVICE and > > ARRAY are defined in the mdadm.conf, the partion info > was > > not required, just the device name, "/dev/md0". So, I > think > > the raid failed to start at boot due to not enough > > information being available for it to startup, thus the > > mdadm.conf file being required. > > > > Anyway, that's what my experince told me! > > OK, but have you attempted to mark the partition as type > fd (linux raid > autodetect)?No. Since /dev/md0 is loading OK in fstab, I have not messed with it further. My guess is, if you did, the kernel would> bring it up as > soon as raid* device drivers are loaded. The information > in superblocks > at the end of each partition should be more than enough.I will be creating another raid1 in the next week or two and will try you suggestion then.> -- > Aleksandar Milivojevic <amilivojevic at pbl.ca> Pollard > Banknote Limited > Systems Administrator 1499 > Buffalo Place > Tel: (204) 474-2323 ext 276 Winnipeg, > MB R3T 1L7 > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos >-- Lee Parmeter Emperor, linXos - The Flying Penguin http://www.linXos.com Linux Registered User #337161 'It's free. It works. Duh.'" - Eric Harrison The United States is NOT a democracy, it was founded as a Republic! God is not a republican or a democrat nor is His government a democracy! - Lee Parmeter __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com