How do I make rsync also check ctime? The 2019 Stack Overflow Developer Survey Results Are InHow to use rsync over FTPCopying a large directory tree locally? cp or rsync?What is archive mode in rsync?Showing total progress in rsync: is it possible?rsync not syncingRsync : copying over timestamps onlyDeltaCopy (Rsync for windows) giving an error on task runrdiff-backup not working, but rsync is,Mandriva for both OSrsync files newer than last rysnc runHow to make rsync of ~2M files from remote server performant for regular backups
ELI5: Why do they say that Israel would have been the fourth country to land a spacecraft on the Moon and why do they call it low cost?
Is it ok to offer lower paid work as a trial period before negotiating for a full-time job?
For what reasons would an animal species NOT cross a *horizontal* land bridge?
Using `min_active_rowversion` for global temporary tables
Pokemon Turn Based battle (Python)
How to translate "being like"?
How to quickly solve partial fractions equation?
Finding the area between two curves with Integrate
How to support a colleague who finds meetings extremely tiring?
Why is this recursive code so slow?
Mathematics of imaging the black hole
What is this sharp, curved notch on my knife for?
Deal with toxic manager when you can't quit
Did the UK government pay "millions and millions of dollars" to try to snag Julian Assange?
Am I ethically obligated to go into work on an off day if the reason is sudden?
How did passengers keep warm on sail ships?
Are Newtonian Mechanics considered to be 'falsified'?
Word to describe a time interval
Did any laptop computers have a built-in 5 1/4 inch floppy drive?
Can a flute soloist sit?
Match Roman Numerals
Is it ethical to upload a automatically generated paper to a non peer-reviewed site as part of a larger research?
The following signatures were invalid: EXPKEYSIG 1397BC53640DB551
What was the last CPU that did not have the x87 floating-point unit built in?
How do I make rsync also check ctime?
The 2019 Stack Overflow Developer Survey Results Are InHow to use rsync over FTPCopying a large directory tree locally? cp or rsync?What is archive mode in rsync?Showing total progress in rsync: is it possible?rsync not syncingRsync : copying over timestamps onlyDeltaCopy (Rsync for windows) giving an error on task runrdiff-backup not working, but rsync is,Mandriva for both OSrsync files newer than last rysnc runHow to make rsync of ~2M files from remote server performant for regular backups
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
rsync detects files modification by comparing size and mtime.
However, if for any reason, the mtime is unchanged, rsync won't detect the change, although it's possible to spot it by looking at the ctime.
Of course, I can tell rsync do compare the whole files' contents, but that's very very expensive.
Is there a way to make rsync smarter, for example by checking mtime+size are the same AND that ctime isn't newer than mtime (on both source and destination) ? Or should I open a feature request ?
Here's an example:
Create 2 files, same content and atime/mtime
benoit@debian:~$ mkdir d1 && cd d1
benoit@debian:~/d1$ echo Hello > a
benoit@debian:~/d1$ cp -a a b
Rsync them to another (non-exisiting) directory:
benoit@debian:~/d1$ cd ..
benoit@debian:~$ rsync -av d1/ d2
sending incremental file list
created directory d2
./
a
b
sent 164 bytes received 53 bytes 434.00 bytes/sec
total size is 12 speedup is 0.06
OK, everything is synced
benoit@debian:~$ grep . d*/*
d1/a:Hello
d1/b:Hello
d2/a:Hello
d2/b:Hello
Update file 'b', same size and then reset its atime/mtime
benoit@debian:~$ echo World > d1/b
benoit@debian:~$ touch -r d1/a d1/b
Attempt to rsync again:
benoit@debian:~$ rsync -av d1/ d2
sending incremental file list
sent 63 bytes received 12 bytes 150.00 bytes/sec
total size is 12 speedup is 0.16
Nope, rsync missed the change.
benoit@debian:~$ grep . d*/*
d1/a:Hello
d1/b:World
d2/a:Hello
d2/b:Hello
Tell rsync the compare the file content
benoit@debian:~$ rsync -acv d1/ d2
sending incremental file list
b
sent 144 bytes received 31 bytes 350.00 bytes/sec
total size is 12 speedup is 0.07
Gives the correct result:
benoit@debian:~$ grep . d*/*
d1/a:Hello
d1/b:World
d2/a:Hello
d2/b:World
rsync timestamp
bumped to the homepage by Community♦ 59 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
rsync detects files modification by comparing size and mtime.
However, if for any reason, the mtime is unchanged, rsync won't detect the change, although it's possible to spot it by looking at the ctime.
Of course, I can tell rsync do compare the whole files' contents, but that's very very expensive.
Is there a way to make rsync smarter, for example by checking mtime+size are the same AND that ctime isn't newer than mtime (on both source and destination) ? Or should I open a feature request ?
Here's an example:
Create 2 files, same content and atime/mtime
benoit@debian:~$ mkdir d1 && cd d1
benoit@debian:~/d1$ echo Hello > a
benoit@debian:~/d1$ cp -a a b
Rsync them to another (non-exisiting) directory:
benoit@debian:~/d1$ cd ..
benoit@debian:~$ rsync -av d1/ d2
sending incremental file list
created directory d2
./
a
b
sent 164 bytes received 53 bytes 434.00 bytes/sec
total size is 12 speedup is 0.06
OK, everything is synced
benoit@debian:~$ grep . d*/*
d1/a:Hello
d1/b:Hello
d2/a:Hello
d2/b:Hello
Update file 'b', same size and then reset its atime/mtime
benoit@debian:~$ echo World > d1/b
benoit@debian:~$ touch -r d1/a d1/b
Attempt to rsync again:
benoit@debian:~$ rsync -av d1/ d2
sending incremental file list
sent 63 bytes received 12 bytes 150.00 bytes/sec
total size is 12 speedup is 0.16
Nope, rsync missed the change.
benoit@debian:~$ grep . d*/*
d1/a:Hello
d1/b:World
d2/a:Hello
d2/b:Hello
Tell rsync the compare the file content
benoit@debian:~$ rsync -acv d1/ d2
sending incremental file list
b
sent 144 bytes received 31 bytes 350.00 bytes/sec
total size is 12 speedup is 0.07
Gives the correct result:
benoit@debian:~$ grep . d*/*
d1/a:Hello
d1/b:World
d2/a:Hello
d2/b:World
rsync timestamp
bumped to the homepage by Community♦ 59 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
I don't think there is a way to make rsync check ctime. As you already indicated, the only way is to compare the checksums of the files.
– Florian Feldhaus
Nov 8 '13 at 7:05
Over and above of what @FlorianFeldhaus said: I can't think of any event (other than replacing the file with one that has the same mtime as the original) that will modify ctime but not mtime.
– tink
Sep 1 '15 at 21:23
@tink You can use touch to change the mtime to any time while ctime is updated to the current time.
– Praveen Yalagandula
Jul 6 '16 at 17:46
add a comment |
rsync detects files modification by comparing size and mtime.
However, if for any reason, the mtime is unchanged, rsync won't detect the change, although it's possible to spot it by looking at the ctime.
Of course, I can tell rsync do compare the whole files' contents, but that's very very expensive.
Is there a way to make rsync smarter, for example by checking mtime+size are the same AND that ctime isn't newer than mtime (on both source and destination) ? Or should I open a feature request ?
Here's an example:
Create 2 files, same content and atime/mtime
benoit@debian:~$ mkdir d1 && cd d1
benoit@debian:~/d1$ echo Hello > a
benoit@debian:~/d1$ cp -a a b
Rsync them to another (non-exisiting) directory:
benoit@debian:~/d1$ cd ..
benoit@debian:~$ rsync -av d1/ d2
sending incremental file list
created directory d2
./
a
b
sent 164 bytes received 53 bytes 434.00 bytes/sec
total size is 12 speedup is 0.06
OK, everything is synced
benoit@debian:~$ grep . d*/*
d1/a:Hello
d1/b:Hello
d2/a:Hello
d2/b:Hello
Update file 'b', same size and then reset its atime/mtime
benoit@debian:~$ echo World > d1/b
benoit@debian:~$ touch -r d1/a d1/b
Attempt to rsync again:
benoit@debian:~$ rsync -av d1/ d2
sending incremental file list
sent 63 bytes received 12 bytes 150.00 bytes/sec
total size is 12 speedup is 0.16
Nope, rsync missed the change.
benoit@debian:~$ grep . d*/*
d1/a:Hello
d1/b:World
d2/a:Hello
d2/b:Hello
Tell rsync the compare the file content
benoit@debian:~$ rsync -acv d1/ d2
sending incremental file list
b
sent 144 bytes received 31 bytes 350.00 bytes/sec
total size is 12 speedup is 0.07
Gives the correct result:
benoit@debian:~$ grep . d*/*
d1/a:Hello
d1/b:World
d2/a:Hello
d2/b:World
rsync timestamp
rsync detects files modification by comparing size and mtime.
However, if for any reason, the mtime is unchanged, rsync won't detect the change, although it's possible to spot it by looking at the ctime.
Of course, I can tell rsync do compare the whole files' contents, but that's very very expensive.
Is there a way to make rsync smarter, for example by checking mtime+size are the same AND that ctime isn't newer than mtime (on both source and destination) ? Or should I open a feature request ?
Here's an example:
Create 2 files, same content and atime/mtime
benoit@debian:~$ mkdir d1 && cd d1
benoit@debian:~/d1$ echo Hello > a
benoit@debian:~/d1$ cp -a a b
Rsync them to another (non-exisiting) directory:
benoit@debian:~/d1$ cd ..
benoit@debian:~$ rsync -av d1/ d2
sending incremental file list
created directory d2
./
a
b
sent 164 bytes received 53 bytes 434.00 bytes/sec
total size is 12 speedup is 0.06
OK, everything is synced
benoit@debian:~$ grep . d*/*
d1/a:Hello
d1/b:Hello
d2/a:Hello
d2/b:Hello
Update file 'b', same size and then reset its atime/mtime
benoit@debian:~$ echo World > d1/b
benoit@debian:~$ touch -r d1/a d1/b
Attempt to rsync again:
benoit@debian:~$ rsync -av d1/ d2
sending incremental file list
sent 63 bytes received 12 bytes 150.00 bytes/sec
total size is 12 speedup is 0.16
Nope, rsync missed the change.
benoit@debian:~$ grep . d*/*
d1/a:Hello
d1/b:World
d2/a:Hello
d2/b:Hello
Tell rsync the compare the file content
benoit@debian:~$ rsync -acv d1/ d2
sending incremental file list
b
sent 144 bytes received 31 bytes 350.00 bytes/sec
total size is 12 speedup is 0.07
Gives the correct result:
benoit@debian:~$ grep . d*/*
d1/a:Hello
d1/b:World
d2/a:Hello
d2/b:World
rsync timestamp
rsync timestamp
asked Nov 2 '13 at 18:00
BenoîtBenoît
9963922
9963922
bumped to the homepage by Community♦ 59 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 59 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
I don't think there is a way to make rsync check ctime. As you already indicated, the only way is to compare the checksums of the files.
– Florian Feldhaus
Nov 8 '13 at 7:05
Over and above of what @FlorianFeldhaus said: I can't think of any event (other than replacing the file with one that has the same mtime as the original) that will modify ctime but not mtime.
– tink
Sep 1 '15 at 21:23
@tink You can use touch to change the mtime to any time while ctime is updated to the current time.
– Praveen Yalagandula
Jul 6 '16 at 17:46
add a comment |
I don't think there is a way to make rsync check ctime. As you already indicated, the only way is to compare the checksums of the files.
– Florian Feldhaus
Nov 8 '13 at 7:05
Over and above of what @FlorianFeldhaus said: I can't think of any event (other than replacing the file with one that has the same mtime as the original) that will modify ctime but not mtime.
– tink
Sep 1 '15 at 21:23
@tink You can use touch to change the mtime to any time while ctime is updated to the current time.
– Praveen Yalagandula
Jul 6 '16 at 17:46
I don't think there is a way to make rsync check ctime. As you already indicated, the only way is to compare the checksums of the files.
– Florian Feldhaus
Nov 8 '13 at 7:05
I don't think there is a way to make rsync check ctime. As you already indicated, the only way is to compare the checksums of the files.
– Florian Feldhaus
Nov 8 '13 at 7:05
Over and above of what @FlorianFeldhaus said: I can't think of any event (other than replacing the file with one that has the same mtime as the original) that will modify ctime but not mtime.
– tink
Sep 1 '15 at 21:23
Over and above of what @FlorianFeldhaus said: I can't think of any event (other than replacing the file with one that has the same mtime as the original) that will modify ctime but not mtime.
– tink
Sep 1 '15 at 21:23
@tink You can use touch to change the mtime to any time while ctime is updated to the current time.
– Praveen Yalagandula
Jul 6 '16 at 17:46
@tink You can use touch to change the mtime to any time while ctime is updated to the current time.
– Praveen Yalagandula
Jul 6 '16 at 17:46
add a comment |
1 Answer
1
active
oldest
votes
chmod and other commands that change the file's attributes but not its contents will update ctime.
That said, modifying the file's contents will change its mtime. So unless someone has gone back and reset the mtime to its earlier value, a checksum won't tell you anything that comparing mtimes won't.
Note that ctime gets updated on every change. You can't override that and you can't manually modify ctime. This means that the -t option has no effect on ctime.
I'm guessing that the authors of rsync figured that for this reason, comparing ctimes would not be very useful.
IMHO, they're wrong about that. First, you might want rsync to update a file if its attributes were changed. Second, Windows file systems don't have an mtime, so the ability to compare ctimes would be very useful when working with mounted Windows file systems. As it stands, you have to use the checksum option when syncing from a Windows file system.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
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
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f550312%2fhow-do-i-make-rsync-also-check-ctime%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
chmod and other commands that change the file's attributes but not its contents will update ctime.
That said, modifying the file's contents will change its mtime. So unless someone has gone back and reset the mtime to its earlier value, a checksum won't tell you anything that comparing mtimes won't.
Note that ctime gets updated on every change. You can't override that and you can't manually modify ctime. This means that the -t option has no effect on ctime.
I'm guessing that the authors of rsync figured that for this reason, comparing ctimes would not be very useful.
IMHO, they're wrong about that. First, you might want rsync to update a file if its attributes were changed. Second, Windows file systems don't have an mtime, so the ability to compare ctimes would be very useful when working with mounted Windows file systems. As it stands, you have to use the checksum option when syncing from a Windows file system.
add a comment |
chmod and other commands that change the file's attributes but not its contents will update ctime.
That said, modifying the file's contents will change its mtime. So unless someone has gone back and reset the mtime to its earlier value, a checksum won't tell you anything that comparing mtimes won't.
Note that ctime gets updated on every change. You can't override that and you can't manually modify ctime. This means that the -t option has no effect on ctime.
I'm guessing that the authors of rsync figured that for this reason, comparing ctimes would not be very useful.
IMHO, they're wrong about that. First, you might want rsync to update a file if its attributes were changed. Second, Windows file systems don't have an mtime, so the ability to compare ctimes would be very useful when working with mounted Windows file systems. As it stands, you have to use the checksum option when syncing from a Windows file system.
add a comment |
chmod and other commands that change the file's attributes but not its contents will update ctime.
That said, modifying the file's contents will change its mtime. So unless someone has gone back and reset the mtime to its earlier value, a checksum won't tell you anything that comparing mtimes won't.
Note that ctime gets updated on every change. You can't override that and you can't manually modify ctime. This means that the -t option has no effect on ctime.
I'm guessing that the authors of rsync figured that for this reason, comparing ctimes would not be very useful.
IMHO, they're wrong about that. First, you might want rsync to update a file if its attributes were changed. Second, Windows file systems don't have an mtime, so the ability to compare ctimes would be very useful when working with mounted Windows file systems. As it stands, you have to use the checksum option when syncing from a Windows file system.
chmod and other commands that change the file's attributes but not its contents will update ctime.
That said, modifying the file's contents will change its mtime. So unless someone has gone back and reset the mtime to its earlier value, a checksum won't tell you anything that comparing mtimes won't.
Note that ctime gets updated on every change. You can't override that and you can't manually modify ctime. This means that the -t option has no effect on ctime.
I'm guessing that the authors of rsync figured that for this reason, comparing ctimes would not be very useful.
IMHO, they're wrong about that. First, you might want rsync to update a file if its attributes were changed. Second, Windows file systems don't have an mtime, so the ability to compare ctimes would be very useful when working with mounted Windows file systems. As it stands, you have to use the checksum option when syncing from a Windows file system.
answered Jan 10 '17 at 22:20
Edward FalkEdward Falk
1012
1012
add a comment |
add a comment |
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f550312%2fhow-do-i-make-rsync-also-check-ctime%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I don't think there is a way to make rsync check ctime. As you already indicated, the only way is to compare the checksums of the files.
– Florian Feldhaus
Nov 8 '13 at 7:05
Over and above of what @FlorianFeldhaus said: I can't think of any event (other than replacing the file with one that has the same mtime as the original) that will modify ctime but not mtime.
– tink
Sep 1 '15 at 21:23
@tink You can use touch to change the mtime to any time while ctime is updated to the current time.
– Praveen Yalagandula
Jul 6 '16 at 17:46