Backup can be performed against mission critical file systems and files within IT infrastructure.
It contains two elements :
---------------------------------------
- storage place
- backup software
Storage place for backed up objects can be :
-----------------------------------------------------------------
- magnetic tape device (streamer)
- file server(NFS,SAMBA) with RAID (software/hardware) disks accessed by using NAS network
- hardware disk array accessed by using SAN network (iSCSI, FC)
- cd/dvd disk
- flash drive
- TMS (tape management system)
Backup software :
---------------------------
- TSM (Tivoli Storage Manager)
- Symantec BackupExec
- rsync
- rcp
- dump
- etc
Archiving software :
---------------------------
- tar (only archives)
- jar (compresses + archives)
- compress/uncompress/zcat/gzcat (only archives)
- gzip/gunzip/gzcat (only compresses)
- zip/unzip (compresses + archives)
TAR (tape archive)
Allows to create, extract file from a file archive or any removable media such as tape or diskette.
The tar command archives files to and extracts files from a single file called a tar file. The default device for a tar file is a magnetic tape device.
SYNTAX :-------------------
tar functions archivefile filenames
Function | Definition |
|---|---|
c | Creates a new tar file. |
t | Lists the table of contents of the tar file. |
x | Extracts files from the tar file. |
f | Specifies the archive file or tape device. The default tape device is /dev/rmt/0. If the name of the archive file is "-", the tar command reads from the standard input when reading from a tar archive or writes to the standard output if creating a tar archive. |
v | Executes in verbose mode, writes to the standard output. |
h | Follows symbolic links as standard files or directories. |
Usage scenario :
---------------------
1. creating home directory archive on a tape
$ cd
$ mt -f /dev/rmt/0 status
$ tar cvf /dev/rmt/0 .
2. create tar archive with multiple files
$ cd
$ tar cvf files.tar file1 file2 file3
3. viewing an archive from a tape
$ tar tf /dev/rmt/0
4. viewing files i narchive file
$ tar tf files.tar
5. retrieving files from a tape device
$ tar xvf /dev/rmt/0
6. retrieving files from archive file
$ tar xvf files.tar
JAR
Combines multiple files into single archive file and then compress the file. It copies and then compresses files into single archive file.
This tool is standard feature of SOLARIS 10 and is available on any system that uses JVM (java virtual machine).
SYNTAX :
-------------------
jar options destination filenames
The table shows the options you can use with the jar command.
Option | Definition |
|---|---|
c | Creates a new jar file. |
t | Lists the table of contents of a jar file. |
x | Extracts the specified files from the jar file. |
f | Specifies the jar file to process (for example,/tmp/file.jar). The jar command sends the data to the screen (stdout) if the f option is not used. |
v | Executes in verbose mode. |
-------------------------------
compress and archive files into single archive file
$ ls
dante dir2 dir5 file.2 file3 fruit tutor.vi
dante_1 dir3 file.1 file2 file4 fruit2
dir1 dir4 file1 file.3 files.tar practice
$ jar cvf /tmp/bundle.jar *
added manifest
adding: dante(in = 1319) (out= 744)(deflated 43%)
adding: dante_1(in = 368) (out= 242)(deflated 34%)
adding: dir1/(in = 0) (out= 0)(stored 0%)
adding: dir1/coffees/(in = 0) (out= 0)(stored 0%)
adding: dir1/coffees/beans/(in = 0) (out= 0)(stored 0%)
adding: dir1/coffees/beans/beans(in = 12288) (out= 3161)(deflated 74%)
adding: dir1/coffees/nuts(in = 0) (out= 0)(stored 0%)
adding: dir1/coffees/brands(in = 0) (out= 0)(stored 0%)
adding: dir1/fruit/(in = 0) (out= 0)(stored 0%)
adding: dir1/trees/(in = 0) (out= 0)(stored 0%)
... (output truncated)
COMPRESS / UNCOMPRESS / ZCAT / GZCAT
compress command is used for compressing storage space occupied by files. The amount of compression depends on file type, typically compression of text file reduces its size 50-60 %.
SYNTAX :
---------------
compress [-v] file
Usage scenario
1. compress file named dante
$ compress dante
When compression is complete, the compressed file has .Z extension.
2. compress archived tar file
compress -v files.tar
It will substitute files.tar by files.tar.Z file. Dash v is for verbose mode.
3. view compressed file with compress command
$ zcat dante.Z OR $ zcat dante.tar.Z | tar xvf -
4. uncompress file
$ uncompress -v files.tar.Z
5. view compressed file with compress command
uncompress -c files.tar.Z | tar tvf -
6. view compressed file with compress command
gzcat files.tar.Z
GZIP / GUNZIP
gzip command uses Lempel-Ziv (LZ77) algorithm to compress size.
SYNTAX
-----------------
gzip [-v] filenames
Usage scenario
------------------------------
1. compress 4 files
$ gzip file1 file2 file3 file4
$ ls
file1.gz file2.gz file3.gz file4.gz
2. restore gzip file
gunzip file4.gz
3. viewing the content of compressed file
gzcat file4.gz
ZIP / unzip
zip command compresses and archives multiple files into single file.
SYNTAX
-----------------
zip target_filename source_filenames
Usage scenarios
1. compress and archive file into single file
zip files.zip file1 file2
2.view files in archived file
unzip -l files.zip
3. uncompress the contetn of archived file
unzip files.zip
RCP
rcp is remote copy protocol and is not he best way to copy files between two systems.
SYNTAX
---------------------
rcp source_file hostname:destination_file
OR
rcp hostname:source_file destination_file
OR
rcp hostname:source_file hostname:destination_file
Usage scenario
------------------------------
1. copy local file1 to another host
$ rcp file1 host1:/tmp
2. copy remote file file1 to local host
$ rcp host1:/tmp/file1 file1
3. copy recursively directories
rcp -r ~/perms host1:/tmp
RSYNC
DUMP