backup system with rsync

first step

  • /etc/fstab

    /dev/sda7    /                        ext4 defaults     0 0
    /                     /opt/ubuntu   ext4 bind            0 0
    
  • /etc/rsyncd.conf

[os]
        comment = public archive
        path = /var/www/pub/backup-os
        use chroot = yes
        lock file = /var/lock/rsyncd
        read only = yes
        list = yes
        uid = nobody
        gid = nogroup
        strict modes = yes
        ignore errors = no
        ignore nonreadable = yes
        transfer logging = no
        timeout = 600
        refuse options = checksum dry-run
        dont compress = *.gz *.tgz *.zip *.z *.rpm *.deb *.iso *.bz2 *.tbz

backup

cp -av /opt/ubuntu /var/www/pub/backup-os

restore

rsync -hvarAEHXi –stats –progress –numeric-ids root@localhost_ip::os /opt/ubuntu –delete

你可能感兴趣的:(backup system with rsync)