Thursday, 26 April 2012


Some backup utilities in Linux and their usage
----------------------------------------------

dump---suitable for archiving the entire file system
tar,cpio,afio--suitable for archiving specific files or directories.


dump & restore
**************
Dumping file system
-------------------
dump 0uf   /dev/nst0  /home
dump 0uf bkpfile_name /home

0--level full backup
u--update /etc/dumpdates
f--archive file.


Restoration
-----------
cd /directory where to  restore
eg:cd /home

restore rf /dev/nst0
restore rf bkpfile_name

r--Extract the contents of the whole archive in the current directory.
f--archive file.

tar
*********
Backing up
----------
tar cvf /dev/nst0   /home
tar cvf bkpfile_name /home

Restoration
-----------
tar xvf /dev/nst0
tar xvf bkpfile_name


cpio
************
Creating Archive
-----------------
find /home | cpio -o -H tar -F /dev/nst0
find /home | cpio -o -H tar -F bkpfile_name
find /home | cpio -o -H tar > bkpfile_name

Restoring Archive
------------------
cpio -imv -F /dev/nst0
cpio -imv -F bkpfile_name

o--create archive
H--format
F--archive file name
i--restore archive
m--preserve modification time
v--verbose
----------------------------------------------------------------------------------------------------------------------------------
cpio works like tar but it can read input from the "find" command. This is nifty feature. For example you can find out all *.c files and backup with cpio command.# find / -name "*.c" | cpio -o --format=tar > c-file.backup.tar
# find / -iname "*.pl" | cpio -o -H tar > perl-files.tar

You can also specify file name using -F option:# find / -iname "*.pl" | cpio -o -H tar -F perl-files.tar
----------------------------------------------------------------------------------------------------------------------------------
Backup /home dir, to remote system tape drive:
# find /home | cpio -o -H tar -F user@backup.nixcraft.in:/dev/nst0 --rsh-command=/usr/bin/ssh







No comments:

Post a Comment

Kubernetes cluster setup on Ubuntu 26.04 using Kubeadm

Step1: Disable swap memory: Kubernetes requires swap to be disabled for the kubelet to function correctly # swapoff -a # sudo sed -i '/...