Categories
Technology

Breaking a Linux Software RAID 1 for Import using VMware Converter

I rarely post super-geeky stuff on here, but since I couldn’t find any good instructions to do this important and critical activity on the Internet, and my co-workers had to piece together a set of steps that worked for us, I wanted to share what we learned, hoping to save the next person all of the work.

Linux has supported the idea of software RAID, particularly RAID 1 (or disk mirroring) for a long time. Disk mirroring is a great way to gain some insurance against a single disk failure bringing down a critical system, as everything rewritten to one disk is also written to the other disk. Many servers use hardware RAID, which mirrors the disks at a lower level than the operating system can see, making it easier to gain this redundancy. However, hardware RAID has always been more expensive than software RAID, and so there are quite a few servers out there using software RAID to protect their data.

This week, we had one of our last physical (non-virtual) server (RedHat Linux 4 AS) that needed to be virtualized. Due to the size of the data stored on that system and how it uses an external disk array, it was important that we virtualize it in place, using excellent VMware’s Converter Standalone to import the running machine, so that there was no downtime while importing the data. However, the Converter Standalone will not import Linux systems using software RAID, due to problems accessing the underlying data structures of the disk through the metadevices presented by the software RAID. (You know you are having this problem when the Converter complains about not being able to access the /boot partition.) The best solution was to break the mirrored software RAID and boot the system off of one disk, so that all of the necessary partitions could be imported and the system could be virtualized.

Unfortunately, as important and seemingly common as breaking a mirrored software RAID is in Linux, I couldn’t find any good, comprehensive, working instructions on how to do it, and breaking a software RAID is a tricky business. It is very, very easy to end up with a non-booting system and no easy way to repair it. So, to help out the next person that runs into it, I’m posting the steps that we did to break the mirrored software RAID and set the system to boot off of only one disk, so that VMware’s Converter Standalone would work on it.

First, get an idea of what you are dealing with. Logged in as root, inspect the system:

[root@cr2 cr]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/md2 456G 45G 389G 11% /
/dev/md0 487M 35M 427M 8% /boot
none 4.0G 0 4.0G 0% /dev/shm
/dev/sda1 2.0T 560G 1.4T 30% /archive
[root@cr2 cr]# more /etc/fstab
# This file is edited by fstab-sync - see 'man fstab-sync' for details
/dev/md2 / ext3 defaults 1 1
/dev/md0 /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /dev/shm tmpfs defaults 0 0
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
/dev/md1 swap swap defaults 0 0
/dev/sda1 /archive ext3 defaults 1 0
/dev/hda /media/cdrecorder auto pamconsole,exec,noauto,managed 0 0
[root@cr2 cr]# more /etc/mtab
/dev/md2 / ext3 rw 0 0
none /proc proc rw 0 0
none /sys sysfs rw 0 0
none /dev/pts devpts rw,gid=5,mode=620 0 0
usbfs /proc/bus/usb usbfs rw 0 0
/dev/md0 /boot ext3 rw 0 0
none /dev/shm tmpfs rw 0 0
/dev/sda1 /archive ext3 rw 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw 0 0

In this case, we have 3 metadevices (md0 as /boot, md1 as swap, and md2 as root /). You can get further details about your RAID configuration using the mdadm tool, as well as mdstat:

[root@cr2 cr]# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sdc2[1] sdb2[0]
 2200832 blocks [2/2] [UU]
md2 : active raid1 sdc3[1] sdb3[0]
 485668928 blocks [2/2] [UU]
md0 : active raid1 sdc1[1] sdb1[0]
 513984 blocks [2/2] [UU]
unused devices: <none>

You can also run these commands:

cat /proc/mdstat
mdadm --detail /dev/md2     (to inquire about the disk members of the /dev/md2 metadevice)

When you are finally ready to do this, make sure you have a full backup of your system, and then stop all running services, especially any that would possibly write data, such as databases.

Next, we need to use mdadm to set one of the disks (we chose /dev/sdc) to be set as “failed” and removed from the RAID array. To do this, we ran these commands:

mdadm --fail /dev/md2 /dev/sdc3
mdadm --remove /dev/md2 /dev/sdc3
mdadm --zero-superblock /dev/sdc3
mdadm --fail /dev/md1 /dev/sdc2
mdadm --remove /dev/md1 /dev/sdc2
mdadm --zero-superblock /dev/sdc2
mdadm --fail /dev/md0 /dev/sdc1
mdadm --remove /dev/md0 /dev/sdc1
mdadm --zero-superblock /dev/sdc1

At this point, the software RAID still exists, but the /dev/sdc disk has been removed from it. All of the data on /dev/sdc is set as standalone.

Next, we need to modify the partition table on /dev/sdc to change it from software RAID to standard Linux partitions.

fdisk /dev/sdc

