Difference between revisions of "Backup Tools"

From FreekiWiki
Jump to navigation Jump to search
 
 
(12 intermediate revisions by 4 users not shown)
Line 1: Line 1:
There area a  set of command line tools that automate common  tasks in Tech Support called tstools. The latest version can be fould at http://tsbsackup/tstools.tar.gz.
+
{{Migrated}}
Download and extract the file:
 
    tar -xvzf tstools.tar.gz
 
They can be run  by cd-ing into the directory and running ./command. e.g.
 
    cd  tstools_package
 
    ./ts_network_backup
 
  
The main tools of interest are ts_network_backup which automates the backup process, and ts_identify_backup which identifies a backup directory given a ticket number.
+
[https://docs.google.com/document/d/18hPx3NBizcfb4gfOu3h0V_JiX97B5yqohW-7hO-0ZXA/edit?usp=sharing New Page]
  
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).
+
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''' <code>ts_network_backup</code>''' which automates the backup process, and '''<code>ts_identify_backups</code>''' 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.
 
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).
 
(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:
 
The following tools work only with Ubuntu 10.04 at present:
ts_reset_gnome, ts_reset_panel, ts_reset_windowmanager
+
<code> ts_reset_gnome, ts_reset_panel, ts_reset_windowmanager</code>
  
 
The following have been obsoleted by changed procedures, to some extent, but may be useful on odd occasions:
 
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
+
<code>ts_login_as_user, ts_make_tsuser, ts_revert_passwords</code>
 +
 
 +
 
 +
== 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
  
For a standard backup ts_network_backup -c [TICKET NO] to backup is sufficient.
+
    ts_network_backup -r [BACKUP_FOLDER]
To restore first identify the backup folder
 
ts_identify [TICKET NO]
 
this will reurn the backup folderm, then
 
ts_network_backup -r [BACKUP_FOLDER].
 
  
N.B. on tsdata you MUST use the -p option to specify the path to the mounted disc.
+
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.
 +
<pre>
  
Help for ts_network_backup
 
===========================
 
 
Usage: ts_network_backup  [OPTION(S)]
 
Usage: ts_network_backup  [OPTION(S)]
 
Create or restore network backup.  
 
Create or restore network backup.  
Line 41: Line 56:
 
         -h              Prints this message
 
         -h              Prints this message
 
         -c [ticket number] Create network backup
 
         -c [ticket number] Create network backup
-r [backup directory] Restore network backup. The backup directory  
+
        -r [backup directory] Restore network backup. The backup directory
should be in the format date-ticket_number.
+
        should be in the format date-ticket_number.
-d Data only. Does not backup/restore users or  
+
-d Data only. Does not backup/restore users or
packages.
+
        packages.
 
Use of this option is strongly discouraged.
 
Use of this option is strongly discouraged.
 
-u Users and data only. Does not backup/restore  
 
-u Users and data only. Does not backup/restore  
Line 51: Line 66:
 
-l [log file] Log messages to file rather than stdout.
 
-l [log file] Log messages to file rather than stdout.
 
Be careful not to use the same path for backing
 
Be careful not to use the same path for backing
up and restoring, or the  log file may get  
+
up and restoring, or the  log file may get overwritten.
overwritten.
 
 
-t [addendum] Normally this script checks to see if a ticket
 
-t [addendum] Normally this script checks to see if a ticket
 
number looks like a "real" ticket number.  
 
number looks like a "real" ticket number.  
Line 71: Line 85:
 
-F Force the overwriting an existing backup  
 
-F Force the overwriting an existing backup  
 
or restoring with -A and not -d  
 
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
 
-A /path/to/directory Use this to restore the backup to somewhere
 
                                 other than /home
 
                                 other than /home
Line 83: Line 104:
 
script does not mind either way.  
 
script does not mind either way.  
 
Can be used with or without -u or -d.
 
Can be used with or without -u or -d.
+
</pre>
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.
+
 
 +
 
 +
== Examples ==
 +
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. <code>./ts_network_backup -c 99999</code>
 +
 
 +
==== Creating Backups ====
 +
 
 +
Backup an externally mounted drive mounted at /mnt/. Do not backup any programs.
 +
 
 +
<code>ts_network_backup -c 99999 -p /mnt -u</code>
 +
 
 +
Backup an externally mounted windows drive mountted at /media/win
 +
 
 +
<code>ts_network_backup -c 99999 -a '/media/win/Users and Settings'</code>
 +
 
 +
Back up from the first  of multiple  dd images
 +
 
 +
<code>ts_network_backup -c 99999 -a '/mnt/dd' -R -t A</code>
 +
[[Category: Tech support]]
 +
 
 +
==== Restoring Backups ====
 +
 
 +
Restore from a standard backup
 +
 
 +
<code>ts_network_backup -r 20121223-99999</code>
 +
 
 +
Restore data from a backup of a windows machine  stored in 20121223-99999-A to a folder called Old_Files on oem's  desktop
 +
 
 +
<code>ts_network_backup -r 20121223-99999-A -d -A /home/oem/Desktop/Old_Files</code>
 +
 
 +
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).
 +
 
 +
<code>ts_network_backup -r 20121223-99999-A -d -A /home/Old_Files</code>
 +
 
 +
<code>ln -s /home/Old_Files /home/oem/Desktop</code>
 +
 
 +
When restoring backups in this way make sure the files have the right permissions so that the user can read (and write) them.

Latest revision as of 16:51, 20 May 2014

deletion

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

Information remaining behind may no longer be relevant.

MIGRATOR:

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
			        packages.
				Use of this option is strongly discouraged.
	-u 			Users and data only. Does not backup/restore 
				packages. 
				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. 	


Examples

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.