Networking

Unix and Linux network configuration. Multiple network interfaces. Bridged NICs. High-availability network configurations.

Applications

Reviews of latest Unix and Linux software. Helpful tips for application support admins. Automating application support.

Data

Disk partitioning, filesystems, directories, and files. Volume management, logical volumes, HA filesystems. Backups and disaster recovery.

Monitoring

Distributed server monitoring. Server performance and capacity planning. Monitoring applications, network status and user activity.

Commands & Shells

Cool Unix shell commands and options. Command-line tools and application. Things every Unix sysadmin needs to know.

Home » Backups

Command-line backup methods

Submitted by on November 22, 2005 – 6:01 pm 3 Comments

The following is a brief overview of standard Unix comman-line utilities used for data backup on Solaris systems. Most of the information below is also applicable to other unixoid systems.

Common backup/copy methods:

tar | gzip

Basic syntax for creating *.tar.gz archive is:

tar cvf - . | gzip > target.tar.gz

Common tar options include:

-c: Create a tar file
-t: List the contents of a tar file
-x: Extract or restore a tar file
-v: Verbose

Examples:

Create tar file of /etc/mail:

cd /etc
tar cvf mail.tar mail

Extract contents of mail.tar file to /backup/mail directory:

cd /backup
tar xvf mail.tar

pax

Copy files from the current directory to tape:

pax -w -f /dev/rmt/0

Show tape contents:

pax -v -f /dev/rmt/0

dd

dd is commonly used to copy disk slices and entire disks. Here’s an example that will copy disk c0t0d0 to the disk c0t1d0:

dd if=/dev/rdsk/c0t0d0s2 of=/dev/rdsk/c0t1d0s2 bs=128

If you are looking to make a copy of the boot disk, check out this script.

ufsdump | ufsrestore

These two commands are used in concert to duplicate filesystems. Take a look at this script that uses ufsdump | ufsrestore to duplicate boot disks.

cpio

Copy /var and its contents to /var2:

find /var -depth -print | cpio -pudm /var2

Copy directory and its contents to tape:

ls -R | cpio -oVc > /dev/rmt/0

Copy tape backup back to directory:

cpio -icvD < /dev/rmt/0

Copy directories and files contained in the “list” to tape:

cpio -ov list > /dev/rmt/0

Restore data from tape while preserving timestamps:

cpio -icvum < /dev/rmt/0

Read contents of the tape:

cpio -ict < /dev/rmt/0

volcopy (Solaris-specific)

This example will copy the /export/home filesystem from disk c0t0d0 to disk c0t0d1

volcopy -F ufs /export/home  /dev/rdsk/c0t0d0s3 - /dev/rdsk/c0t0d1s3  -
Print Friendly, PDF & Email

3 Comments »

  • soccermaster1 says:

    WinRar v3.61 – Rar.Exe

    Archive name : C:BackupAccounts.Exe
    Files to be stored : E:Accounts*.* (also sub directories)
    Archive format : Rar
    Compression method : Best
    Split to volumes : 700 mb
    Update mode : Add & replace
    Archiving options : Create SFX archive
    Create solid archive
    Put authenticity verification
    Put recovery record
    Test archive files
    Lock archive
    NTFS options : Save file security
    Save file streams
    File paths : Store full paths
    Backup options : Clear attribute “Archive” after compressing
    File time to store : Store last access time
    Files to process : Of any time
    Set archive time to : Latest file time

  • dubmecrazy3 says:

    I have uploaded a .tar.gz file to a web server using FileZilla Client, but I want to know … is there a way to unzip/expand the file that I already uploaded? Because when I unzip it on the computer first it takes forever to upload. :(

    Help please :) Thanks!

  • Mr SoLo DoLo says:

    The commands are:

    CP

    CP –HELP

Leave a Reply

%d bloggers like this: