Backing Up And Restoring Files
- Backing Up and Restoring Files.
rsync -av /home/basil /backup/homes/
Note that there is no traling slash after basil, trailing / will copy all the files under the directory basil instead of the directory basil.
The (-a) option above preservs all the permissions,ownership, creation time.
rsync -avz -e ssh /home/basil 192.168.0.11:/backup/homes/
-z, --compress
With this option, rsync compresses any data from the files that
it sends to the destination machine. This option is useful on
slow connections. The compression method used is the same
method that gzip uses.
-e, --rsh=COMMAND
This option allows you to choose an alternative remote shell
program to use for communication between the local and remote
copies of rsync.
- How to do auto backup using cron.
Add a file called backup to /etc/cron.daily/, set the permission to 755, and add the command line to the file. This will enable us to do daily backup of the directories above.
If you would like to enable the auto backup to a remote server, then, we need to setup ssh, scp, sftp without password to login.
- Password-less authentication.
Localmachine: basil
Remotemachine: trinity
[basil@localhost ~]$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/basil/.ssh/id_dsa):
/home/basil/.ssh/id_dsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/basil/.ssh/id_dsa.
Your public key has been saved in /home/basil/.ssh/id_dsa.pub.
The key fingerprint is:
d2:e6:c7:6c:18:ad:06:b2:0e:eb:08:57:7a:0b:77:3c basil@localhost
[basil@localhost ~]$
Just press Enter on each request. And then copy the key to the remote machine trinity, On the remote machine `mkdir .ssh; chmod 0700 .ssh`
[basil@localhost .ssh]$ scp id_ds
id_dsa id_dsa.pub
scp id_dsa.pub trinity@192.168.0.11:/home/trinity/.ssh/authorized_keys2
[trinity@localhost ~]$ ls -ld .ssh
drwx------ 2 trinity trinity 4096 Jun 15 17:15 .ssh/
Check..
http://mikerubel.org/computers/rsync_snapshots
- Ftape-tool package
http://metalab.unc.edu/pub/Linux/Kernel/tapes/
*Writing to CD's
Create an ISO9600 file system of the directory /home/basil
$ mkisofs -R -o /var/basil.iso /home/basil
[basil@localhost ~]$ cdrecord -scanbus
scsibus1:
1,0,0 100) 'ATAPI-CD' 'ROM-DRIVE-52MAX ' '52DI' Removable CD-ROM
1,1,0 101) 'ATAPI ' 'CD-RW 52X24 ' 'F.CZ' Removable CD-ROM
1,2,0 102) *
1,3,0 103) *
1,4,0 104) *
1,5,0 105) *
1,6,0 106) *
1,7,0 107) *
$ cdrecord -v speed=2 dev=/media/cdrecorder -data /var/basil.iso [for ATAPI]
$ cdrecord -v speed=2 dev=1,1,0 -data /var/basil.iso [for IDE]