upgrade server to raid1 from a single drive

is there a way to upgrade to raid1 from a single drive? without wiping and reinstalling os.
adding a drive basically. currently server running only one single drive.
LVL 17
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You could certainly do it with a backup and restore rather than reinstallation.  Otherwise, I don't think you can with hardware RAID because of the small area reserved for metadata.  I don't know Linux well at all so I couldn't speak to whether or not there's a software RAID solution for your question.
In any case, I'd be sure to have a tested, working copy of the system before attempting this.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Much depends on what RAID controller and hardware you are using.

one option in linux is to transition to a Software RAID.

This deals with using the second drive and partitioning the new drive in which ever way you need it.
100-1000 MB /dev/sdb1 this is for the /boot this primary partition has to be of type fd linux raid auto
you then use this partition to create a single device RAID1 (md0) with the file system of EXTx. To boot in prior linux versions it has to be a raw partition. potentially the same as your existing /boot.
once you create the filesystem, you can dump|restore or find|cpio -pdvmu copy the data from the existing /boot partition to this new single device raided volume.
You would do the same with the rest for / if you only have two partitions. or break them up into several. (make sure to use some space for swap)
in these partitions you would not use raw partitions, but use the LVM 8e
ie. raid mdx, filetype linux LVM,
you would then use pvcreate /dev/mdx vgcreate VolumeGroup /dev/mdx ....

dump|recover or find | cpio can copy the data.

once you copy the things accross, you would need to test, i.e. the grub.conf on the single raid needs to point to itself and not hd(1)
or it will give you a false sense that it worked, but once you make changes to the /dev/sda1 the system will no longer boot..

note you may have to use dd to create the BOOT sector on each drive that is part of the RAID boot volume.

There are several guides how to transition an existing system to a RAID setup....

depending on which linux, and which boot loader it uses
grub install-boot... etc.

if you could take the system offline when doing this, i.e. use knopix/or any liveCD to make the new drive as a single member RAID. Once your test are complete and it is working, where the new single member RAID is the /dev/sda drive.
you can attach the prior drive. format/partition it.
and use mdadm to add /dev/sdb1 as a member of the /dev/md0 as an example, the system will handle the copying of the data from the existing member into the new.
When using command line mdadm to create use a - or missing for the missing member.


If the system has a hardware RAID controller, some include a way to create a RAIDed volume without initialization but with a specified drive as the reference member.

in this type of scenario, you have to consult the hardware .....

i.e. disk0 is the current drive.
in the controller interface, usually through the boot  and entering controller, you create a volume with disk0 as the reference in a RAID1 setup with disk1 as the additional member. UNDER NO CIRCUMSTANCES answer yes IF prompted to INITIALIZE the RAID volume, when the option is available, I think it is create RAID from existing drive or some similar terminology.
INITIALIZE wipes the data when the RAID volume is created.....

You might not want to start from the /boot, you could start with the rest of the partitions, while adjusting the /etc/fstab to mount the same partitions but now from the other /dev/mdx or /dev/mapper/volumegroup-logicalVolume

If your existing setup uses LVM, make sure the new one does not use the same VolumeGroup name.
ibidapo ibrahimSystems EngineerCommented:
You could also clone the single drive to the raid volume.
PowerEdgeTechIT ConsultantCommented:
You didn't say which server or controller you have, and it ALL depends on the controller. On MOST controllers, you CAN convert from a 1-disk RAID 0 to a 2-disk RAID 1, but only if you currently have a RAID 0. If you have a controller that supports non-RAID and you currently have a non-RAID volume, then the answer is no, at least not from the hardware level. You would either need to do a restore from backup to a new volume or implement some sort of software RAID.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.