Convert RAID1 to single disk

Discussions about using Linux guests in VirtualBox.
Locked
KendyfortheState
Posts: 1
Joined: 21. Oct 2010, 22:24
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: WindowsXP, Windows 2008 Server, Windows 7, Red Hat, Ubuntu

Convert RAID1 to single disk

Post by KendyfortheState »

I have an 8-year-old server running Red Hat (I think version 7) that I have successfully cloned and run as a VirtualBox guest on an Ubuntu host. The only problem I have is that it was originally set up on a software RAID array, and now when it boots up in VirtualBox it complains that the array is degraded. I suppose as long as it runs ok it doesn't really matter, but I'd be interested to know if there is any way to convert the broken mirror back to a single disk. I've looked at all kinds of tutorials that explain how to convert a single-disk system to RAID, but can't find any that describe what I want to do.
dancho
Posts: 3
Joined: 7. Apr 2009, 04:47
Primary OS: Ubuntu 8.10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: windows xp

Re: Convert RAID1 to single disk

Post by dancho »

I think that you can get rid of the RAID like this. Boot from a LiveCD of some sort (say Ubuntu 10.04). Let's say the drive that the mirror lives on is /dev/sda. Then in a terminal:

sudo apt-get update
sudo apt-get install mdadm
sudo modprobe md_mod
sudo modprobe raid1
sudo modprobe raid10 # In case you have RAID10 instead of RAID1

mdadm --zero-superblock /dev/sda # Destroys the md superblock

# Let's say your root partition is /dev/sda1. If not, replace sda1 with whatever it is.

mount /dev/sda1 /mnt

# If you have separate /boot, /usr/, and /var, mount them at this point, e.g.:

mount /dev/sda5 /mnt/usr # and similarly for the others.

chroot /mnt
rm /etc/mdadm/mdadm.conf
mount -t proc none /proc
mount -t sysfs none /sys
mount -t devtmpfs none /dev

grub-mkconfig > /boot/grub/grub.cfg
grub-install --recheck /dev/sda

# Now, edit your /etc/fstab, and make sure that there are no references to /dev/md devices, i.e. that all entries are either /dev/sdaN or UUID=XXXXXXXXXXXXXXXX


Now, reboot, and make sure the system is trying to boot from the drive you were just working on (in this case /dev/sda).

If you ever change your mind, you can use my guide to re-convert your system to a mirrored drive setup:

http://www.blogger.com/adsense-overview ... 6694337445
areys1
Posts: 1
Joined: 26. Jun 2011, 07:20
Primary OS: Other
VBox Version: OSE Fedora
Guest OSses: Windows

Re: Convert RAID1 to single disk

Post by areys1 »

Has this been tested with any success?
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Convert RAID1 to single disk

Post by Sasquatch »

Should work. But I wonder what this has to do with VB. This situation can easily be done on a physical system, therefore I'm locking this one.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Locked