1.09.2012

Bazaar and sshfs and stack traces. Oh my!

I'm a big fan of revision control, although I don't use it as much as I should.  Typically, I only use it on big projects because the small projects usually don't need it.  I've been working on a custom integrated search engine recently, and I decided that the project had gotten big enough to require revision control.  Unfortunately, there's no standardized revision control system at work, so each programmer uses his favorite program to handle source code revisioning.

This time, I decided to try Bazaar.  I started with this article on my folder on the server and, when I tried to do my first commit, as might be expected when programming, it spit out a nice stack trace.  I changed protocols to ssh (from cifs), and there was no change.  After some poking around on the internet, I discovered I needed to enable a workaround regarding renaming.  When you mount the remote file system, the command needs to look something like this (notice the part in bold):

sshfs user_name@server:/remote_path /local_path -o idmap=user,uid=user_id,gid=group_id,workaround=rename

If you're using Bazaar over some remote link and you keep having problems that sound similar to mine, mounting the file system in this way really shouldn't hurt anything, so it's worth a try.

I sincerely hope that this helps somebody.

8.14.2011

The Horrors of Western Digital "Green" Drives

A few days ago, I began to assemble a backup server.  Four Western Digital Caviar Green 2TB drives were bought, and the rest of the parts were scrounged around for.  After everything was assembled, problems started popping up.

After poking around in the BIOS, I started installing Ubuntu Server 11.04.  Only after most things had been installed (just a few packages before GRUB runs) did the installation fail.  I swapped optical drives.  No luck.  I used a USB drive as the installation media.  No luck.  I unplugged everything except the basic essentials (including the new drives).  Again, no luck.  Finally, I ran memtest, and that found tens of thousands of errors around the 200-300MB mark.  I pulled one of the memory sticks, and that solved my problem.  Frustrating, but if that's the worst of it, this'll be pretty easy.

It installed beautifully, and I proceeded to build a RAID5 array (totaling a 6TB partition), formatted to XFS, just for fun.  I set up Samba logins and set permissions.  Everything was going smoothly.  Small, single-file tests were incredibly zippy (after the RAID array was done syncing).  But when anything larger was transferred (bigger than the cache), it would choke the transfer speed down to abysmal speeds (tens to hundreds of KB/s).  Since I've never used this particular filesystem before, I started blaming XFS and switched to EXT4.  It might have been faster, but not much.  After some research, I stumbled across a program called WDIDLE3.  To save energy on the Green drive series, the drive parks the heads after a certain period of inactivity.  After some poking around, it turned out that it was parking the heads about once per second.  Western Digital claims that the drives are rated for 300,000 "head loads".  When I noticed it, all of the drives had already accumulated a "load/unload count" (SMART attribute 193) of over 20,000.

I quickly downloaded and burnt an Ultimate Boot CD (which has WDIDLE3 and FreeDOS already on it).  Then, I simply booted to it, found WDIDLE3, and ran it.  Upon reviewing the options, I chose to "disable" the idle timer.  Reboot time.

Doing more tests produced the same results as before.  Finally, I booted into FreeDOS and ran WDIDLE3 again, but this time I manually set the timeout to 5 minutes (300 seconds).  One, final reboot and set of tests.  Success!  40-70MB/s over GigE!  After checking SMART, I started a really big transfer and went away for an hour.  When I came back and did the SMART tests again, no head loads had occurred!

The moral of the story is not that WDC Green drives are bad, but they need to be tweaked before you start using them.  If you don't, you might end up with a dead drive in a matter of months.

