Blogs

Modifying a Linux software RAID mirror

While upgrading my desktop to Fedora Core 12, I also decided to modify a software RAID mirror that I had on the old system. In particular, I wanted to do two things, without losing data:

  1. Change the partition layout, the old disks had partitions for OS and swap allocated to them, which I no longer needed. I know, LVM would have been nice here, but alas, I wasn't using it on this older box.
  2. I also wanted to upgrade to EXT4, and I've heard that upgrade process can potentially corrupt the entire disk (ask Bryan Call if you don't believe me).

So, since I'm using mirroring, I figure the "right" approach would be to just break the mirror, and do a migration safely that way. And of course, that does work, and there's plenty of information in the man-pages how to do this, but I figure I'll write down the steps I took so I can remember it myself (and maybe someone else finds it useful too).

The first step is to break the mirror, in my case, the RAID mirror is /dev/md2 using /dev/sdb and /dev/sdd, and then mount the broken mirror half on the file system:

# mdadm --manage /dev/md2 --fail /dev/sdb1
# mdadm --manage /dev/md2 --remove /dev/sdb1
# mkdir /mnt/old-data
# mount /dev/sdb1 /mnt/old-data

We now have a complete "copy" of the mirrored data, make sure /mnt/old-data (or whatever you named it) looks good. The next step is to get rid of the old RAID device, and create a new one. In my case, I need to run fdisk as well, to change the partition layout, but I'm not going into details here exactly what I did, since it's very specific to my setup.

# mdadm --stop /dev/md2
# fdisk /dev/sdd
# mdadm --create /dev/md0 --level 1 --raid-devices=2 missing /dev/sdd1

Finally, we can now create the new filesystem, and migrate the old data over to it:

# mke2fs -t ext4 -j /dev/md0
# mkdir /mnt/new-data
# mount /dev/md0 /mnt/new-data
# rsync -av /mnt/old-data/ /mnt/new-data

The final step is to add back the "old-data" partition into the new mirror, but before doing so, make sure the "new-data" looks alright.

# umount /mnt/old-data
# fdisk /dev/sdb
# mdadm --add /dev/md0 /dev/sdb1

 

That's it! Easy, and very little risk for lost data or corruptions.

Hacking: 

Fedora Core 12 with nVidia drivers

