Linux Data Rescue

Rescue Me!

Sometimes it’s hard to believe my adventures with Linux go back nearly 15 years. For the first few years I kept a notebook titled The Road to Linux, which, looking back now, I find mildly entertaining.

I have a history of cobbling together old hardware into working Linux machines, and it wasn’t until 2007 when I actually bought a working Linux laptop. The Eee PC was a tough little machine, and after I got a MacBook Pro I didn’t use it much, until last year when I made it control my RepRap. It’s worked well for that. (The external monitor at home helped quite a bit too.)

I’ve been running a Linux server at home for a long time, and a few years back a friend offered me a broken PowerBook, so I managed to get Ubuntu on it and made than my low-powered Linux home server. It’s worked well, and really had no issues… until I decided to go crazy and run a system update on it. I know, and you know, that backups are important, and you know, and I know, we all still fail to do them properly sometimes.

Well, the system update failed, leaving the system unbootable. And yeah, I had two things on it that I sort of needed. Urgh. Time for some data rescue! I’ve got lots of experience doing data rescue with Macs, but not as much with Linux. Still, it was fairly easy.

Since this was my “home server” and not anything for work, I was probably a bit lax on properly administering it. (I won’t be in the future.) Most of my boxes with databases have cron jobs to dump them to disk every now and then. This one didn’t, and that’s where the fun begins.

I ended up opening the PowerBook and pulling out the drive (thank goodness I’ve got a full set of Torx drivers) and connecting it to the Universal Drive Adapter to turn it into an external USB drive. But what could I connect it too?

As luck would have it, a few months back a relative gave me an old Dell laptop to “wipe clean” and dispose of. I of course dropped Linux onto it. I ended up using Xubuntu, which works well on a 10 year old laptop. Seriously, I do love the ability for Linux to turn old, old, old hardware into something useful.

I plugged the Universal Drive Adapter into the Dell running Xubuntu and copied all the files I needed from the drive. Done. Mostly… except for that one database.

The database rescue took a few more steps. Luckily, I had installed MariaDB onto the laptop. I’ve always used MySQL but in a “what the hell” moment, I decided on MariaDB, which is “an enhanced, drop-in replacement for MySQL.” Indeed it was.

I ended up running a few familiar MySQL commands, first to create an empty database, then to add a user with the proper permissions, and then it was just a matter of copying the correct files from /var/lib/mysql into place from the old drive to the new drive, and bam! My data was all in MySQL, well, in MariaDB.

Just to confirm all was good, I dropped the proper files in /var/www and poked at Apache enough to get my app running and test the database connection. All good.

So now that I’ve got all the data I needed from the PoweBook’s drive, I should probably wipe it and re-install Linux on it. Again. ;)