UPDATE January 2023: split from Linux Essentials and heavily refurbished!
Have you ever lost your OS install due to breaking it and being unable to fix?
Have you ever lost your OS install due to drive failure?
Have you ever lost your OS install due to a theft or a fire?
Have you ever wanted to copy your OS install to another computer without reinstalling it and redoing all the modifications to the base distro?
Well, hopefully you haven't suffered from the first three. But if you have, you know the value of backups. And if you haven't, well, let me tell you that you don't want those things to happen. As for the fourth - if you are anything like me, you probably have your favorite, carefully prepared system configuration that you don't stray away from (except to check stuff out sometimes, maybe). Wouldn't it be great if you could just "freeze" and "teleport" your OS whenever and wherever you want to? Protecting you both from those listed hazards and saving time / effort redoing modifications in case you want to deploy your OS elsewhere. This article will teach you those magic spells. What we will do here is make a snapshot of your current running OS and store it on other partitions and / or drives - and then learn how to bring it back. The main reason for doing this is to immunize you against OS breaks; you can always play around with your current install and just restore the backup in case of a break. Anyway let's go:
New size smaller than the minimumerror):
Resize/Moveand input your desired size:
sudo liloconfigand pick the
expertmode. Note: this entire process will assume you're using a live system that runs the same kernel as your restored backups; if it's not the case, the following instructions are still valid, but will need a tiny modification after you're done.
Begin:
OKpast it:
standardon the next screen:
MBRnow:
30 secondshere, so that you can actually manage to choose which OS you want to boot (main or backup):
OKpast the screen:
Linuxagain, and add the sda3 partition on which the backup is installed:
sudo mount /dev/sda3 /mnt/tmpin a terminal. Then
sudo leafpad /mnt/tmp/etc/fstab:
The fstab file decides from which partition the system is actually booted (and every other partition that will be mounted at launch). See how it's still trying to boot from sda1, even though the backup is on sda3? That's because the original fstab had sda1 in it - as it should have. But now we're trying to run the restored backup, so this is counterproductive. Just change it to sda3
and save.
Adding a Linux distro in liloconfig's interactive menu will insert an entry pointing the bootloader to the same kernel that the OS you ran liloconfig from has. For example, the lilo config file might have a section like this:
# Linux bootable partition config begins
image = /boot/vmlinuz-generic
initrd = /boot/initrd.gz
root = /dev/sdb1
label = Slack14
read-only # Partitions should be mounted read-only for checking
# Linux bootable partition config ends
In Slackware, vmlinuz-generic is actually just a symlink to whatever the kernel version it's using, eg. vmlinuz-generic-5.15.63 in 15. If the OS you ran liloconfig from has that, then lilo will "expect" all the OSes defined in the config file to be using it too. Yet, imagine that you wanted lilo to boot an older or newer Slackware version (like the 14 in the above example), or even a completely different distro. The bootloader will expect the booted OS to be using the kernel specified in the config file, but it doesn't, so it will fail to load. To fix this problem, you will need to copy the kernel from the other distro to your current /boot folder, and point lilo to it. First, mount the partition that contains the "other" distro you want to boot (eg sudo mount /dev/sdb1 /mnt/tmp
), and copy its kernel to /boot (where liloconfig loads them from by default), eg sudo cp /mnt/tmp/boot/vmlinuz-generic-4.16.9 /boot
; remember to pick the one with the numbers at the end. Now modify the lilo config file entry as such:
# Linux bootable partition config begins
image = /boot/vmlinuz-generic-4.16.9
initrd = /boot/initrd.gz
root = /dev/sdb1
label = Slack14
read-only # Partitions should be mounted read-only for checking
# Linux bootable partition config ends
What was just vmlinuz-generic became vmlinuz-generic + the kernel version your "different" OS is using. Save and re-run lilo so that it "absorbs" the updated config file (just sudo lilo
is enough). There is no problem for lilo be able to load many different Slackware version installs, or even different distros, though I have no experience with the latter. Some internet posters are saying that certain distros also have their own unique initrd files; if so, those will have to be copied to /boot and inserted into the config file, as well.