Select “p” to change the partition table, then “t” to change the type of partition. Select the partition number from the list. We changed /boot and / to be standard ext3 partitions, which is code 83, and the swap partition was changed to 82. Be sure to select “w” at the end to write all of these changes to the /dev/sdc disk when you are done.

Next, we need to mount the / and /boot partitions of /dev/sdc so that we can change files on that filesystem, so that a reboot on /dev/sdc is possible.

mkdir /mntboot
mkdir /mntroot
mount /dev/sdc3 /mntroot/
mount /dev/sdc1 /mntboot/
vi /mntroot/etc/fstab

Change fstab to so that /dev/sdc partitions will be automounted upon boot, rather than the /dev/md devices. Also, move the mdadm.conf file on /dev/sdc out of the way, so that it cannot be used when booting /dev/sdc.

mv /mntroot/etc/mdadm.conf /mntroot/etc/mdadm.bak

Now, we need to modify grub so that the bootloader will load Linux using /dev/sdc and not the /dev/md device. Notice that I will be doing this on the existing /dev/md running filesystem.

vi /etc/grub.conf

Replace the /dev/md2 (or whatever your root partition is) references with /dev/sdc3 (in our case). Save the file and close it.

Also change /mntroot/boot/grub/grub.conf with the same information.

Next, we need to run mkinitrd to use grub to update the bootloader, so that /dev/sdc will be used on boot. To do this look at the kernel you are booting from in /etc/grub.conf. For us, the mdkinitrd command looked like this:

mkinitrd -f -v /boot/initrd-2.6.9-103.ELsmp.img 2.6.9-103.ELsmp

After you run that, you will the bootloader being reconfigured. When it is complete, you are ready to reboot the server. You should boot up on /dev/sdc and be ready to do the VMware Converter Standalone importer.

Categories
General Travel

Lakehouse Moments

image

image

image

image

image

Thanks to the Parkers for another wonderful lakehouse weekend! Cool July weather, good friends, and a beautiful sunset. What more could you want?

Categories
General

Katherine and Sadie

Katherine and Sadie, the 9.5 week old Border Collie.
image

image

image

Categories
General

One Second Everyday – April to June, 2014

This video covers events from a trip to St. Louis, Katherine’s Engaged Scholarship Award, Hayley’s birthday party, our trip to Southern France, Sicily, and Barcelona, and the arrival of our new puppy, Sadie.

Categories
General

Introducing Sadie (the Lady)

image

image

image

We got a new family member yesterday: Sadie (the Lady)! She is a beautiful 7-week old border collie.

Categories
Travel

Beach to Bullring in Barcelona

image

Today, we started out at the Picasso Museum. In some ways, this has been a very Picasso-infused trip. From the 1890s as a boy through his death in 1973, he did his best work along the stretch of sea we’ve been experiencing the past few weeks. The Picasso Museum in Antibes explored his later work, especially pottery, while the Barcelona museum focuses on his earliest drawings, sketches, and paintings. Both are excellent, and I’m still not the biggest Picasso fan, I can definitely understand the genius behind some of the best art in the 20th Century.

Next, we headed down to the beach. I’m always going to be in favor of a beach that you can visit via subway. The Barcelona beach is exceptionally nice, a great place to stroll and take in the sea air.

The Barcelona Metro is the perfect teleportation machine to get around this diverse and busy city. Next up, we visited an old bullring that the Barcelonenos modified to be a surreal 5-story mall.

What a fun and unexpected city!

image

image

Categories
Travel

Gothic Barcelona

image

We started our first day in Barcelona at the must-see site for most of the 17 million visitors that visit the city every year, and as all of the other museums are closed on Monday, about half of that number descended on the Gaudi-designed masterpiece Sagrada Familia with us.

The church really is amazing and worth the admission price and crowds, but I’m not sure how “sacred” the place can feel with the crush of people all around. It has the feeling of a circus combined with an international photoshoot. I can’t imagine what it would be like in the real high-season, July and August.

We also explored Barcelona’s old gothic city, the marina, and Parc de Montjuic, with some tasty tapas on way back to the apartment. A fun day…

image

image

image

image

image

image

Categories
Travel

Barcelona!

image

Katherine and I just made it into the apartment in Barcelona, and this is the view from our window. This is a famous market but is under renovation this year.

Many thanks to Laura, Antonio, Guisey, Toy, Chicho, and Antonella for hosting us and putting up with all of our questions (in English, no less!) over the past week! It was sad to leave Sicily, but we know we will return someday.

Categories
Travel

Island Hopping

image

Katherine, Laura, Antonio, Chicho, Toy, and I rented a boat today for a look around some of the other Aolian Islands. We visited Lipari and Volcano, as well as stay off of the coast of Salina, where Chicho and Toy caught our dinner. What a wonderful day!

image

image

Categories
Travel

Panarea

image

For a change of pace, Katherine, Antonio, and I took the ferry over to Panarea, a nearby island to Salina. We walked around, got some sun, ate a granita, hung out a a beach, and viewed an archeological site. Panarea is a beautiful place, much smaller than Salina.

