Backing Up and Restoring Data


If you've worked with computers for any length of time, you've probably discovered why making regular backups is important. Specifically, if you haven't backed up your data, you're going to lose it.

To back up data using tar:

  • tar -czvf archive.tar.gz filesordirs

    Where archive.tar.gz is the name of the archive you'll be creating, and filesordirs is a list of one or more files or directories to include in the archive.

    Tracking Security Advisories

    US-CERT (U.S. Computer Emergency Readiness Team) tracks the spread of security exploits (including viruses, worms, Trojans, root compromises, and so on) around the Internet, their danger level, and the response, if any, of vendors, such as a patch or work-around. As a system administrator, you would be wise to pay attention to US-CERT in case any of the many new and exciting problems discovered almost weekly affect the software you're running.

    At the US-CERT Web site (www.us-cert.gov), you can find major announcements, notification of current security exploit activity, and information on how to prepare for and respond to problems (Figure 4.1).

    Figure 4.1. The US-CERT Web site tracks network-security issues worldwide.


    If you join the US-CERT mailing list through the Cyber Security Alert System (www.us-cert.gov/cas/signup.html), you'll get emails about new exploits and security patches. You'll also want to install any security patches for your operating system, servers (including Web, email, and FTP if you have them installed), and other software. The CERT advisories will almost always point you toward an appropriate patch.


    The -czvf options are, in order: create an archive, compress the archive, be verbose, and store the archive data in the file specified by the next argument.

To restore data using tar:

  • tar -xpzvf archive.tar.gz

    Where archive.tar.gz is the name of an existing archive created with tar. This extracts the files and directories in archive.tar.gz into the current directory.

    The -xpzvf options are, in order: extract the contents of an archive, preserve ownership and permissions, read compressed archives, be verbose, and read the archive data from the file specified by the next argument.

To back up data using dd:

  •  dd bs=1M if=in-path |  gzip > out-path.gz 

    This dumps in-path (which can be a file or a device) through gzip, one mega byte at a time. The gzip command compresses the data, which is then stored in out-path.gz.

    Using dd this way, you can make an exact backup of a device, such as a disk partition.

To restore data using dd:

  •  gzcat in-path.gz |  dd bs=1M of=out-path 

    This decompresses in-path.gz and sends it through dd. The dd command writes the data to out-path, one megabyte at a time.

Tip

  • Be very careful with dd; you can easily destroy the contents of your hard drive by feeding it the wrong arguments. For example, accidentally swapping the of= and if= arguments could overwrite your file, the contents of a device, or your backup data.




    Unix Advanced. Visual QuickPro Guide
    Unix Advanced: Visual QuickPro Guide
    ISBN: 0321205499
    EAN: 2147483647
    Year: 2003
    Pages: 116

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net