Dump Usage

From Gruff Goat Wiki
Jump to: navigation, search

Dump used with pipes is a very powerful and effective way to backup your filesystems.

GGIS Shell Script

I use the following script to dump most of my servers, ggis_dump.sh

Dump of filesystem to remote file using ssh and gzip

 /sbin/dump -0uLan -f - /filesys | gzip -2 | ssh -c blowfish \
    user@target.com dd of=/dir/dump.gz

Explanation

 /sbin/dump    # Dump command with switches
     -0        # Dump level, 0-9. 0 is full backup. Others are incremental
               # Use 0 monthly, 1 weekly and the dailies by 3 2 5 4 7 6 9
     -u        # Update the dumpdates file after a successful dump
     -L        # Dump a live filesystem
     -a        # Auto-size. Use to write a single file.
     -n        # Notify operator
     -f        # Write to file, filename follows
     -         # Standard output
     /filesys  # Filesystem to dump, view all mounted filesystems with df
 | gzip        # Pipe standard output through gzip
     -2        # Level of compression, 1 is fastest, 9 is smallest
 | ssh         # Pipe output of gzip to ssh
   -c blowfish  # Encrypt the session using the Blowfish cipher. Fast.
   user@target.com  # Username and target server name. Connect will ask for password.
 dd            # Run the dd command to copy standard input to standard output
   of=/dir/dump.gz  # Write output to named file instead of standard output

Dump of filesystem to local file using gzip

 /sbin/dump -0uLan -f - /filesys | gzip -2 > /path/to/dump.gz

or in batch mode

 batch
   /sbin/dump -0uLan -f - /filesys | gzip -2 > /path/to/dump.gz
   ctrl d

Reference

Backup Basics