image

image

image

Categories
Travel

Wonderful Salina

image

We are having a great time catching up with friends in Salina. A lot of relaxing going on here.

image

Laura organized a tour of a local winery, which was very interesting. They also produce capers, using this machine.

image

Otherwise, it has been a lot of sun, sand, cooking, eating, drinking, and just chilling. Just what we needed after France.

image

Categories
Travel

Salina!

image

Made it to Salina! First, a crazy Ryanair flight from Marseille to Catania (Sicily), then a wonderful lunch and car ride to Milazzo (thank you, Guisy!), and then a ferry ride to Salina, where we were greeted by Laura, Antonio, and the gang. Perfect!

image

Categories
Travel

French Riviera

image

We drove the rest of the Riviera coastal road to St. Tropez, which included much of the beautiful scenery you might imagine. Traffic was not as bad as I imagined.

All in all, southern France is a wonderland of experiences, from the quiet and meaningful, to the crowded and surreal, from the ancient and overloaded, to the stunning yet sublime. Prepare to be amazed, if you make it here. It is easy to see why this is the most visited country on the most visited continent.

image

Categories
Travel

Antibes

image

Our stop in Antibes included finding a beautiful beach, studying dozens of Picasso drawings and paintings close up at the Picasso Museum, walking the sea ramparts, wandering through a packed Provencal market, roaming more medieval streets, looking at the yachts of millionaires and billionaires, and getting as close as I’ll ever get to a St. Tropez tan.

Needless to say, we had a great time in Antibes and would recommend it over Nice as a base to see the Riviera hotspots. Nice and Monaco are only minutes away by train, after all.

image

image

image

image

image

Categories
Travel

Nice is, Well, Nice

image

On the way to our hotel in Antebes, we stopped for a few hours in Nice. I was pleasantly surprised; after hearing so much about the terrible French Riviera traffic, getting from Monaco to Nice was easier than expected. We would have never made it without Giselle, our name for our rented Skoda GPS.

We walked through the old town and the Saturday afternoon market. The rocky beach was a highlight, as was a beautiful, long, grassy park that runs through the center of the city. Nice is a little grittier than Monaco, but with families out enjoying some brief afternoon sunshine, it is also a little more down-to-earth, too.

image

image

image

image

image

Categories
Travel

Monaco

image

You know you are in a place full of stinking rich people when your photo of the Lamborghini and Ferrari is almost photo-bombed by a Bugatti passing in front.

Monaco is surreal, clean, packed with people and cars, vertical, over-signed, pretty, and, unfortunately for us today, wet, because it rained almost all of the time we were outside. (No hailstones, however, thankfully.)

image

image

Categories
Travel

Apt and L’Isle-Sur-la-Sorgue

image

We could easily spend another week here. Free of big cities for day or so, you start to relax in a deeper way, thanks to the winding roads of the Vaucluse region and the postcard-perfect scenes waiting for you at the next corner.

When we felt the need to people-watch, we ducked in the towns of Apt and L’Isle-Sur-la-Sorgue for an ice cream or pastis.

image

image

Categories
Travel

Rural Provence

image

One of the advantages of staying far out of town in Provence is that you can just run into relatively obscure things that you read about in books about the region. Not 100 feet from our doorstep on a short hike, we came across this borie, hidden in the trees. Bories are limestone slab buildings made without mortar, including a stone roof, and have been made in the region for 4,000 years or so. Today, they are sometimes used to store tools or for shelter during a storm.

Speaking of storms, we experienced four separate hailstorms in a one hour period. All of the cars in the area scrambled to get under whatever kind of protection they could find. The odd thing for me is that they lasted so long. I’m used to a few minutes of hail, but one of them went on for more than 20 minutes. The ground was an inch deep in hail around us, for a while, before it melted.

image

Categories
Travel

Roussillon

image

In the heart of the Luberon, we scampered up the tiny roads to the hilltop, red ochre village of Roussillon.

Thankfully, we arrived after the tourists had vanished back to their buses, so our dinner had a more natural, French feel to it. Walking back to the car through medieval streets, we emerged to a stunning sight of the cliffs fully exposed to the sunset.

image

image

Categories
Travel

Cotes du Rhone

image

Well, the roast chicken didn’t make it to the Cotes du Rhone region. I got hungry,  and we devoured it during a rest stop along the road on the way to Chateauneuf-du-Pape. Delicious!

Unable to find the winery we wanted to visit there, we moved on to Vision La Romaine, at the top of a driving tour that would take us through the best of the Cotes du Rhone region and into the heart of the Luberon. Somewhere on the backroads between Malaucene and Le Barroux, we came across some of the most beautiful scenery of the trip thus far: vast fields of wildflowers in bloom, sweeping down hillsides and crossing vast valleys between vineyards to emerge on the other side and give way to craggy, pointed ridges.

image

image

image

image

image