Diferencia entre revisiones de «Rsync»

De gacq wiki
Saltar a: navegación, buscar
(Backup using rsync and ssh)
(Backup using rsync and ssh)
Línea 52: Línea 52:
 
  su - rbackup
 
  su - rbackup
 
  mkdir -p /home/rbackup/.ssh
 
  mkdir -p /home/rbackup/.ssh
  chmod 600 /home/rbackup/.ssh
+
  chmod 700 /home/rbackup/.ssh
 
  chown -R rbackup.root /home/rbackup
 
  chown -R rbackup.root /home/rbackup
  

Revisión del 13:37 22 sep 2006

Most used options

-a, --archive               archive mode; same as -rlptgoD (no -H)
 -r, --recursive             recurse into directories
 -l, --links                 copy symlinks as symlinks
 -p, --perms                 preserve permissions
 -t, --times                 preserve times
 -g, --group                 preserve group
 -o, --owner                 preserve owner (super-user only)
 -D                          same as --devices --specials

-v, --verbose               increase verbosity
-u, --update                skip files that are newer on the receiver
-z, --compress              compress file data during the transfer
-e, --rsh=COMMAND           specify the remote shell to use
-h, --human-readable        output numbers in a human-readable format
    --progress              show progress during transfer
--bwlimit=KBPS          limit I/O bandwidth; KBytes per second
--exclude-from=FILE     read exclude patterns from FILE

My notebook syncronization

gacq.com-get

echo Receiving.....
rsync -avuze 'ssh -p 22' --delete anysyncuser@myserver:/srv/gacq/rsync/ rsync

gacq.com-put

echo Sending.....
rsync -avuze 'ssh -p 22' --delete rsync anysyncuser@myserver:/srv/gacq/

Duplicando una maquina con rsync

rsync -v -r -p -o -g -D -t -S -l -H \
--exclude /mnt/   \
--exclude /proc/ \
--exclude /tmp/ \
--exclude /home/ / /mnt/fireball/

Boot from a CD-ROM and mount the target-disk. Fix fstab and lilo.conf. Create /mnt and /proc and set the right permissions (for this directories). Then run lilo and reboot. Next time you run rsync, add these option to the command-line:

--exclude /etc/fstab \
--exclude /etc/lilo.conf \
--delete 

Backup using rsync and ssh

Host to backup (as root)

useradd -g 0 -G daemon,dip,lpadmin,shadow,sasl rbackup
passwd rbackup
su - rbackup
mkdir -p /home/rbackup/.ssh
chmod 700 /home/rbackup/.ssh
chown -R rbackup.root /home/rbackup

Backup server (as root)

ssh-keygen -t dsa -f rhost-id_dsa
scp rhost-id_dsa.pub rbackup@rhost:.ssh/authorized_keys
# test
ssh -i rhost-id_dsa.pub rbackup@rhost


backup script

rsync -auzh \
 -e "ssh -l root -i host-id_dsa" \
 --delete \
 --include="/etc" \
 --include="/root" \
 --include="/usr/local/scripts" \
 --exclude="/*" \
 host:/ .

ssh -i host-id_dsa root@host "/usr/bin/dpkg --get-selections" > dpkg--get-selections.txt