Backup Tools

From FreekiWiki
Jump to: navigation, search

This page has been migrated to a document on Free Geek's Google Drive.

Information remaining behind may no longer be relevant.


When you have tagged this page as migrated,
please add a link to the new document on Google Drive.

(Link to new page immediately below.)

New Page

There area a set of command line tools that automate common tasks in Tech Support called tstools. They can be installed via apt-get on Free Geek boxes.

   apt-get install fg-tstools

The main tools of interest are ts_network_backup which automates the backup process, and ts_identify_backups which identifies a backup directory given a ticket number.

Anything that ends in .sh or .cfg is not a command and should be ignored (do not delete these as they are used by other files).

All commands come with a built in help system that can be accessed with the -h option.

N.B. They are installed in the correct path so it is no longer necessary to run them from the ts_tools package directory. Run then as you would any other command.

(As it is rather long the help section for ts_network_backup is included below).

The following tools work only with Ubuntu 10.04 at present: ts_reset_gnome, ts_reset_panel, ts_reset_windowmanager

The following have been obsoleted by changed procedures, to some extent, but may be useful on odd occasions: ts_login_as_user, ts_make_tsuser, ts_revert_passwords

Help for ts_network_backup

Use this to create or restore network backups. By default it will attempt to restore users, their data and settings, and the progams installed on the machine.

For a standard backup

  ts_network_backup -c [TICKET NO]

to backup is sufficient.

To restore first identify the backup folder:

   ts_identify [TICKET NO]

this will return the backup folder, then run

   ts_network_backup -r [BACKUP_FOLDER]

to perform the restore.

N.B. on the backup rack you MUST use the -p or -a option to specify the path to the mounted disc.

Usage: ts_network_backup  [OPTION(S)]
Create or restore network backup. 

By default it backs up the contents of /home, the users on the system and the 
packages that have been installed (via apt-get, Ubuntu Software Center etc). 

        -h              	Prints this message
        -c [ticket number] 	Create network backup
        -r [backup directory] 	Restore network backup. The backup directory
			        should be in the format date-ticket_number.
	-d 			Data only. Does not backup/restore users or
				Use of this option is strongly discouraged.
	-u 			Users and data only. Does not backup/restore 
				Use of this option is discouraged.
	-l [log file]		Log messages to file rather than stdout.
				Be careful not to use the same path for backing
				up and restoring, or the  log file may get overwritten.
	-t [addendum]		Normally this script checks to see if a ticket
				number looks like a "real" ticket number. 
				(i.e. it has the correct number of numbers). 
				This option lets you add things to this number. 
				It's useful if you are backing up more than one
				computer and want to store them in different 
				folders referring to the same ticket.
				e.g. 00001-A and 00001-B
				Takes letters, numbers and _only. - is added automatically.  
	-a /path/to/directory   Alternative directory to backup. Implies  -d 
				i.e. does not backup users or packages.
				Use this if you want to backup something
			        other than the home directory.
                                e.g. an external windows drive.
				Suggests the use of -A for restoring backups.
	-f 			force the backup of a single file rather than a directory 
	-F			Force the overwriting an existing backup 
				or restoring with -A and not -d 
        -R                      Read only file system.
                                Use this if you are backing up a read only file
                                system e.g. form a dd image
                                This prevents the backup process from writing files
                                prior to backup. if used without -a it adds an
                                implicit -d. -a normally writes a file to the backup
                                listing the directory backed up. This is skipped.
	-A /path/to/directory	Use this to restore the backup to somewhere
                                other than /home
                                Can be used with or without -u or -d,
                                suggests the later 
				(required if needed) -F must be used if -d isn't. 
	-p /path/to/home	Use this if the home folder you want to
				backup is not in its usual place i.e. if you
				to backup an external/mounted drive 
				rather than /home.
				You do not need to add home on the end but the
				script does not mind either way. 
				Can be used with or without -u or -d. 	


N.B. You normally need to cd in to the tstools_package directory before running commands. You would also add ./ at the front so the command is really e.g. ./ts_network_backup -c 99999

Creating Backups

Backup an externally mounted drive mounted at /mnt/. Do not backup any programs.

ts_network_backup -c 99999 -p /mnt -u

Backup an externally mounted windows drive mountted at /media/win

ts_network_backup -c 99999 -a '/media/win/Users and Settings'

Back up from the first of multiple dd images

ts_network_backup -c 99999 -a '/mnt/dd' -R -t A

Restoring Backups

Restore from a standard backup

ts_network_backup -r 20121223-99999

Restore data from a backup of a windows machine stored in 20121223-99999-A to a folder called Old_Files on oem's desktop

ts_network_backup -r 20121223-99999-A -d -A /home/oem/Desktop/Old_Files

N.B. This is a better way of achieving the same thing if the user is running as oem (restores them to home and symlinks the folder on oem's desktop).

ts_network_backup -r 20121223-99999-A -d -A /home/Old_Files

ln -s /home/Old_Files /home/oem/Desktop

When restoring backups in this way make sure the files have the right permissions so that the user can read (and write) them.