LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 03-21-2020, 12:15 AM   #1
bsurfin
Member
 
Registered: May 2004
Location: Kalispell Montana
Distribution: Ubuntu 18.04LTS
Posts: 143

Rep: Reputation: 16
Cool could someone "please" check 2 rsync commands I'm not sure the structure is right.


I've been working on this for 2 weeks, I'd like someone that knows what they are doing with rsync to tell me if this should work on my Ubuntu 18.04 machines.

This works great, for making a backup and keeping it in sync exactly as it is on the server, same permissions and everything, I figured this out a couple years ago, it has worked perfect.
sudo rsync -r -t -p -o -g -v --progress --delete -l -H -D -s /mnt /media/jason/USB Backup/Backup
I noticed the format is sudo rsync options /source /target


I Modified the rsync commands I found on the internet below, I noticed that these have the / as the source directory in the middle of the options, or do I need to move that towards the end right before the destination directory ? this is why rsync is confusing so far, everyone seems to do it a little different, should these work ?

this one to backup my laptop:
sudo rsync -aAXv / --delete --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found",”swapfile”,”.encryptfs”} /target


This one to help me turn my server into a virtual server, by copying the following to the guest HDD with a fresh ubuntu 18.04 install on my kvm server:
sudo rsync -auHxv / --exclude={"/etc/fstab*","/etc/network/*","/proc/*","/tmp/*","/sys/*","/dev/*","/mnt/*","/boot/*","/root/*",”swapfile”,"/lost+found"} /target

The people putting these on the internet seemed confident, but I'm not sure the structure is right since the --exclude is after the / source directory.

Last edited by bsurfin; 03-21-2020 at 12:47 AM.
 
Old 03-21-2020, 12:28 AM   #2
Turbocapitalist
Senior Member
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 4,773
Blog Entries: 3

Rep: Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383
You can try the --dry-run option first to make sure it is ok. For exclusion, I prefer to use --filter instead of --exclude.
 
Old 03-21-2020, 05:54 AM   #3
fatmac
Senior Member
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Posts: 3,540

Rep: Reputation: Disabled
Normally all options come after the command & before the directories to be worked on in Linux, so try that if the above doesn't solve it for you.
 
Old 03-21-2020, 08:46 PM   #4
bsurfin
Member
 
Registered: May 2004
Location: Kalispell Montana
Distribution: Ubuntu 18.04LTS
Posts: 143

Original Poster
Rep: Reputation: 16
The source does go right before the destination in my case, I believe the directions I got above was for using the command for backing up through ssh, which apparently you can enter the source in earlier in the command, then the ssh:/* goes right before the destination if I understand what I found out today correctly.
 
Old 03-21-2020, 11:57 PM   #5
Turbocapitalist
Senior Member
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 4,773
Blog Entries: 3

Rep: Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383
The rsync utility uses SSH for transfer by default since version 2.6, and that was released back in 2004. So even if you are on CentOS, you don't have to add anything to use basic SSH.

However, if you'd like to pass options to the SSH client then you would still need to have the -e option for rsync. That would come in handy if you have a different account name on the remote computer or will use a key to connect:

Code:
sudo rsync -aAXv \
        --dry-run \
        --delete \
        -e 'ssh -l nifrusb -i /home/bsurfin/.ssh/some_key_rsa' \
        --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*",\
            "/run/*","/mnt/*","/media/*","/lost+found",”swapfile”,”.encryptfs”} \
        / /target

Last edited by Turbocapitalist; 03-21-2020 at 11:58 PM.
 
Old 03-24-2020, 05:56 PM   #6
bsurfin
Member
 
Registered: May 2004
Location: Kalispell Montana
Distribution: Ubuntu 18.04LTS
Posts: 143

Original Poster
Rep: Reputation: 16
Thanks for the code, as it was the next script I needed to figure out. Once I get everything transferred over, Since my 4TB backup USB is running out of space. I planned on using my old server for a backup server and would then need to transfer ( 8TB LVM to 8TB LVM "For Now") with rsync and ssh, rsync is the fastest way of backing up that I've come across.
 
  


Reply

Tags
rsync


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Could someone please check this code for me Not sure if i am approaching this correct whoovian11 Programming 7 09-28-2015 05:22 PM
I'm not sure how this happened but I'm sure there is a lesson in there somewhere mreff555 Linux - Newbie 6 09-24-2012 02:09 AM
Help With Java Problem Please"""""""""""" suemcholan Linux - Newbie 1 04-02-2008 06:02 PM
Could someone please post "upgrade.txt"... tigerflag Slackware 2 06-27-2004 04:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 05:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration