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
Tiras25Asked:
Who is Participating?
 
CompProbSolvCommented:
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.
1
 
arnoldCommented:
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.

https://wiki.archlinux.org/index.php/Software_RAID_and_LVM
https://wiki.archlinux.org/index.php/Convert_a_single_drive_system_to_RAID
https://raid.wiki.kernel.org/index.php/Converting_an_existing_system
https://www.howtoforge.com/set-up-raid1-on-a-running-lvm-system-debian-etch

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.
0
 
ibidapo ibrahimSystems EngineerCommented:
You could also clone the single drive to the raid volume.
0
 
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.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.