Archive for June, 2008

Laptop hard disk replacement, part two

Way back in May I had a hard disk in my laptop fail, and after the warranty replacement disk showed up it took me a few days to get around to doing the replace. It didn’t get off to a very good start though…

In the past when I’ve done this kind of recovery I copied the details of the partition table and copied each partition in turn off the failed drive. This time however in my haste (or something) I imaged the entire 80GB in a single file by using dd pointing at the disk device node (/dev/sda, say) instead of each partition.

When it came to restore, this brought me undone. I tried the reverse of what I’d done to create the image, just dd to the disk device node, but at around the point where the first partition would have ended it failed with an I/O error.

Assuming that I did actually have a valid image of the entire drive, I needed to find a utility that would treat a disk file as an image of an entire drive, partition table and all. Then, theoretically, I could copy each partition out of the source file in the same way I was used to.

As usual, the lazyweb came through for me. I found a beaut utility called kpartx, apparently part of multipath-tools. I also found some blog posts describing how to use the tool for what I needed. What kpartx does by itself is scan a block device or normal file (significant, as I’m sure when I first used it I had to use losetup) and create device-mapper mappings to the partitions it finds. kpartx was just what I needed!

This blog post describes the process I went through (and no losetup here either). For me, I let kpartx create device-mapper nodes for the partitions in the disk image, and then used dd to copy from each of those partitions to the real partitions in the new disk (carefully created using fdisk to match the originals). Then I set up grub on the new disk, and installed it into the laptop. It worked first go!

So now on its third hard drive, this Sony Vaio (same one with the weird wireless issue in Hardy) gets yet another lease on life. The battery is almost expired though, so I think it won’t be long before it goes to the Old Hardware Shelf…

Edit: I realised my confusion about losetup. kpartx uses losetup under the covers if it detects that you’re trying to work on a disk file instead of a block device. When you use the -a or -l switches to kpartx, if it needs to it straps up a loop device for you and automatically works on that; running kpartx with the -d removes not only the device-mapper nodes but the loopback node as well.

Don’t you hate it when defaults change?

Sometimes when working with computers and networks (as with most things in life) the thing that causes the most problem is the last thing you suspect–or often something you never suspected. I had a reminder of this the other day, when a moderately complex task I’d set myself looked to be scuppered for absolutely no reason I could fathom.

I’ve got a system here that is a host for a virtualisation environment I run. I dedicated a couple of network cables to the adapters owned by the virtualised system, and a third one was attached to the host’s IP stack. To get connectivity for another system, I had to steal the host’s cable though–which wasn’t a problem as the operation of the system works more-or-less entirely from the console rather than over the network. Just for grins, however, I decided to set up connectivity to the host by routing through the virtualised environment it hosts.

Having established the tunnel connection between the virtualiser and the host stack, I set about configuring the special details required to support routing through this system. After a few tries at getting it right, I was rewarded with successful pings between the systems on my LAN and the hosts system on its routed connection. So I jumped onto the console of the machine and light up Firefox, but got an error page. I realised I hadn’t set DNS resolution–on the LAN, the machine was having resolv.conf configured by DHCP, so now I had to do it manually.

Okay, so DNS resolver now correctly set, let’s see Firefox WIN! Oh. Fail.

When I hit Try Again or Reload, the page would instantly refresh. This was starting to look like no routing problem. I used dig to test name resolution, and it told me it was being rejected. I looked at my dns.conf… Nope, so subnet restrictions coded there…

So I hit the lazyweb, and it didn’t take too long before I found a forum post that led me to this. In BIND 9.4.1-P1, ISC basically changed the default behaviour of a couple of query filtering settings. This had the effect of rejecting some requests that were previously accepted, such as those from non-local subnets. A reconfiguration of my DNS server gave me success at last.

Hooray for persistence! Now, someone hand me some Cat-5 so I can make a cable and plug this thing back in properly. :)

Tags: ,

Ubuntu 8.04 Wireless Weirdness

Over the last fortnight I finally got the wriggle-on to upgrade all my (K)Ubuntu systems to Hardy Heron. Various issues occurred with each of them, but overall the entire exercise went smoothly (my wife’s little old Fujitsu Lifebook was probably smoothest of the lot). I had one rather vexing issue however, on my old (I’m tempted to say “ancient”) Vaio laptop.

The onboard wireless on this thing is an ipw2100, hence only 802.11b, and I had a PCMCIA 802.11g NIC lying around (actually it came from the Lifebook, liberated from there after I bought it a Mini-PCI 802.11g card on eBay). On Gutsy, I used the hardware kill-switch to disable the onboard adapter to make double-sure that it wouldn’t try and drag the network down to 11Mbps.

