Você está na página 1de 4

Different Types of Backup in LINUX/UNIX

Backup:
Backup is used to prevent the data lost.
Copy data to alternative media
Only Adiministrator can backup the data

Back up media:
Cd ,dvd, Brd, pen drive , hard disk ,zip drive , tape drive etc.
The type of data and backup devices depends on the administrators on the company policies.
We have 3 types of Backups
1.Full Backup or Monthly Backup
2.Incremental Backup or Daily Backup
3.Differential Backup or Daily Backup
Full Backup:
Here total backup of the file system is taken . It doesnt consider any modification date and time. If we apply
this backup all the files are taken in to backup media. Disadvantages of this backup is it doesnt consider the
modification date and time of files and directories.Hence space of the backup device will be wasted.
Incremental Backup:
It includes all files that were changed since the last full backup. Incremental Backup depends upon the
modification date & time.
Differential Backup:
It doesnt depends upon the modification date & time.
Commands for backup
1.Tar Backup
2.Cpio Backup
3.dd Backup(disk to disk) and
4.dump Backup
5.Remote Backup
Using Tar Backup
#tar {option} {destination} {source}{/source}{/destination}{/option}
Options:-
-c create
-v verbose
-f - file
-t - table of content
-x extract
-z Zip
To take backup example:
#mkdir Linux
#cd Linux
#touch 1 2 3 4 5
#mkdir /dev/st0
#tar -cvf /dev/st0/b1.tar Linux
To view table of contents
#tar -tvf /dev/st0/b1.tar
To remove data
#rm rf Linux
To recovery or restore the data
#tar xvf /dev/st0/b1.tar
To extract Backup data to the perticular folder
#tar xvf /dev/st0/b1.tar -C /root
How to take Zip Backup with tar
#tar -cvzf /dev/st0/c1.tar
How to restore
#tar -zxvf /dev/st0/c1.tar
CPIO:Copy Input / Output.
#cpio {source} | cpio {option} {controller} {destination}
Options:
-o out
-i in
-c create
-t - table of backup content
-v verbose
-f - file
How to take the CPIO Backup:
It is having two methods.
i) In Relative Method
ii) Absolute Method
This backup we can take storage medias and CD/DVDs.
I am taking the backup in my pc so first creat backup directory in your PC.
#mkdir /cpio
#cd /cpio
1)How to Take the CPIO Backup in In Relative Method:
first create the Files which you want to take the backup.
#touch a{1..10}
To take the backup:
#ls * | cpio -ocvf >/dev/st0/relative.cpio
To see the Backup whether it is created or not.
#cd /dev/st0
#ls
To See the Backup Content:
#cpio -itvf
To remove the old files
#rm -rf *
To extract or restore the Backup:
#cpio -icvf
2) how to take the Backup in Absolute Method:
first create some files in your directory
ex:
#mkdir /cpio
#cd /cpio
#touch b{1..10}
#ls (to see the creating files)
Now take the backup using find command:
#find /cpio | cpio -ocvf >/dev/sto/absolute.cpio
See the backup content:
#cpio -itvf >/dev/st0/absolute.cpio
Remove the old files along with directory
#cd
#rm -rf /cpio
#ls (here there is no files)
To extract or restore the backup now:
#cpio -icvf >/dev/st0/absolute.cpio
#ls (here you can see the restoring or backup files).
DD (disk to disk)
It is used to take backup one hard disk to another harddisk .
#dd if ={source file} of = {destination file}
Dump
#dump -0uf /dev/st0/dump1 /dev/hda6
To recovery
#restore -rvf /dev/st0/dump1
Dump Backup
Using the Dump Backup we can take 3 types of backup Full, Differential & Incremental Backup
1.Full Backup 2. Incremental Backup 3. Differential Backup.
With this command we dont need to unmount the Partition to take the backup.
How take the Dump Backup
#dump -0uf /dev/st0/dump1 /dev/hda6 (here 0-indicate Full Backup)
1-9 (here replace of Zero)Indicates Incremental / Differential Backup
How to restore the Backup
#restore -rvf /dev/st0/dump1 (r- Recursive, v- Verbose, f- file)
To check the Dump Updates
#cat /etc/dumpupdates
Remote Backup
1. How to take the Backup with rsync
rsync -avg {source} -e ssh {destination Ip}:{path}
Ex #rsync -avg a* -e ssh 192.168.0.1:/mnt
How to restore the backup
rsync -avg -e sh {destination Ip}:{path} {source path}
Ex: #rsync -avg -e ssh 192.168.0.1:/mnt/a* /mnt
2. How to take the Backup with scp (scp Secure Copy)
#scp -r {source} ssh {destiation ip}:{path} {source}
How to restore
#scp -r ssh {destination Ip}:{path} {source path

Você também pode gostar