Rsync for perfect copy: softlinks become..dir
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I do a "clone" from one mounted disk to other disk mounted remotely.
I will cal them local and remote.
Local is slackware,and remote ubuntu
On local
df -h /mnt/
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/fedora-root 49G 4.3G 43G 10% /mnt
On remote
df -h /media/ubuntu/1c34a414-9fa2-4bfe-a57c-7f82f1b31b29
Filesystem Size Used Avail Use% Mounted on
/dev/mmcblk1p2 57G 7.2G 47G 14% /media/ubuntu/1c34a414-9fa2-4bfe-a57c-7f82f1b31b29
I see rsync is not done the things properly,after use this command
from local
cd /mnt
for i in * ;do rsync -avP --delete --ignore-errors $i/ 192.168.0.75:/media/ubuntu/1c34a414-9fa2-4bfe-a57c-7f82f1b31b29/$i; done
I see for example on local
file bin
bin: symbolic link to usr/bin
and on remote..
file /media/ubuntu/1c34a414-9fa2-4bfe-a57c-7f82f1b31b29/bin/
/media/ubuntu/1c34a414-9fa2-4bfe-a57c-7f82f1b31b29/bin/: directory
I want bin destroyed on remote and it must become(as on local) a symbolic link
Which option for rsync?
Using:
rsync -avPl
rsync -rvPl
doesn't work
rsync symlink
add a comment |Â
up vote
0
down vote
favorite
I do a "clone" from one mounted disk to other disk mounted remotely.
I will cal them local and remote.
Local is slackware,and remote ubuntu
On local
df -h /mnt/
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/fedora-root 49G 4.3G 43G 10% /mnt
On remote
df -h /media/ubuntu/1c34a414-9fa2-4bfe-a57c-7f82f1b31b29
Filesystem Size Used Avail Use% Mounted on
/dev/mmcblk1p2 57G 7.2G 47G 14% /media/ubuntu/1c34a414-9fa2-4bfe-a57c-7f82f1b31b29
I see rsync is not done the things properly,after use this command
from local
cd /mnt
for i in * ;do rsync -avP --delete --ignore-errors $i/ 192.168.0.75:/media/ubuntu/1c34a414-9fa2-4bfe-a57c-7f82f1b31b29/$i; done
I see for example on local
file bin
bin: symbolic link to usr/bin
and on remote..
file /media/ubuntu/1c34a414-9fa2-4bfe-a57c-7f82f1b31b29/bin/
/media/ubuntu/1c34a414-9fa2-4bfe-a57c-7f82f1b31b29/bin/: directory
I want bin destroyed on remote and it must become(as on local) a symbolic link
Which option for rsync?
Using:
rsync -avPl
rsync -rvPl
doesn't work
rsync symlink
Did you usersync -l
?
â DopeGhoti
Feb 7 at 22:49
Of course,and don't work
â elbarna
Feb 7 at 22:50
You say "of course", and yet in your question you say you usedrsync -avP
;-a
does not imply-l
which explicitly is used to copy links as links. I have tested this for another question involvingrsync
yesterday and it is fresh in my mind; I am not able to replicate your stated behavior of-l
not copying a link as a link.
â DopeGhoti
Feb 7 at 22:51
I have added then,the -l,options,and bin on remote,is still a dir,so don't work
â elbarna
Feb 7 at 23:09
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I do a "clone" from one mounted disk to other disk mounted remotely.
I will cal them local and remote.
Local is slackware,and remote ubuntu
On local
df -h /mnt/
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/fedora-root 49G 4.3G 43G 10% /mnt
On remote
df -h /media/ubuntu/1c34a414-9fa2-4bfe-a57c-7f82f1b31b29
Filesystem Size Used Avail Use% Mounted on
/dev/mmcblk1p2 57G 7.2G 47G 14% /media/ubuntu/1c34a414-9fa2-4bfe-a57c-7f82f1b31b29
I see rsync is not done the things properly,after use this command
from local
cd /mnt
for i in * ;do rsync -avP --delete --ignore-errors $i/ 192.168.0.75:/media/ubuntu/1c34a414-9fa2-4bfe-a57c-7f82f1b31b29/$i; done
I see for example on local
file bin
bin: symbolic link to usr/bin
and on remote..
file /media/ubuntu/1c34a414-9fa2-4bfe-a57c-7f82f1b31b29/bin/
/media/ubuntu/1c34a414-9fa2-4bfe-a57c-7f82f1b31b29/bin/: directory
I want bin destroyed on remote and it must become(as on local) a symbolic link
Which option for rsync?
Using:
rsync -avPl
rsync -rvPl
doesn't work
rsync symlink
I do a "clone" from one mounted disk to other disk mounted remotely.
I will cal them local and remote.
Local is slackware,and remote ubuntu
On local
df -h /mnt/
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/fedora-root 49G 4.3G 43G 10% /mnt
On remote
df -h /media/ubuntu/1c34a414-9fa2-4bfe-a57c-7f82f1b31b29
Filesystem Size Used Avail Use% Mounted on
/dev/mmcblk1p2 57G 7.2G 47G 14% /media/ubuntu/1c34a414-9fa2-4bfe-a57c-7f82f1b31b29
I see rsync is not done the things properly,after use this command
from local
cd /mnt
for i in * ;do rsync -avP --delete --ignore-errors $i/ 192.168.0.75:/media/ubuntu/1c34a414-9fa2-4bfe-a57c-7f82f1b31b29/$i; done
I see for example on local
file bin
bin: symbolic link to usr/bin
and on remote..
file /media/ubuntu/1c34a414-9fa2-4bfe-a57c-7f82f1b31b29/bin/
/media/ubuntu/1c34a414-9fa2-4bfe-a57c-7f82f1b31b29/bin/: directory
I want bin destroyed on remote and it must become(as on local) a symbolic link
Which option for rsync?
Using:
rsync -avPl
rsync -rvPl
doesn't work
rsync symlink
edited Feb 7 at 23:47
Jeff Schaller
31.3k846105
31.3k846105
asked Feb 7 at 22:47
elbarna
3,80893477
3,80893477
Did you usersync -l
?
â DopeGhoti
Feb 7 at 22:49
Of course,and don't work
â elbarna
Feb 7 at 22:50
You say "of course", and yet in your question you say you usedrsync -avP
;-a
does not imply-l
which explicitly is used to copy links as links. I have tested this for another question involvingrsync
yesterday and it is fresh in my mind; I am not able to replicate your stated behavior of-l
not copying a link as a link.
â DopeGhoti
Feb 7 at 22:51
I have added then,the -l,options,and bin on remote,is still a dir,so don't work
â elbarna
Feb 7 at 23:09
add a comment |Â
Did you usersync -l
?
â DopeGhoti
Feb 7 at 22:49
Of course,and don't work
â elbarna
Feb 7 at 22:50
You say "of course", and yet in your question you say you usedrsync -avP
;-a
does not imply-l
which explicitly is used to copy links as links. I have tested this for another question involvingrsync
yesterday and it is fresh in my mind; I am not able to replicate your stated behavior of-l
not copying a link as a link.
â DopeGhoti
Feb 7 at 22:51
I have added then,the -l,options,and bin on remote,is still a dir,so don't work
â elbarna
Feb 7 at 23:09
Did you use
rsync -l
?â DopeGhoti
Feb 7 at 22:49
Did you use
rsync -l
?â DopeGhoti
Feb 7 at 22:49
Of course,and don't work
â elbarna
Feb 7 at 22:50
Of course,and don't work
â elbarna
Feb 7 at 22:50
You say "of course", and yet in your question you say you used
rsync -avP
; -a
does not imply -l
which explicitly is used to copy links as links. I have tested this for another question involving rsync
yesterday and it is fresh in my mind; I am not able to replicate your stated behavior of -l
not copying a link as a link.â DopeGhoti
Feb 7 at 22:51
You say "of course", and yet in your question you say you used
rsync -avP
; -a
does not imply -l
which explicitly is used to copy links as links. I have tested this for another question involving rsync
yesterday and it is fresh in my mind; I am not able to replicate your stated behavior of -l
not copying a link as a link.â DopeGhoti
Feb 7 at 22:51
I have added then,the -l,options,and bin on remote,is still a dir,so don't work
â elbarna
Feb 7 at 23:09
I have added then,the -l,options,and bin on remote,is still a dir,so don't work
â elbarna
Feb 7 at 23:09
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
2
down vote
The -l
(-links
) option is implied by -a
(--archive
) but you also need -K (--keep-dirlinks
) so that target directories are allowed to be symlinks. You may find that you also need --delete-before
to correct the existing structure.
rsync -avKP --delete --ignore-errors src/ 192.168.0.75:dst/
Looking more closely at your original code, you're iterating across what I now see is the top level of your server, including /bin
and /usr
. In this instance /bin
is a symlink to /usr/bin
, but your code passes this to rsync
with $i/
, which equates to /bin/
. So rsync
never sees this as a symlink because your $i/
has already dereferenced it.
Removing your for
loop and letting rsync
handle the full directory tree itself will allow it to see the top-level symlink and transfer it correctly.
sorry but doesn't work if the bin already exist on remote and is a directory
â elbarna
Feb 7 at 23:26
@elbarna please use the--delete-before
option
â roaima
Feb 7 at 23:33
I used but nothing change
â elbarna
Feb 7 at 23:33
add a comment |Â
up vote
0
down vote
I found a nice "workaround"
Instead of did
cd /mnt
for i in * ;do rsync -avXHhP --delete --ignore-errors $i/ 192.168.0.75:/media/ubuntu/1c34a414-9fa2-4bfe-a57c-7f82f1b31b29/$i; done
I do
rsync --avXHhP --delete --ignore-errors /mnt/ 192.168.0.75:/media/ubuntu/1c34a414-9fa2-4bfe-a57c-7f82f1b31b29 ; done
And work,the dir are identical even on symlinks
Edit: I correct with -avXHhP,which is more good for backup bootable
2
Oh I see what you were doing. In your original casersync
couldn't have seen the top level symlink because you had already dereferenced it. This is a consequence of your script, not ofrsync
.
â roaima
Feb 8 at 0:09
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
The -l
(-links
) option is implied by -a
(--archive
) but you also need -K (--keep-dirlinks
) so that target directories are allowed to be symlinks. You may find that you also need --delete-before
to correct the existing structure.
rsync -avKP --delete --ignore-errors src/ 192.168.0.75:dst/
Looking more closely at your original code, you're iterating across what I now see is the top level of your server, including /bin
and /usr
. In this instance /bin
is a symlink to /usr/bin
, but your code passes this to rsync
with $i/
, which equates to /bin/
. So rsync
never sees this as a symlink because your $i/
has already dereferenced it.
Removing your for
loop and letting rsync
handle the full directory tree itself will allow it to see the top-level symlink and transfer it correctly.
sorry but doesn't work if the bin already exist on remote and is a directory
â elbarna
Feb 7 at 23:26
@elbarna please use the--delete-before
option
â roaima
Feb 7 at 23:33
I used but nothing change
â elbarna
Feb 7 at 23:33
add a comment |Â
up vote
2
down vote
The -l
(-links
) option is implied by -a
(--archive
) but you also need -K (--keep-dirlinks
) so that target directories are allowed to be symlinks. You may find that you also need --delete-before
to correct the existing structure.
rsync -avKP --delete --ignore-errors src/ 192.168.0.75:dst/
Looking more closely at your original code, you're iterating across what I now see is the top level of your server, including /bin
and /usr
. In this instance /bin
is a symlink to /usr/bin
, but your code passes this to rsync
with $i/
, which equates to /bin/
. So rsync
never sees this as a symlink because your $i/
has already dereferenced it.
Removing your for
loop and letting rsync
handle the full directory tree itself will allow it to see the top-level symlink and transfer it correctly.
sorry but doesn't work if the bin already exist on remote and is a directory
â elbarna
Feb 7 at 23:26
@elbarna please use the--delete-before
option
â roaima
Feb 7 at 23:33
I used but nothing change
â elbarna
Feb 7 at 23:33
add a comment |Â
up vote
2
down vote
up vote
2
down vote
The -l
(-links
) option is implied by -a
(--archive
) but you also need -K (--keep-dirlinks
) so that target directories are allowed to be symlinks. You may find that you also need --delete-before
to correct the existing structure.
rsync -avKP --delete --ignore-errors src/ 192.168.0.75:dst/
Looking more closely at your original code, you're iterating across what I now see is the top level of your server, including /bin
and /usr
. In this instance /bin
is a symlink to /usr/bin
, but your code passes this to rsync
with $i/
, which equates to /bin/
. So rsync
never sees this as a symlink because your $i/
has already dereferenced it.
Removing your for
loop and letting rsync
handle the full directory tree itself will allow it to see the top-level symlink and transfer it correctly.
The -l
(-links
) option is implied by -a
(--archive
) but you also need -K (--keep-dirlinks
) so that target directories are allowed to be symlinks. You may find that you also need --delete-before
to correct the existing structure.
rsync -avKP --delete --ignore-errors src/ 192.168.0.75:dst/
Looking more closely at your original code, you're iterating across what I now see is the top level of your server, including /bin
and /usr
. In this instance /bin
is a symlink to /usr/bin
, but your code passes this to rsync
with $i/
, which equates to /bin/
. So rsync
never sees this as a symlink because your $i/
has already dereferenced it.
Removing your for
loop and letting rsync
handle the full directory tree itself will allow it to see the top-level symlink and transfer it correctly.
edited Feb 8 at 13:10
answered Feb 7 at 23:20
roaima
39.6k545108
39.6k545108
sorry but doesn't work if the bin already exist on remote and is a directory
â elbarna
Feb 7 at 23:26
@elbarna please use the--delete-before
option
â roaima
Feb 7 at 23:33
I used but nothing change
â elbarna
Feb 7 at 23:33
add a comment |Â
sorry but doesn't work if the bin already exist on remote and is a directory
â elbarna
Feb 7 at 23:26
@elbarna please use the--delete-before
option
â roaima
Feb 7 at 23:33
I used but nothing change
â elbarna
Feb 7 at 23:33
sorry but doesn't work if the bin already exist on remote and is a directory
â elbarna
Feb 7 at 23:26
sorry but doesn't work if the bin already exist on remote and is a directory
â elbarna
Feb 7 at 23:26
@elbarna please use the
--delete-before
optionâ roaima
Feb 7 at 23:33
@elbarna please use the
--delete-before
optionâ roaima
Feb 7 at 23:33
I used but nothing change
â elbarna
Feb 7 at 23:33
I used but nothing change
â elbarna
Feb 7 at 23:33
add a comment |Â
up vote
0
down vote
I found a nice "workaround"
Instead of did
cd /mnt
for i in * ;do rsync -avXHhP --delete --ignore-errors $i/ 192.168.0.75:/media/ubuntu/1c34a414-9fa2-4bfe-a57c-7f82f1b31b29/$i; done
I do
rsync --avXHhP --delete --ignore-errors /mnt/ 192.168.0.75:/media/ubuntu/1c34a414-9fa2-4bfe-a57c-7f82f1b31b29 ; done
And work,the dir are identical even on symlinks
Edit: I correct with -avXHhP,which is more good for backup bootable
2
Oh I see what you were doing. In your original casersync
couldn't have seen the top level symlink because you had already dereferenced it. This is a consequence of your script, not ofrsync
.
â roaima
Feb 8 at 0:09
add a comment |Â
up vote
0
down vote
I found a nice "workaround"
Instead of did
cd /mnt
for i in * ;do rsync -avXHhP --delete --ignore-errors $i/ 192.168.0.75:/media/ubuntu/1c34a414-9fa2-4bfe-a57c-7f82f1b31b29/$i; done
I do
rsync --avXHhP --delete --ignore-errors /mnt/ 192.168.0.75:/media/ubuntu/1c34a414-9fa2-4bfe-a57c-7f82f1b31b29 ; done
And work,the dir are identical even on symlinks
Edit: I correct with -avXHhP,which is more good for backup bootable
2
Oh I see what you were doing. In your original casersync
couldn't have seen the top level symlink because you had already dereferenced it. This is a consequence of your script, not ofrsync
.
â roaima
Feb 8 at 0:09
add a comment |Â
up vote
0
down vote
up vote
0
down vote
I found a nice "workaround"
Instead of did
cd /mnt
for i in * ;do rsync -avXHhP --delete --ignore-errors $i/ 192.168.0.75:/media/ubuntu/1c34a414-9fa2-4bfe-a57c-7f82f1b31b29/$i; done
I do
rsync --avXHhP --delete --ignore-errors /mnt/ 192.168.0.75:/media/ubuntu/1c34a414-9fa2-4bfe-a57c-7f82f1b31b29 ; done
And work,the dir are identical even on symlinks
Edit: I correct with -avXHhP,which is more good for backup bootable
I found a nice "workaround"
Instead of did
cd /mnt
for i in * ;do rsync -avXHhP --delete --ignore-errors $i/ 192.168.0.75:/media/ubuntu/1c34a414-9fa2-4bfe-a57c-7f82f1b31b29/$i; done
I do
rsync --avXHhP --delete --ignore-errors /mnt/ 192.168.0.75:/media/ubuntu/1c34a414-9fa2-4bfe-a57c-7f82f1b31b29 ; done
And work,the dir are identical even on symlinks
Edit: I correct with -avXHhP,which is more good for backup bootable
edited Feb 8 at 0:28
answered Feb 7 at 23:34
elbarna
3,80893477
3,80893477
2
Oh I see what you were doing. In your original casersync
couldn't have seen the top level symlink because you had already dereferenced it. This is a consequence of your script, not ofrsync
.
â roaima
Feb 8 at 0:09
add a comment |Â
2
Oh I see what you were doing. In your original casersync
couldn't have seen the top level symlink because you had already dereferenced it. This is a consequence of your script, not ofrsync
.
â roaima
Feb 8 at 0:09
2
2
Oh I see what you were doing. In your original case
rsync
couldn't have seen the top level symlink because you had already dereferenced it. This is a consequence of your script, not of rsync
.â roaima
Feb 8 at 0:09
Oh I see what you were doing. In your original case
rsync
couldn't have seen the top level symlink because you had already dereferenced it. This is a consequence of your script, not of rsync
.â roaima
Feb 8 at 0:09
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f422669%2frsync-for-perfect-copy-softlinks-become-dir%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Did you use
rsync -l
?â DopeGhoti
Feb 7 at 22:49
Of course,and don't work
â elbarna
Feb 7 at 22:50
You say "of course", and yet in your question you say you used
rsync -avP
;-a
does not imply-l
which explicitly is used to copy links as links. I have tested this for another question involvingrsync
yesterday and it is fresh in my mind; I am not able to replicate your stated behavior of-l
not copying a link as a link.â DopeGhoti
Feb 7 at 22:51
I have added then,the -l,options,and bin on remote,is still a dir,so don't work
â elbarna
Feb 7 at 23:09