User Tools

Site Tools


computing:rsyncrsnapshot

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
computing:rsyncrsnapshot [2019/04/14 23:31] oemb1905computing:rsyncrsnapshot [2019/07/31 09:57] oemb1905
Line 7: Line 7:
 ------------------------------------------- -------------------------------------------
  
-  sudo rsync -avxHAX --progress --delete /sourcefiles/path /backup/path+Using alternate port and the old syntax for that:
  
-Adding //h//, //H//, //P//, will preserve hard links, give you human readable output, and show the progress (eliminating the need for --progress).+From remote server to target backup localhost:
  
-  sudo rsync -avxHAXhHP --delete /sourcefiles/path /backup/path +  rsync -av --delete -e 'ssh -p 59333 -i /home/user/.ssh/id_rsa' user@10.8.9.3:/home/user/Server/ /home/user/Server/
-   +
-Cloning entire drives, use:+
  
-  sudo rsync -avxHAXhHP --delete /sourcefiles/path /backup/path --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found} +From localhost to target remote backup server
-   +
-If the drive you are cloning from has a different filesystem than the destination drive, you can remove the exclusions as //-x// will handle those exclusions in that case.  After cloning, you will need to adjust fstab on the destination partition:+
  
-  cd /etc/ +  rsync -av --delete -e 'ssh -p 59333 -i /home/user/.ssh/id_rsa' /home/user/Server/ user@10.8.9.3:/home/user/Server/
-  sudo nano fstab +
-  <Edit the drive UUID of the new destination drive>+
      
-Now, make the destination volume bootable:+-- -- -- -- -- 
  
-  grub-install /dev/sdX +Using the more modern syntax and no alternate portwe have:
-   +
-If you are using this method to clone your existing server to another hard drive on the same host, then make sure to run //grub-update// on the primary OS.  After you do that, both the kernels for the primary OS and the cloned OS will appear in GRUBand you can boot into the clone, specifically, to make sure that everything migrated properly and is in working order.  It is not sufficient to simply run rsync and hope that all went well.+
  
-rsync over ssh+From remote server to target backup localhost:
  
-  sudo rsync -avHe --delete -e 'ssh -p 53213' user@172.39.58.38:/home/Archives/ . +  sudo rsync -avi --delete root@server.com:/home/location/of/mysqldump.sql /home/user/backup/of/mysqldump.sql 
-  sudo rsync -avWeqr --delete -e 'ssh -p 59999' /home/source/ user@10.18.18.2:/media/sdb1/back/ +
-   +
-That last one works perfectly ... but no matter what, I was having it prompt me for a password despite normal ssh working fine without one+
  
-[Update]+From localhost to target remote backup server: 
  
-Here is how I got rsync over pub key authentication (no password prompt) working properly on Debian 9.7 This is an answer on Stack Exchange:+  sudo rsync -avi --delete /home/user/backup/of/mysqldump.sql root@server.com:/home/location/of/mysqldump.sql 
 +  
  
-The examples provided as answers here either provide an alternate solutions or make the official solution unclear. Here are two examples with explicit path examples and entries so people can adjust for their needs without interpreting obtuse bash notation: 
- 
-Execute this from the target backup machine, which pulls from source to target backup 
- 
-  rsync -av --delete -e 'ssh -p 59333 -i /home/user/.ssh/id_rsa' user@10.1.999.3:/home/user/Server/ /home/user/Server/ 
- 
-Execute this from the source machine, which sends from source to target backup 
- 
-  rsync -av --delete -e 'ssh -p 59333 -i /home/user/.ssh/id_rsa' /home/user/Server/ user@10.1.999.3:/home/user/Server/ 
- 
-Since ssh public key authentication is a requirement for this question's answer, the solution is in telling rsync where to locate the private key, that matches an authorized public key on the destination server. You can create specific ssh keys on each end if you are a security freak, or even distinct keys just for the rsync use that differ from your user. But this is a bit complicated and not needed if these hosts are behind a firewall on a secure LAN. In that case, I recommend using the same ssh public/private keypair on both machines. 
- 
-Also, I might add that the initial rsync flags, are to an extent, optional, but the specific arrangement `-avWeqr`, was needed for me in order to get `--delete` working properly with all the other parameters. These were tested on Debian 9.7 and work. 
  
 This tutorial is a designated "Invariant Section" of the "Technotronic" section of Haack's Wiki as described on the [[https://jonathanhaack.com/dokuwiki/doku.php?id=start|Start Page]]. This tutorial is a designated "Invariant Section" of the "Technotronic" section of Haack's Wiki as described on the [[https://jonathanhaack.com/dokuwiki/doku.php?id=start|Start Page]].
  
- --- //[[netcmnd@jonathanhaack.com|oemb1905]] 2019/04/09 19:26// + --- //[[oemb1905@jonathanhaack.com|oemb1905]] 2019/07/31 09:53//
      
computing/rsyncrsnapshot.txt · Last modified: 2023/04/10 21:29 by oemb1905