This laptop was the last machine I upgraded to Hardy, and I was playing with KDE 4 on it so I was looking forward to seeing what KDE4-ness made it into Hardy. While the upgrade was taking place the wi-fi connection dropped out, but I didn’t think anything of it since Ubuntu upgrades try and restart the new versions of things and I figured NetworkManager had fallen and couldn’t get up. After the reboot, however, KNetworkManager (still the KDE3 version, don’t get me started there) could find no networks — could find no adapters, in fact.

I logged back into KDE3 and poked. Still no wireless (as if the desktop would make a difference, but I had to make *some* start on pruning the fault tree). The Hardware Drivers Manager was reporting that the Atheros driver was active (for the PCMCIA card), and an unplug-plug cycle generated all kinds of good kernel messages.

On a whim, I flicked the hardware kill-switch for the onboard wifi[1]. Almost instantly, KNetworkManager prompted to get my wallet unlocked — it had found my network and wanted the WPA passphrase. I provided it, and got a connection: via the PCMCIA NIC.

“That’s odd”, I thought, and flicked the switch. A few seconds passed, and the link dropped. Flicked the switch on, link came back. Flicked the switch off again: this time a few minutes went past, but again the link failed. Tried it several times again, and the same thing happened. The state of the kill-switch for the onboard NIC was influencing the other NIC too!

It seems that this is altered behaviour in NetworkManager, applying the state of the hardware switch to all wi-fi adapters. If it annoys me significantly I’d like to think I’ll trawl changelogs, or even better lodge something on Launchpad… more likely though I’ll forget all about it having found a kludgy workaround.

I’ve now added ipw2100 to the module blacklist and things work okay (presumably because the state of the onboard switch can’t be reported any more). I’ll also have a think about whether a few dollars for another g-capable Mini-PCI NIC will be throwing good money after bad, as this laptop really is quite long-in-the-tooth.

Oh yes, that’s right… KDE 4. Next time perhaps. :-)

[1] I can’t think why I did this. I knew that I’d disabled 802.11b in my access point, to make triple-sure an 802.11b device wouldn’t slow my network down… The onboard 802.11b NIC would never successfully get a connection.

Tags: , ,

Whither Twitter

I really don’t use Twitter much at all. It’s one of those things, like Facebook, that I just signed up to more-or-less on a whim. But with all the stability and performance problems they’ve been having recently (and the flak they’ve been taking in the press, I understand) I’m hoping that they pull through. You have to wonder though, when their Status Blog gets a post entitled “Odd whales”…

Odd whales

We're seeing a number of whales pop up around the site, especially on profile pages. We're aware of the issue and working on it now.

Update: site back up and mostly whale free.

Bizarre — but maybe if I was a more regular user it would make more sense. ;-)

Unfortunately my visibility of their problems started when they shut off their IM functionality — unfortunate because at around the same time I had done an upgrade of my Jabber server and blamed the upgrade for not being able to connect to Twitter. Hours of fruitless config checking and Googling finally led me to the aforementioned Twitter Status Blog and the news that IM had been disabled. Ever since then (two or three weeks ago) IM function has been the “number one priority to get restored”…

I’m not complaining. It’s a service I barely use, and one I’ve never paid for. I can appreciate people getting upset however; as someone who does have trouble keeping in touch with friends and family, if I had gotten more used to it I’m sure I’d be one of those complaining.

Doom-and-gloom time… Part of the flak Twitter has been copping is around the design of their systems (virtually no redundancy or scalability) — if this is systemic to Web 2.0 startups and the investors and venture-capitalists catch on, things could get ugly FAST. Are we set for a repeat of Dot-Bomb? Could Twitter be the first victim of an impending burst of the Web 2.0 bubble?

I hope it comes back. Twitter is a nice way to see what folks are doing, and it’s a reminder of the fact that there are people out there. :) Perhaps I’ll even make a bit more use of it, if it can get its IM groove back on. Good luck folks, and watch out for the whales…

Tags:

Annoying cliche of the week

If I see or hear one more reference to something being a “perfect storm” I think I’m going to be sick.

Tags:

Slack blogger

It doesn’t take much to see just how rubbish I am at this blogging thing. The last few months have been full of interesting happenings, and the blog has been silent. I’m not going to embarrass myself by saying “I’ll do more frequent updates, really I will” because I know it won’t happen. Oh well, as appears in the gospel according to Dirty Harry, chapter Magnum Force, “A man’s got to know his limitations”.    :)