Backing up and restoring your DSL configuration

488

Author: Robert Shingledecker, John Andrews, and Christopher Negus

Damn Small Linux (DSL) is primarily a live CD, or emulation thereof, which means that the base system is read-only. So how do you save your settings? Mastering DSL’s backup and restore method is essential to enjoying DSL without using a traditional hard drive install. Here’s how to back up your DSL settings, files, and applications to a single archive file on a local medium (such as a floppy disk, pen drive, or hard disk).

This article is excerpted from the newly published book The Official Damn Small Linux Book: The Tiny Adaptable Linux That Runs on Anything.

Find the DSLpanel icon on DSL’s desktop, and click on it to see the control panel. Click the Backup/Restore button. Using the Fluxbox menu, choose System, then Backup/Restore. The Filetool pop-up window prompts you for the name of the device (representing a hard disk, USB flash drive, or other writeable medium) where you want the backup to be stored.

You must enter a valid device. In Linux terms, this usually means, in order of popularity, the following options:

  • A pen drive (or other USB flash drive) is usually sda1 or sda2, where the number corresponds to the partition number.

  • For the floppy drive, enter floppy or fd0.

  • For an IDE hard drive, the first drive would be hda1, hda2, and so on.

  • For the second hard drive, use hdb1, hdb2, and so on.

Note that pen drives appear as SCSI drives in Linux. If you have a SCSI or serial ATA hard drive installed on your computer, it may appear as sda1 and your pen drive may appear as sdb1. If you see multiple partitions beginning with sd in the mounting tool on the desktop, try opening each drive to make sure you have the correct one before proceeding.

The home directory is automatically included in the backup, as well as some areas of /opt. For now, click the Backup button to start the automatic backup/restore procedure of DSL.

I suggest you become familiar with the basics of backup and restore. Start by making a small change to your system and then reboot. This will help ensure that you understand how the backup process works, before you risk losing hours of configuration.

Upon reboot, as long as the device is physically present — that is, the pen drive is plugged in — DSL automatically scans for your backup file. If the backup file is found, the contents of that backup file are restored without the need to further specify any device.

Selecting files and directories to back up with .filetool.lst

After setting up a new system, you want to save all of your settings. The file .filetool.lst specifies items the user wants to save/restore. It is a simple text file of files and directories listed one per line using a full path. Type ls -l /home/dsl to see the .filetool.1st file, because simply typing ls will not show files that begin with a dot (.).

Use any of the DSL editors to change or update the .filetool.1st file. For example, select Beaver, and then type in .filetool.lst to open that file for editing.

The default contents of the .filetool.1st file cause the entire home/dsl directory to be backed up. However, you can choose to selectively back up only certain files. Just don’t remove the entry /home/dsl/.filetool.lst from .filetool.lst, as this entry provides for persistence for the .filetool.lst.

The default .filetool.1st file in DSL 3.3 looks like this:

       opt/ppp
       opt/bootlocal.sh
       opt/powerdown.sh
       opt/.dslrc
       opt/.mydsl_dir
       home/dsl/

Excluding files and directories from the backup

Exclude files from the backup by adding entries to the file /home/dsl/.xfiletool.lst. This file lists exceptions to files in .filetool.lst, which means if you have a directory listed in .filetool.lst, you can use .xfiletool.lst to prevent certain files or subdirectories within that directory from being added to your backup. Cache and other files are in the default .xfiletool.lst.

This file works by using pattern matching rather than full file pathnames. In this way, you can exclude multiple files with the same name that may be found in separate directories. If you want to exclude a specific file, you can still use the full path to the file. The default file in DSL 3.3 looks like this:

       Cache
       XUL.mfasl
       home/dsl/mnt
       home/dsl/.jwmrc
       home/dsl/.opera/cache4
       home/dsl/.opera/images
       home/dsl/.fluxbox/mydsl.menu

Notice that Cache is listed without a path, which means all files named Cache within directories listed in .filetool.lst are excluded from the backup. You can also use wildcards to extend the exclusion. For example, if the file lists Cache*, all files whose names begin with Cache are excluded.

Restoring your setup

During the boot process DSL searches for and restores your backup of selected files and directories automatically. DSL searches your storage media for your backup archive based on the order of detected drives in the /etc/fstab file. It checks each disk partition until it finds a backup.tar.gz file in the root directory of one of those devices.

You can override this feature by specifying the device that holds your backup file:

boot: dsl restore=hda2 

Specifying the restore device actually speeds up the boot process, as DSL then doesn’t have to search attached and available physical devices. However, not specifying the restore boot option means a hands-free automatic boot.

If you decide at some point that you don’t want to use your backed-up settings, add the norestore option to the DSL boot command. If you want to permanently remove the settings, delete the backup.tar.gz file from the root directory of the device on which it is stored.

The restore option, together with a .xinitrc file, provides users with much more control of their preferred environment.

Copyright © 2007 Pearson Education. All rights reserved.

Categories:

  • System Administration
  • Damn Small Linux