LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-07-2018, 05:08 PM   #1
camerabambai
Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 408

Rep: Reputation: 54
Fast question about rsync


On rsync I use usually those options

Code:
-avP
Now I want to make a PERFECT copy of local fs,to existent remote fs.
With -avP I see this things

on local
Code:
/bin symlink to /usr/bin
on remote
Code:
/bin is a dir!
I want to make bin a symlink also on remote,without use workarounds,like find,rm,etc..
Is possible?
 
Old 02-07-2018, 05:55 PM   #2
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
I think you just need to add '-H'.
 
Old 02-07-2018, 07:00 PM   #3
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
No, -P does not mean perfect (Sorry, could not help myself)

But seriously, this is strange. -H as AwesomeMachine suggests has to do with hardlinks. You are talking about symlinks.

You should use -l for "copy symlinks as symlinks"

But -l is implied in the use of -a. As a matter of fact, -a is THE recommended way to make a perfect copy. And I can assure you -a copy symlinks as symlinks

Where exactly do you see
Code:
/bin is a dir!
on the remote host? rsync does not display anything on the remote host.

And what is the exact command you give on the local machine to initiate the rsync copy?

jlinkels
 
Old 02-07-2018, 10:49 PM   #4
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,150

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
-avH should be cool.
 
Old 02-08-2018, 03:39 AM   #5
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Quote:
Originally Posted by JJJCR View Post
-avH should be cool.
Why? -H is about hard links. The OP talks about symlinks. What is it I am overlooking? I know the difference between hard links and symlinks.

jlinkels
 
Old 03-01-2021, 01:16 PM   #6
camerabambai
Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 408

Original Poster
Rep: Reputation: 54
Solution found

a)use those options of rsync

Code:
rsync -avAXHhSP
b)never sync the dir "directly", for example

Code:
rsync -avAXHhSP /mnt/hd/bin/ remote: /mnt/hd/bin WRONG

rsync -avAXHhSP /mnt/hd/ remote: /mnt/hd OK
 
Old 03-02-2021, 09:13 AM   #7
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
Quote:
Originally Posted by camerabambai View Post
Solution found

a)use those options of rsync

Code:
rsync -avAXHhSP
b)never sync the dir "directly", for example

Code:
rsync -avAXHhSP /mnt/hd/bin/ remote: /mnt/hd/bin WRONG

rsync -avAXHhSP /mnt/hd/ remote: /mnt/hd OK
There is no difference in those 2 commands except the first one only copies the /mnt/hd/bin/ directory content while retaining the path, and the second copies all the content of the /mnt/hd/ directory.

The error is that your first command says copy the content of this source directory to this (non-existing) file. The second says copy the content of this source directory to this (existing) directory.

What is wrong about the first and correct about the second is that the destination directory must exist when using that syntax.

Changing the first command to read
Code:
rsync -avAXHhSP /mnt/hd/bin/ remote: /mnt/hd/bin/
would work as expected since that would create the missing directory before copying the files.

The same effect could be achieved with
Code:
rsync -avAXHhSP /mnt/hd/bin remote: /mnt/hd/

or

rsync -avAXHhSP /mnt/hd remote: /mnt/
Both these structures say copy this source directory and content into the destination directory.

Read the details of the rsync man page explanations of syntax to understand the differences.
 
1 members found this post helpful.
  


Reply

Tags
rsync



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
rsync with --link-dest: Question about interrupted rsync session bvz Linux - Server 9 09-10-2016 11:31 AM
rsync or other tool for fast syncs with simple requirements froff Linux - Software 1 09-02-2014 09:32 AM
fast question about C lleb Linux - Newbie 3 06-19-2012 04:13 PM
LXer: Rsync Snapshots: Space Saving & Fast Recovery LXer Syndicated Linux News 0 11-28-2011 10:02 PM
/etc/inittab fast question Lleb_KCir Linux - Software 3 12-02-2004 02:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:49 PM.

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
Open Source Consulting | Domain Registration