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;








3















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









share|improve this question














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

















3















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









share|improve this question














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













3












3








3








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









share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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

















  • 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










1 Answer
1






active

oldest

votes


















0














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.






share|improve this answer























    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
    );



    );













    draft saved

    draft discarded


















    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









    0














    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.






    share|improve this answer



























      0














      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.






      share|improve this answer

























        0












        0








        0







        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.






        share|improve this answer













        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.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 10 '17 at 22:20









        Edward FalkEdward Falk

        1012




        1012



























            draft saved

            draft discarded
















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            How to make RAID controller rescan devices The 2019 Stack Overflow Developer Survey Results Are InLSI MegaRAID SAS 9261-8i: Disk isn't recognized after replacementHow to monitor the hard disk status behind Dell PERC H710 Raid Controller with CentOS 6?LSI MegaRAID - Recreate missing RAID 1 arrayext. 2-bay USB-Drive with RAID: btrfs RAID vs built-in RAIDInvalid SAS topologyDoes enabling JBOD mode on LSI based controllers affect existing logical disks/arrays?Why is there a shift between the WWN reported from the controller and the Linux system?Optimal RAID 6+0 Setup for 40+ 4TB DisksAccidental SAS cable removal

            How can I have a shield and a way of attacking at distance at the same time? The 2019 Stack Overflow Developer Survey Results Are InDoes the Thrown property mean I can attack with my DEX?Is it possible to build a custom weapon, and if so, how will my character be able to use it?Can the Ghost Touch weapon property allow an attacker to perform incorporeal touch attacks?The DM allowed me to wield two shields, how can I get the most AC and HP, as a Bear Barbarian?Are there ways other than Kensei Weapons or Hex Warrior to use an ability other than STR for non-finesse melee weapons?Cheapest way to cast spells with sword and (heavy) shield?Is this homebrew “Throwing Weapons Master” feat balanced?Can Hexblade warlocks use a staff and shield?Are there any balance issues with allowing thrown Javelins to be drawn for free like ammunition weapons?Does an unattuned Frost Brand weapon still glow in freezing temperatures?Does a druid starting with a bow start with no arrows?Is it possible to build a custom weapon, and if so, how will my character be able to use it?

            How to determine omitted units in a publication The 2019 Stack Overflow Developer Survey Results Are InUnits of mass on the atomic scaleUnits in modified Arrhenius equation?Why are osmoles not considered SI units?When to use Da or u for mass unitsDividing different units of measurement?When you report Einstein units do you capitalize it?How to use C1V1=C2V2 How do the units work?Force Fields and unitsDoes adding prefixes to SI units make them no longer SI units?Types of concentration units