How to create snapshots in openSUSE with YaST2
Snapshots are an easy way to restore configuration errors and other issues. With openSUSE, working with snapshots is incredibly easy. Jack Wallen shows you how.
OpenSUSE is yet another great Linux distribution that has a lot to offer. Many believe that openSUSE is one of the best versions of Linux for enterprise desktop use cases. One of the many reasons for this is the built-in snapshot tool made possible by a combination of the btrfs file system and the YaST2 snapper plug-in.
For those not as familiar with openSUSE (or SUSE), YaST2 means yet another configuration tool and is a central location for configuring SUSE and openSUSE. But don’t think of YaST2 as just a system configuration tool, because it’s much more powerful than that. And because it supports a large plugin system, it is possible to extend the feature set with ease. But with modern versions of openSUSE or SUSE, YaST2 includes the snapper plugin.
SEE: 5 Linux Server Distributions You Should Be Using (TechRepublic Premium)
What is the snapper? Snapper is the btrfs snapshot tool. By design, snapper is a command line tool. But with openSUSE, YaST2 includes a graphical interface that makes managing snapshots incredibly easy.
I want to introduce this tool to you, so that you find yourself at home creating snapshots on your openSUSE desktops.
What are snapshots?
Before delving into this area, you might be wondering what these snapshots I constantly refer to are all about. Think of it this way: A snapshot is a snapshot of your computer’s file system that you saved when something went wrong. If this fatality occurs, you can restore the file system to an earlier state. Simply put, it’s a backup.
Out of the box, openSUSE is configured to automatically create certain snapshots. When you run the tool for the first time, you will find snapshots for times such as:
- First root file system (operating system installation)
- Post installation
- Online Updates
In other words, any major event will initiate the creation of a snapshot. But there may be times when you want to manually create a snapshot. Suppose, for example, that you want to make a major configuration change to your system. Before you do this, create a snapshot. If something goes wrong, you can always revert to the snapshot you created before the configuration change.
What you will need
All you will need for this is a running instance of openSUSE. I will demo with Tumbleweed (the mobile version of openSUSE), but you can opt for Leap (the static version). And that’s all you need. Let’s see how it works.
How to create a snapshot with YaST2
Log in to your openSUSE instance. Click on the desktop menu and type snapper. Click on the YaST2 – YaST Filesystem Snapshots entry and, when prompted, enter your user password. When YaST2 opens (Figure A), you should see a list of all current snapshots.
Suppose you are about to make a major change to the system configuration and you want to create a snapshot. Click on the Create button. In the resulting window (Number B), give the snapshot a memorable name (you’ll want to know exactly which snapshot to choose if you need to go back).
If you want to focus a snapshot on a particular user data, you can add the username in the User data field, if not, you can leave everything else blank and click OK.
Now that you’ve created a snapshot, let’s test it. Open a terminal window and run the command:
sudo touch /etc/testing
What you did there is create a new (empty) file in the / etc directory named testing. As was done after the snapshot, it needs to be recovered. Let’s find out.
Select the new snapshot from the list, then click Show Changes. In the new window you should see etc listed (Figure C).
Select the etc entry, then in the next window expand it to reveal what has changed since the snapshot was taken. You should see the list of tests (Number D).
If you select this file, you can then click Delete to delete it.
Let’s say, however, that we made a change to the smb.conf file. If we make such a change and then display it in the overview of the selected snapshot, we will see the listed change (Encrypted).
If this change caused problems, you can click Restore Selected to revert the change to the pre-snapshot state.
And that’s how easy it is to manage snapshots on openSUSE. It’s one of those tools that you hope you never have to use, but you’ll be grateful if it’s there if the opportunity arises.
Subscribe to TechRepublic How to make technology work on YouTube for all the latest technical advice for professionals at Jack Wallen’s business.