Wednesday, January 24, 2018

Coffee and Backups don't mix well, or how I broke and rebuilt my Debian Linux install in two hours

Maybe the universe wanted me to slow down.
Maybe I just wanted a second mug of coffee.

Or maybe my fascination with automation went a little too far.

I never used Mac OS for long.  Their walled garden approach of curated software just wasn't for me.  Too limited.  I don't care for handcuffs, whether they're steel or lined with "mink".

I got away from Windows when the current approach of Microsoft insisting that You Are The Product with Windows 10 and putting in "Telemetry" so they can know how their software is doing.  You agreed to it when you clicked through the user license.

Spyware.  It is offensive.  They watch everything you are doing. 

So here I am on Debian Linux.  Happy. 

Linux does not hold your hand.  It doesn't make happy noises at you.  It does the job extremely well if you are a casual user who just wants to surf the web. 

It does not advertise at you in exchange for spying on you while you look at news, sports, or weather.  I'm looking at you Windows.

It has its own drawbacks.

Linux isn't great with cutting edge, absolutely new out of the bleeding edge hardware.  Battery management is a bit lackluster, battery life is reduced on Linux as they work to improve the drivers.

It can run some Windows software if you know what you are doing in WINE, and it can even run Windows in its own box if you want to be fancy.   But to be fair, you can run Linux on a Windows computer using the same sort of software.  It's called a Virtual Machine, and that's pretty cool. 

Basically "Yo dawg, I heard you like computers, so I put a computer inside your computer, so you can run computers".

I have done the same with Windows in a Virtual Machine many times but I keep an old machine with Windows 8.1 gathering dust under the furniture for an emergency.  I also have the entire complete environment that I was using on my old Windows XP install back when I started the blog.  I can run it, virtually, on my Linux computer.

But never mind that...

All that software has to be backed up no matter what you run, right?

You are backing things up aren't you?

You aren't?  I will let you decide if you are being brave, or just stupid, and leave it at that.

I will put up with the quirks in Debian Linux in exchange for stability, when I don't break it.  My one computer has been Hibernated 170 times as of last night in a little more than 180 days and is still stable.  I don't reboot when I don't have to.

I back things up, about twice a week.  I don't have to do it so frequently, but I do "Author Content" like this blog, as well as Video and Audio, Graphics, and my laptop does duty as a TV/Radio/Graphics Arts studio on multiple levels.

On Linux, all that software is free.  That also includes my office software, but you go on paying for Microsoft office. 

Backing up your computer on Linux is fairly painless.  When I am through, the end result is a complete clone of what I have on the computer.  Remove the hard drive, swap in the external drive, and I am back running with just one file system check "fsck /dev/sda" and a reboot.

Just like on Windows or Mac, you need an external hard drive.  USB 3 for the speed, please, and it has to be at least as large as your internal hard drive.

From that point onwards it is just technique.

Technique was what I was lacking on that Saturday. 

You see, I wrote a script for the computer to follow.  The script works if everything is correct and in place.  It backs up my chip where I save my personal writings to the hard drive, then backs up the hard drive.  Then to take it one step further it updates the computer's software, checks to see if there are any spies lurking on the hard drive by scanning for viruses and root kits.  Finally it plays a chime to tell me that it was finished and you were a good person for running it.

Well maybe not that last bit but it is complete.

I also got a little slick and simply told it to do everything without waiting.  Should not have done that.  It's a lot to stand on its own with the stack of old hardware that I use on a daily basis.

Oh the hardware works, but the wet-ware doesn't always.

I set the thing going, stood up and just as it started to run to backup the disk, it barfed.

The clone of the hard disk, the actual backup, failed when I bumped the cable and it fell out of the front of the "Destination" disk.

Then it went ahead and updated the operating system, and did all that other stuff.


When it ended I had a computer that showed me everything that I had done wrong to it over the last couple weeks by not starting up again.

I was presented with a black screen telling me that the boot process had stopped and I should try again.

I did, and it repeated itself.

Linux is one of the last refuges of the computer tinkerer.  If you like to do that sort of thing, you can tweak to your heart's content.  Mine looks a lot like Windows 7.  I could just as easily make it into something that looks identical to a Mac, but I want speed.  It runs about twice as fast as this same computer runs under Windows, so I have it.

When I went to enable the second video chip inside the computer, I followed an old guide on how to do it and predictably it had failed.  That was what showed when I booted the computer.

So Linux kiddies like myself, don't go and over-automate.   Step by step.  Sure, your machine CAN do it, but if you're sitting at a desk, wanting another mug of coffee, be certain not to knock the cable out of your backup drive because if the next step is a full upgrade of your computer, you may just be stuffed.

However annoying as all that is... it's a fast fix.

I reinstalled the operating system, Debian Linux 9, in about 15 minutes.
Brought it up to date in another 30 minutes.
Copied over my "home directories" in another 90 minutes.  It was massive.

Computer back to normal from a bare bones install in about 2 hours.
A few more tweaks to get file sharing working, and making it able to play DVDs.

Lesson learned, slow down.

Oh and if you're following along and wondering, the specifics are here since I use this as a scratch pad for my memory.

My computer's C Drive shows up on /dev/sda with operating system on /dev/sda1, swap on /dev/sda5

The backup D Drive shows up on /dev/sdb and will be a perfect clone of the computer.

The syntax of the clone is one line run as root (administrator for windows people)

dd if=/dev/sda of=/dev/sdb conv=noerror,sync status=progress

Just copy the chip to a place on the hard drive manually first.

*sigh*  And don't get a mug of coffee by putting your hand on your back up drive when you get out of the chair!

If you will excuse me, now, I have a mug of coffee to make.  Some home roasted Guatemala Huehuetenango that I roasted last week.  Should be just perfect this morning.


No comments:

Post a Comment