I fried my old CPU while benchmarking Traffic Server (yeah, it's that fast ...), so I spent most of the day replacing the mother board / CPU. I figured I'd take the opportunity to ugprade to Fedora Core 12 as well. This mostly worked well, with one exception: FC12 now comes with the OpenSource nvidia drivers, and they are slow. Unfortunately, these drivers also conflicts with the nVidia closed source drivers (which I install from source), causing the installation to fail. But, with a few changes in my system configs, I worked around it.

First, change /etc/grub.conf and edit the "kernel" line, to include something like

rdblacklist=nouveau

Secondly, edit /etc/modprobe.d/blacklist.conf and add a line

blacklist nouveau

I'm not sure why both are necessary, maybe I did something wrong and you only need one or the other. Let me know if that is the case, I'm happy with what I got, and not wasting any more time on it.

Hacking: 

Fedora Core 12 and focus follow mouse

For some unknown reasons (I'm guessing someone trying to be overzealous about what the Fedora users should do), FC12 no longer includes the control panel to modify the "Window" behavior. This includes the must-have feature of "Select windows when the mouse moves over them". But wait, no need to switch to Ubuntu quite yet, there's a simple fix to restore this control panel:

$ sudo yum install control-center-extra

 

Hacking: 

Spamassassin and 2010

This morning, I noticed emails where going into the spam folder, for no good reason. It seems this rule triggers, from 72_active.cf:

header   FH_DATE_PAST_20XX    Date =~ /20[1-9][0-9]/ [if-unset: 2006]

Unless I complete missunderstand this, this means 2010 is considered a too futuristic date. Clearly not good. For now, I simply disabled this rule, by adding this to my local.cf file:

score FH_DATE_PAST_20XX 0

I probably should fix the regex above, but I have no idea what weight that should have now, so I figure it's better to just turn this rule off entirely.

Traffic Server week 1

Traffic Server has been out for a full week now. And it's been great, the interest is huge (almost overwhelming), and surprsingly, lots of people want to participate and contribute. So far, we've already achieved:

  • 64-bit port on Linux!
  • Port to Solaris (and OpenSolaris I believe)
  • Port to Ubuntu (it required a lot of changes due to glibc changes)
  • MacOSX port is partially done.

Not bad for week. If you are interested, check out our Wiki: http://cwiki.apache.org/confluence/display/TS/Traffic+Server.

Hacking: 

TS in the media

Traffic Server is finally here

Finally! We pushed the Traffic Server code to Apache SVN today! This is definitely a momentous occasion, this has been in the works for ages, and it took a lot of work and patience to happen. You wonder, why did we bother? Well, you are right, there's plenty of proxy server alternatives out there, Squid, Varnish, NginX and so on. But, we think we have a platform we can build something on that will be better than anything out there (that is free at least). Why? Well, we have

  • A scalable threaded + asynchronous state machine model. On a typical setup, 2 or 3 threads per core is enough to drive a large amount of traffic.
  • Feature-rich HTTP/1.0 and HTTP/1.1 support. We fair well in various tests like CoAdvisor.
  • Plugin architecture, making it easy (well, easier) to extend and customize your server.
  • Well documented.

I'm not saying it's perfect (far from it), but the hope is that Open Sourcing this will attract an active developer and user community around the software. So, you want more information? Well, besides visiting us on #traffic-server on irc.freenode.net, here's a bunch of links with some useful information:

http://incubator.apache.org/projects/trafficserver.html

http://cwiki.apache.org/confluence/display/TS/Index

http://svn.apache.org/repos/asf/incubator/trafficserver/

http://incubator.apache.org/trafficserver/docs/admin/

http://incubator.apache.org/trafficserver/docs/sdk/

Please join the mailing lists (see the Incubator page), talk to us on IRC, or just take a look at the code.

Update: Mark Nottingham (on our team now!) has a blog post with some interesting history and thoughts on TS.

Hacking: 

Haiku on VirtualBox and networking

I was playing around with Haiku (BeOS revival) under VirtualBox, and was trying to get networking going. To make a short story long, the "trick" is to pick a device to emulate other than the default in the VirtualBox setting. For me, the Intel Pro/1000T server works great, in the "bridged" mode at least. Cool!

Hacking: 

Happy Leif Erikson Day!

Today is the first Leif Erikson day, woot! Attached is the official proclamation, way to go mr President!

 

A PROCLAMATION

On this day in 1825, the ship Restauration landed in New York City after sailing for 3 months from Stavanger, Norway. The 52 passengers aboard represented the first organized emigration of Norwegians to America. These brave individuals set to the seas, following in the grand footsteps of the famous Scandinavian explorer Leif Erikson. Over a millennium ago, Leif Erikson -- son of Iceland and grandson of Norway -- arrived in North America and founded the settlement Vinland, located in modern-day Canada. Today, we celebrate his historic voyage and remember those who journeyed to America from far-away lands.

Our Nation's founding history is marked by millions of individuals who faced great hardship and difficulty as they pursued a brighter future abroad. As explorers, they did not know what they would find, but they were determined not to turn back, in order to learn what lay beyond the setting sun. This same spirit lived within Leif Erikson, and it has inspired countless others who venture from their homes in search of opportunity, uncertain of the possibilities and challenges that await them.

Today, our Nation continues to welcome those descendents of Leif Erickson to our shores. Nordic Americans have contributed immeasurably to the success of America. Their cultural accomplishments have enriched the diversity of our country. And their pioneering spirit continues to embody our Nation's unbounded enthusiasm for discovery and learning.

To honor Leif Erikson and celebrate our Nordic-American heritage, the Congress, by joint resolution (Public Law 88-566) approved on September 2, 1964, has authorized the President to proclaim October 9 of each year as "Leif Erikson Day."

NOW, THEREFORE, I, BARACK OBAMA, President of the United States of America, do hereby proclaim October 9, 2009, as Leif Erikson Day, and I call upon all Americans to observe this day with appropriate ceremonies, activities, and programs to honor our country's rich Nordic-American heritage.

IN WITNESS WHEREOF, I have hereunto set my hand this seventh day of October, in the year of our Lord two thousand nine, and of the Independence of the United States of America the two hundred and thirty-fourth.

BARACK OBAMA

Pages

Subscribe to RSS - blogs