Skip to content

Commit

Permalink
ad
Browse files Browse the repository at this point in the history
  • Loading branch information
guntiss committed Aug 29, 2024
1 parent 15b37ff commit 61b7d97
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions _posts/2024-07-21-rsync-backups.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,34 @@ Make sure you have set up [SSH Alias](./2024-07-22-ssh-cheats.md#ssh-aliases) fo
Importan Notes:
- If files are removed at source, they will still remain in backups machine. Add `--delete` in order to also reflect deleted files.
- After each rsync finishes it would be smart to archive received backups and keep them for necesssary period. This way you will have multiple restore points instead of one.

## Clone OS using rsync

Sometimes only option to migrate VM is using rsync.
Preconditinos:
- Target server should have same OS.
- Target server SSH key is authorized at source server

Sample rsync command to run on target server:

```sh
rsync -avzl --delete --stats --progress \
--exclude '/boot' \
--exclude '/swapfile' \
--exclude '/var/log/*' \
--exclude '/tmp/*' \
--exclude '/sys/*' \
--exclude '/proc/*' \
--exclude 'lost+found/*' \
--exclude '/etc/fstab' \
--exclude '/etc/mtab' \
--exclude '/etc/network/interfaces' \
--dry-run \
sourceserver:/ /
```

*Notes:*
- Make sure you know remote host user/pass, as sync will replace /etc/passwd and shadow files.
- Check "mount" and "df -h" output, make sure to exclude all mounted FS!
- Skip `/etc/mdadm.conf` if there is RAID set up.
- If process is halted, you can lose private key and other files (on target server), due to `--delete` flag, so use with caution.

0 comments on commit 61b7d97

Please sign in to comment.