tar -xvf filename.tar foldername/
-compress a folder ===> tar -pczf web.tar.gz /var/www/html
4-april-2010 on sahabat pc router.
tar -pczf hotpotcontrol2`date +%d_%m_%Y_hour_%H_%M`.tar.gz hotspot-control2/ mysql/ radius/
tar split large file
1. compress the folder/files to .tar.gz
2. tar -cvj /home/zahari/joomla15.tar.gz | split -b 6m -d – “joomla15split.tar.bz.”
eg> tar -cvj /home/zahari/hotspotnet/joomla15.tar.gz | split -b 6m -d - "joomla15split.tar.gz."
to recover as follows:
cat large-files.tar.bz.* > large-files.tar.bz
tar -xvj large-file.tar.bz
tar create file with date and time
tar -pcfz /home/zahari/mysql-backup-tar/mysql_`date +%d_%m_%Y_hour_%H_%M`.tar.gz /home/zahari/mysql-backup/*
rsync from cherasnet to bintangmas host
rsync -v -e ssh zahari@cherasnet.com:~/mysql-backup-tar/* /home/zahari/mysql-backup
Identify the server that initially contains the files (we will call this the SOURCE server), and the serverto which you want to transfer the files (we will call this the TARGET server). Confirm that you can log in to the SOURCE server, that you can log in to the TARGET server, and that while logged into the TARGET server, you can use ssh to login to the SOURCE server using your password.
Step
2
Log into the TARGET server. Execute the command
[mikeular@targethost~]$ ssh-keygen -t dsa
ssh-keygen will ask you where you want to save the key. Accept the default directory, which will be ~/.ssh/id_dsa . Next it will ask you for a passphrase, leave this entry blank.
Your private key file will be saved to ~/.ssh/id_dsa and your public key will be saved to ~/.ssh/id_dsa.pub. Careful! Anyone who obtains a copy of your id_dsa file will be able to login to the SOURCE server as you, without authenticating themselves. Make sure that it's stored securely!
Step
3
Now you will configure the SOURCE server to accept the key. Once this step is complete, anyone with the id_dsa file will be able to log into the SOURCE server without providing a password.
Log into the SOURCE server and create the ssh directory:
[mikeular@sourcehost~]$ mkdir ~/.ssh
[mikeular@sourcehost~]$ cd ~/.ssh
Using vi or another text editor, create a file in ~/.ssh named authorized_keys2 . Now switch over to the TARGET server and copy the contents of the file id_dsa.pub and paste them into authorized_keys2 on the SOURCE server. Save the text file.
Step
4
Make sure that the authorized_keys2 cannot be changed by other users on the SOURCE server:
[mikeular@sourcehost~]$ chmod 644 ~/.ssh/authorized_keys2
Step
5
Now you can test your setup. Go back to the TARGET server and connect to the source.
[mikeular@targethost~]$ ssh username@sourcehost.com
[mikeular@sourcehost~]
Your ssh connection is now working correctly.
Step
6
Test your rsync over ssh connection by copying a file from SOURCE to TARGET. Enter the following command all on one line, being sure to substitute in the correct pathnames, username, and hostname.
[mikeular@targethost~]$ rsync -avz -e/usr/bin/ssh username@sourcehost.com:/home/username/testfile /home/mikeular/
This should copy the file "testfile" from your home directory on sourcehost to your home directory on targethost.
Step
7
move backup from cheasnet.com to kudaspot.homeip.net
rsync -v -e ssh zahari@cherasnet.com:~/mysql-backup-tar/* /home/zahari/mysql-backup
============================================
matahari backup job
1) backup whole harddisk with tar
sudo tar cvpzf backup.tgz --exclude=/proc --exclude=/lost+found --exclude=/backup.tgz --exclude=/mnt --exclude=/sys /
sudo tar cvpzf backup.tgz --exclude=/proc --exclude=/lost+found --exclude=/home/zahari/backup-sda1 --exclude=/mnt --exclude=/sys / &
sudo tar -pcvj /home/zahari/backup-sda1/mybackup.tar.gz | split -b 20M -d - "mybackup-split.tar.gz"
-------------------
split file
tar -pcvj backup.tgz | split -b 30M -d - "backup.tgz."
===========================================================
CHERASNET(mandrake10.2 Productuion server) backup to 20GB external harddisk connected to usb adaptor
the job is to backup partition hda1-->sda1(external usb harddisk) and hda6 to sda6(external usb Harddisk)
[root@myap-1 httpd]# df
Filesystem Size Used Avail Use% Mounted on
/dev/hda1 7.4G 4.2G 3.0G 59% /
/dev/hda6 11G 3.4G 7.2G 32% /home
/dev/sda1 6.8G 4.2G 2.4G 65% /mnt/sda1
/dev/sda6 12G 3.4G 8.0G 30% /mnt/sda6
[root@myap-1 httpd]#
type fdisk -l
Disk /dev/sda: 20.8 GB, 20847697920 bytes
64 heads, 32 sectors/track, 19881 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 7058 7227376 83 Linux
/dev/sda2 7059 19881 13130752 5 Extended
/dev/sda5 7059 7536 489456 82 Linux swap
/dev/sda6 7537 19881 12641264 83 Linux
[root@myap-1 httpd]#
use fdisk to partition the new sda to match the partition of running disk /dev/hda
------------------------------------
mount /dev/sda1 /mnt/sda1
mount /dev/sda6 /mnt/sda6
-------------------------------------
prepare file excludes.cfg
touch /mnt/excludes.cfg, nano /mnt/excludes.cfg and put in the followings
/proc/
/tmp/
/mnt/
/etc/fstab
#/var/cache
/lost+found
/var/cache/httpd/
/usr/local/squid2.7/var/cache/
save and exit nano
start copying now
rsync -avx --exclude-from=/mnt/excludes.cfg --delete // /mnt/sda1 &
rsync -avx --exclude="lost&found" /home/ /mnt/sda6 &
========================================================
using mc to ftp files from sahabat to jebat
F9--->RIGHT--->shell link
jebat@pcrouterjebathotspot.homelinux.com
Tiada ulasan:
Catat Ulasan