How to create snapshots in openSUSE with YaST2

Snapshots are an easy way to roll back configuration errors and other issues. With openSUSE, working with snapshots is made incredibly easy. Jack Wallen shows you how.

You can create snapshots in openSUSE with YaST2

OpenSUSE is yet another outstanding Linux distribution that has plenty to offer. Many believe openSUSE is one of the best flavors of Linux for business desktop use cases. One of the many reasons for that is the built-in snapshot tool made possible by a combination of the btrfs file system and the YaST2 snapper plugin.

For those who aren't as familiar with openSUSE (or SUSE), YaST2 stands for Yet another Setup Tool and is a centralized location for the configuration of SUSE and openSUSE. But don't think of YaST2 as just another System Settings tool, as it's much more powerful than that. And because it supports a vast plugin system, it's possible to easily expand the feature set. But with modern releases of either openSUSE or SUSE, YaST2 includes the snapper plugin. 

SEE: 5 Linux server distributions you should be using (TechRepublic Premium)

What is snapper? Snapper is the btrfs snapshot tool. By design, snapper is a command-line tool. But with openSUSE, YaST2 includes a GUI that makes managing snapshots incredibly simple.

I want to introduce you to this tool, so you'll find yourself right at home creating snapshots on your openSUSE desktops.

What are snapshots?

Before we dive into this, you might be wondering just what are these snapshots I keep referring to. Think of it this way: A snapshot is a moment in time for your computer's file system that you've saved in case something goes wrong. Should that inevitability occur, you can roll the file system back to a previous state. In simplest terms, it's a backup.

Out of the box, openSUSE is set up to automatically create certain snapshots. When you first run the tool, you'll find snapshots for moments like:

  • First root filesystem (OS installation)
  • Post-installation
  • Online updates

In other words, any major event will launch the creation of a snapshot. But there might be times when you want to manually create a snapshot. Say, for instance, you want to make a major configuration change to your system. Before you do that, create a snapshot. Should something go wrong, you can always revert to the snapshot you created before the configuration change.

What you'll need

The only thing you'll need for this is a running instance of openSUSE. I'll be demonstrating with Tumbleweed (the rolling release version of openSUSE), but you can opt to go with Leap (the static release version). And that's all you need. Let's see how this works.

How to create a snapshot with YaST2

Log into your instance of openSUSE. Click the desktop menu and type snapper. Click the YaST2 - YaST Filesystem Snapshots entry and, when prompted, type your user password. When YaST2 opens (Figure A), you should see a listing of all the current snapshots.

Figure A


The YaST2 Snapper tool is ready to go.

Say, you're about to make a major configuration change to the system and you want to create a snapshot. Click the Create button. In the resulting window (Figure B), give the snapshot a memorable name (you'll want to know exactly which snapshot to choose if you need to roll back).

Figure B


Naming your new snapshot.

If you want to focus a snapshot on a particular user data, you can add the username in the User data field, otherwise, you can leave everything else blank and click OK.

Now that you've created a snapshot, let's test it out. Open a terminal window and issue the command:

sudo touch /etc/testing

What you've done there is create a new (empty) file in the /etc directory named testing. Since this was done after the snapshot, it should be picked up. Let's find out.

Select the new snapshot in the listing and then click Show changes. In the new window, you should see etc listed (Figure C).

Figure C


The etc directory is shown because we made a change within that directory. 

Select the etc entry and then, in the next window, expand it to reveal what has changed since the snapshot was taken. You should see testing listed (Figure D).

Figure D


Our new testing file is listed as being created after the snapshot was taken.

If you select that file, you can then click Remove 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 view it in the Selected Snapshot Overview, we'll see the change listed (Figure E).

Figure E


I've changed the name of the Samba workgroup from WORKGROUP to HIVENET.

Should that change have caused problems, you could click Restore Selected to revert the change back to the pre-snapshot state.

And that's how easy it is to manage snapshots on openSUSE. This is one of those tools you hope you never have to use but will be thankful it's there should the occasion arise. 

Subscribe to TechRepublic's How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.

Also see


Image: openSUSE