P.S.: Just because WD rates their drives for 300,000 head loads doesn't mean they're absolutely going to fail right when you hit the "limit".  There are screenshots of people who have 1.3 million head loads, and their hard drive is still working (although they're paranoid about it falling apart at any moment).

P.P.S.: My WD Caviar Black (yeah, the enterprise grade ones) in my desktop report 260 head loads each, and they're several months old.

1.19.2011

Lest we forget...

This blog entry is so I don't forget how to do threading using the Boost C++ Libraries using Eclipse in Linux.  Oh, and anybody else who's had odd problems.

So, basically, the goal here is to link to boost_thread.  I'm going to assume you've already gotten libboost-all from the repositories.

  1. Right click on the project you want to do threading in.
  2. C/C++ Build > Settings > Tool Settings > GCC C++ Linker > Libraries.
  3. In the top panel, add an entry for "boost_thread"
Ta da!  It and all it's magical goodness work!

Just for fun, here's the code for basic threading:
// Start the thread
boost::thread workerThread(doWork);
// Pause this thread until workerThread is done
workerThread.join();
Note that we don't really need to "join" the thread.  workerThread will go off and do it's own thing, even if we do our own.

Happy threading!

    8.30.2010

    Samsung Captivate (A Galaxy S phone)

    I finally got a cell phone.  A very nice cell phone.  Probably one of the highest-end phones sold.  It's the Samsung Captivate.  I'll post a more full review when I can.  Maybe even a few pictures or a video.

    When you first pick up this phone, you notice several things.  First, it's got a massive screen.  It's a 4" SuperAMOLED screen.  And black really is black, not dark gray.  It's really a beautiful screen.  Some other reviews say it looks a bit over-saturated, but I think that the intense colors are on purpose and look excellent.

    The next thing you notice is how small and light it is.  It's slightly less than 1/2" thick and weighs no more than an average cell phone.  There are only 3 physical buttons on this phone: power, volume up, and volume down.  However, there are also 4 capacitive buttons at the bottom: menu, home, back, and search.  On the top, there's a 3.5mm jack for headphones/headsets and a slidey door that covers a microUSB port for charging and data transfer.

    The call quality is as good as can be expected.  It's much better than free phone call quality, but it's still not flawless beautiful audio.  In any case, I'm not going to complain about it.

    Finally, there's Swype.  Swype is a keyboard where you just slide your finger over the letters in a word, and Swype tries to figure out what you intended to write.  It's very fast and surprising accurate.

    Yes, I rooted it.  If for nothing else, I did it just to show iPhone users how it's done... in terminal!  I'm a linux user, so it's nice to have access to a terminal to do whatever you want.

    The 3D graphics benchmarks from this phone are better than any other phone out there.  I just can't wait until the Android 2.2 update comes out so I can show even the Droid X users what "fast" means.

    8.13.2010

    Mac4Lin Success Story

    I've made my Ubuntu GNOME look as close as I'm comfortable to an OS X look.

    In this screenshot, you see three non-standard programs:
    1) Mac4Lin
    2) Gnome-globalmenu
    3) Docky

    Mac4Lin is a project that aims to make icons and textures to make any GNOME look like OS X.  It's easy to install.  Just run the install script from the latest version of the compressed file.  Even though the installer recommends answering "n" to the two questions, I said "y" and it seems to work better.

    Next, I installed Docky from Synaptic.  Docky is, by far, the best dock program I've seen yet.  It's nice, smooth, and stable without being overly complex and cumbersome, like Cairo.  I have mine in "Panel Mode" so it stretches out over the whole bottom of the screen.

    Finally, I installed gnome-globalmenu.  Yes, it takes a little bit to get used to, but it frees up space in each window.  Unfortunately, Firefox and all it's little derivatives, such as Songbird, don't work yet.  It's got something to do with Firefox not conforming to GNOME standards.

    I'm also using Compiz.  People tend to say "Mac is so pretty!"  I disagree after seeing what Compiz can do!  Eat your heart out, Mr. Jobs!

    8.11.2010

    RAID, Glorious RAID

    I'm not sure what made me think of it, but two days ago, I decided to convert my computer to using a RAID array.  Unfortunately, that means I lose all my existing data, but that's ok because I can download it all again.  It's open-source software, after all!

    I scrounged up three 250GB Western Digital Caviar drives (unfortunately, they're 1.5Gb/s drives) and a 500GB Seagate Barracuda drive (3 Gb/s).  I left the 250GB drives in one large partition each, and I split the 500GB drive in half, creating two 250GB partitions.  Well, actually 3.  250GB went toward the array; 246GB went toward a partition I called /store; 4GB went toward my swap partition.  I don't recommend swap space normally, but I run lots of IDEs, VMs, and other memory intensive applications.  I run into my 4GB of memory really quick, so another 4GB is about what I need.

    I tried using hardware RAID.  Since I have a nice, cheap-o motherboard, it's fakeRAID, which is just glorified softRAID that Windoze can use.  But, unfortunately, Linux didn't play nice, so I ended up using softRAID.

    Now comes the time during which you choose the type of array you want.  I chose RAID5 because of its speed and redundancy.  If a drive fails, I panic, but then I replace the drive and all is well again.  With RAID10, half of the drives can fail at the same time and it'll still work.  But it's slightly slower.  There are benchmarks online that compare softRAID speeds RAID5 vs. RAID10.  Then there's RAID0 (mirroring), which only works with two or more drives, but half of your drives can fail.  RAID1 (striping) gives you no tolerance for failure, but you sum up all the space on your drives into one lump sum.  If one drive fails, you lose all your data.

    I reinstalled Ubuntu, using my softRAID5 array.  Installation took longer than I expected, but then again, I've never installed Ubuntu using the "alternate" installer.

    Now for the completely-biased benchmarks.  Originally, I could read about 50-60MB/s off of a single 250GB Western Digital Caviar SATA1 drive.  In the array, I peaked at 161MB/s and averaged 120MB/s.  That's nuts for a bunch of old drives!

    Unfortunately, I couldn't test write speed yet.  I need to find a better benchmarking application than the default one in the Ubuntu Disk Manager.

    More info on RAID arrays on Wikipedia.

    8.04.2010

    Drumroll Please...

    I know that every last one of you (both of you, in fact) have been eagerly awaiting my Apple rant.  Well, it's time.  Here's a very small list of problems I have with Apple

    #1: Their products are too simple.  I want something that works out of the box but is tweak-able to make it nothing like the factory standard.  With iPhones, iPads, iMacs, iBooks, iDontCares, you're stuck with whatever Apple deems you might want.  Android, for example, doesn't even have to look like a phone.  Or a tablet OS.  Shoot!  If you root it, you even have console access!  Go CLIs!

    Ironically, "rooting" an iPhone is called a jailbreak.  Great, so now people have to break out of iOS.  And what do you get?  Themes, and a few tweaks.  Joy.

    #2: Their childish marketing techniques.  Has anybody actually seen the "Hi, I'm a Mac" commercials?!  The only thing I see coming out of the Apple marketing department is smear campaigns.  Just about everybody else has morals and, instead, shows off their own strengths.  And yet people keep buying Apple byproducts.

    #3: I am root.  I really do enjoy my superuser access here in my Linux desktop.  Oh!  The Android kernel is based on the Linux kernel.  Hmm...

    There's my top three problems with Apple.  Don't worry, there's more to come.  It's just that I'm getting hungry.