Archive for the 'gentoo' Category

Adding a simple progress bar to dd

I recently ran into an issue where I wanted to move several KVM based virtual machines from one server to another server. There’s several ways you can accomplish this depending on what you want to do. In my case I was using LVM for the disk backend, so simply copying the disk image files wasn’t an option. It boiled down to two basic options.

  • Put system in single-user mode, rsync the contents over, and reinstall grub
  • Use dd and copy the whole LVM volume over piped through ssh

The advantage using the rsync method is that you’re only copying the files you need over, thus less data transfer happens. But then you run into needing to re-run grub (which generally isn’t a problem). In addition, if you’re using LVM within the LVM volume for the VM and the volume group is named the same, you run into some interesting issues. The advantage for using dd is that you can get a literal copy of the disk image and just start the VM back up without any other steps. Of course, this will only work if the volumes are the same on both ends.

So I decided to go with dd but ran into a problem of seeing the progress of a 15G volume copy. I did some digging around and found a blog post that mentioned using a command line application called ‘bar‘ so I decided to give it a shot! Its a fairly simple application that just creates a basic progress bar based on the data being piped into it. If you’re running Gentoo, the package is called app-admin/bar.

Here’s the command I ended up running:

dd if=/dev/lvm/cholula-disk | bar -s 15g | \
    ssh -c arcfour $host "dd of=/dev/lvm/cholula-disk"

When ran, it gives you output similar to:

6.0GB at   17.9MB/s  eta:   0:08:32   40 [=========================                 ]

The downside is that you need to specify the block device size before hand, but for something simple like this its quite nice. Of course I could just use one of the many dd forks out there which include progress bars but this is quick, dirty, and simple!

I used the arcfour cipher mainly to reduce the CPU overhead and increase the throughput, but you should probably never use this cipher on an untrusted network as it does have weaknesses. I didn’t try doing throughput tests on other ciphers, but it would be interesting. It took me approximately 10-12 minutes to copy a 15G volume over a gigabit network which isn’t too bad.

Another trick you can do is utilitize the LVM snapshot feature and create a snapshot of the running volume. If any data changes on the volume, it won’t be copied over obviously, but it will at least let you do a cold “live” migration of sorts.

The EeePC netbooks are awesome!

eeepc1000As some of you may have noticed, I usually carry around a tiny little black laptop when I’m at Beer and Blog or at a coffee shop. Since people ask about it so much, I decided to write a few blog posts about it with this being the first.

What is it? Its an EeePC 1000 from ASUS (the same guys that make motherboards). Its a new type of laptop that is generally referred to as a netbook mainly because it lacks some of the features that a normal laptop has such as a cdrom, being heavy, a multi-core power sucking CPU, and a huge screen. Outside of that, its like any other laptop with a few other enhancements. In my case, this EeePC has these features which I love about it.

  • Long battery life, claims one day computing (6+hrs)
  • Solid State Drives (SSD) – no moving parts & better battery life!
  • Multi-touch track pad
  • Very usable keyboard (92% from a normal laptop)
  • Lightweight (2lbs 15oz)
  • Fast 1.6 Ghz Intel Atom processor
  • 802.11n Wi-Fi and Blue-tooth
  • 1.3MP web cam

I’ve used my trusty 15″ PowerBook for many years and I still use it, but its become more of a hassle to carry around with me. I’m a UNIX Admin, so I don’t need much on my laptop (xterm, Firefox, Thunderbird, and pidgin) to get work done and the EeePC was a perfect fit. The first models that ASUS releases for the EeePC didn’t appeal to me since they had a screen and keyboard that was too small for me to deal with. A good friend of mine (who also has the habit of being an enabler for me :P) purchased one for himself and kept raging about it. I was actually considering getting an upgrade for my PowerBook but didn’t want to pay $2K for a new MacBook, so instead I decided to get this EeePC forĀ  around $500 (its down to $430 now).

Asus gives you two options for Operating Systems on these laptops: Windows XP or Linux (Xandros). Since I’m a Gentoo developer, I decided to give it a try on this laptop. I encountered a few issues of course, but overall I have all the hardware working. The only annoying thing so far is the wireless driver not being included in the mainline kernel, but that’s going to change soon I hope. There is an open source driver but its a little finicky to deal with on networks using any form of security passwords. But it does work!

In the upcoming posts, I plan to write about the following:

  • How I installed Gentoo on it
  • Gentoo tweaks I use on it
  • Window management
  • Firefox tweaks (yes, you need them!)
  • How netbooks are helping promote Linux to the masses

I love my EeePC and you should get one too! :)