The moral of this story is: BACKUPS! OMG BACKUPS! BACKUP YOUR SHIT RIGHT NOW! AND THEN BACKUP THE BACKUP! which is of course common sense and you don't need me to tell you that backups are important, gee la, you're not an idiot, you're one of my super-smart well-informed readers whom I respect 100%. Still, though, ... when was that last backup you did, exactly? Can you verify the integrity of the backup? Does it cover every single file you might want to restore in the event of a disksplosion?
I guess there is one upside to this: It's got me in a blogging mood again (Finally!) so you can expect a series of posts dealing with:-
- Preparing for the inevitable failures
- Watching for signs of early failure
- Creating the One True Backup System that can finally give you peace of mind
Today? Let's get the ball rolling with a small post showing you how to set up a GRML rescue system embedded in your Ubuntu or Debian install.
GRML is a linux distro that aims to be a small, lightweight system that you can easily run as a 'live' system from CD, USB, or run directly from your GRUB2 boot menu. It's got most of the system administration tools you might need in a disaster situation and makes for an excellent 'rescue' environment. However, in a disaster situation the last thing you want to be doing is hunting around for a spare USB drive and a machine that still works so you can download the iso file and put it on there - you want something that's set up already, and you want it to be easy to maintain.
Modern versions of Debian and Ubuntu have the grml-rescueboot package available. This package is a fantastic way to easily set up a 'loop' boot menu entry in your GRUB2 menu that points to a GRML iso file that you've downloaded. Simply follow these steps to set it up:-
Step one: Install the package
|I did this in a VM and for some reason it came with grub-legacy. For you, it should be a much simpler affair.|
sudo apt-get install grml-rescueboot
Step two: Download a GRML imageYou can go to grml.org/download/ to help you choose or just see their full list via download.grml.org/ which will redirect you to a mirror. Naturally, I like to just wget the file in-place. It needs to be placed in
/boot/grml/(which has been created by the package) for it to be automatically detected.
|The VM didn't even have wget installed! What kind of machine doesn't have wget!?!|
Step three: Update GrubAny time you change things with GRUB2, you need to run
to regenerate the menu. There's apparently builds of it with built-in lua scripting that can automagically scan for isos, but I've yet to have much success with that.
Reboot into GRML... And you're done! On your usual boot menu you now have the option to boot into GRML.
This loads the GRML menu; whenever I use it, I like to use the advanced options and copy GRML to RAM at boot so that you can be certain your hard drives are not in use while doing rescue operations.
Here we see the grml64-small iso loading:-
And here's the menu you get:-
I always just hit Enter to get a root shell at this point, and use ddrescue to e.g. take an image of my hard disk and save it to a USB hard drive. Remember that 'dd' stands for data destroyer and always always study the manpages carefully and check which of your disks are what before invoking such a powerful tool. You are responsible for your data!
To take these screenshots, I experimented with vmbuilder, qemu-kvm, libvirt and virt-manager. It was kinda fun. Tangental to my series of posts about backups, I might want to talk about setting up VMs with these tools, because they seem a lot more awesome than the other things I've played with in the past.