rsync differential backup move files

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












root@server1:/ - remote server



/backup1/12/fullbackup - local backup server with data from server1



first i rsync all data from remote server to local backup server (script1.sh):



rsync -avrh -e "ssh -p 123456 -o StrictHostKeyChecking=no" 
--progress
root@server1:/ /backup1/12/fullbackup/


Second i create simple differential backup script (script2.sh):



today=15 
rsync -avrh -e "ssh -p 123456 -o StrictHostKeyChecking=no"
--progress
--link-dest=/backup1/12/fullbackup/
root@$ip:/ /backup1/12/backupday/$today/


After run first script (script1.sh) in directory 12:



# du -sh /backup1/12/*
8.0K /backup1/12/backupday
4.1G /backup1/12/fullbackup


After run second script (script2.sh) all data from fullbackup move to backupday/15



# du -sh /backup1/12/*
3.9G /backup1/12/backupday
386M /backup1/12/fullbackup


After move today=15 to today=16 and run second script again (script2.sh) in backupday:



# du -sh /backup1/12/backupday/*
4.1G /backup1/12/backupday/15
104M /backup1/12/backupday/16


I don't understand why first run script2.sh move all data to backupday/15, and second,third and next run script create correct differential backup.



What needs to change to always have a full copy in /backup1/12/fullbackup, and different in backupday/$today ?







share|improve this question


























    up vote
    1
    down vote

    favorite












    root@server1:/ - remote server



    /backup1/12/fullbackup - local backup server with data from server1



    first i rsync all data from remote server to local backup server (script1.sh):



    rsync -avrh -e "ssh -p 123456 -o StrictHostKeyChecking=no" 
    --progress
    root@server1:/ /backup1/12/fullbackup/


    Second i create simple differential backup script (script2.sh):



    today=15 
    rsync -avrh -e "ssh -p 123456 -o StrictHostKeyChecking=no"
    --progress
    --link-dest=/backup1/12/fullbackup/
    root@$ip:/ /backup1/12/backupday/$today/


    After run first script (script1.sh) in directory 12:



    # du -sh /backup1/12/*
    8.0K /backup1/12/backupday
    4.1G /backup1/12/fullbackup


    After run second script (script2.sh) all data from fullbackup move to backupday/15



    # du -sh /backup1/12/*
    3.9G /backup1/12/backupday
    386M /backup1/12/fullbackup


    After move today=15 to today=16 and run second script again (script2.sh) in backupday:



    # du -sh /backup1/12/backupday/*
    4.1G /backup1/12/backupday/15
    104M /backup1/12/backupday/16


    I don't understand why first run script2.sh move all data to backupday/15, and second,third and next run script create correct differential backup.



    What needs to change to always have a full copy in /backup1/12/fullbackup, and different in backupday/$today ?







    share|improve this question
























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      root@server1:/ - remote server



      /backup1/12/fullbackup - local backup server with data from server1



      first i rsync all data from remote server to local backup server (script1.sh):



      rsync -avrh -e "ssh -p 123456 -o StrictHostKeyChecking=no" 
      --progress
      root@server1:/ /backup1/12/fullbackup/


      Second i create simple differential backup script (script2.sh):



      today=15 
      rsync -avrh -e "ssh -p 123456 -o StrictHostKeyChecking=no"
      --progress
      --link-dest=/backup1/12/fullbackup/
      root@$ip:/ /backup1/12/backupday/$today/


      After run first script (script1.sh) in directory 12:



      # du -sh /backup1/12/*
      8.0K /backup1/12/backupday
      4.1G /backup1/12/fullbackup


      After run second script (script2.sh) all data from fullbackup move to backupday/15



      # du -sh /backup1/12/*
      3.9G /backup1/12/backupday
      386M /backup1/12/fullbackup


      After move today=15 to today=16 and run second script again (script2.sh) in backupday:



      # du -sh /backup1/12/backupday/*
      4.1G /backup1/12/backupday/15
      104M /backup1/12/backupday/16


      I don't understand why first run script2.sh move all data to backupday/15, and second,third and next run script create correct differential backup.



      What needs to change to always have a full copy in /backup1/12/fullbackup, and different in backupday/$today ?







      share|improve this question














      root@server1:/ - remote server



      /backup1/12/fullbackup - local backup server with data from server1



      first i rsync all data from remote server to local backup server (script1.sh):



      rsync -avrh -e "ssh -p 123456 -o StrictHostKeyChecking=no" 
      --progress
      root@server1:/ /backup1/12/fullbackup/


      Second i create simple differential backup script (script2.sh):



      today=15 
      rsync -avrh -e "ssh -p 123456 -o StrictHostKeyChecking=no"
      --progress
      --link-dest=/backup1/12/fullbackup/
      root@$ip:/ /backup1/12/backupday/$today/


      After run first script (script1.sh) in directory 12:



      # du -sh /backup1/12/*
      8.0K /backup1/12/backupday
      4.1G /backup1/12/fullbackup


      After run second script (script2.sh) all data from fullbackup move to backupday/15



      # du -sh /backup1/12/*
      3.9G /backup1/12/backupday
      386M /backup1/12/fullbackup


      After move today=15 to today=16 and run second script again (script2.sh) in backupday:



      # du -sh /backup1/12/backupday/*
      4.1G /backup1/12/backupday/15
      104M /backup1/12/backupday/16


      I don't understand why first run script2.sh move all data to backupday/15, and second,third and next run script create correct differential backup.



      What needs to change to always have a full copy in /backup1/12/fullbackup, and different in backupday/$today ?









      share|improve this question













      share|improve this question




      share|improve this question








      edited Oct 16 '17 at 12:23









      Jeff Schaller

      32.1k849109




      32.1k849109










      asked Oct 16 '17 at 11:11









      MMa

      61




      61




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote













          What you are seeing is an artifact of du. When you hard-link files, du keeps a note of the disk usage that has already been accounted for when it comes across the second file. Eg



          $ mkdir a b
          $ dd count=1000 </dev/zero >a/x
          $ ln a/x b/x
          $ du -s a b
          500 a
          0 b
          $ du -s b a
          500 b
          0 a


          You see how the first directory gets all the space apparently used.






          share|improve this answer




















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "106"
            ;
            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',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f398383%2frsync-differential-backup-move-files%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            1
            down vote













            What you are seeing is an artifact of du. When you hard-link files, du keeps a note of the disk usage that has already been accounted for when it comes across the second file. Eg



            $ mkdir a b
            $ dd count=1000 </dev/zero >a/x
            $ ln a/x b/x
            $ du -s a b
            500 a
            0 b
            $ du -s b a
            500 b
            0 a


            You see how the first directory gets all the space apparently used.






            share|improve this answer
























              up vote
              1
              down vote













              What you are seeing is an artifact of du. When you hard-link files, du keeps a note of the disk usage that has already been accounted for when it comes across the second file. Eg



              $ mkdir a b
              $ dd count=1000 </dev/zero >a/x
              $ ln a/x b/x
              $ du -s a b
              500 a
              0 b
              $ du -s b a
              500 b
              0 a


              You see how the first directory gets all the space apparently used.






              share|improve this answer






















                up vote
                1
                down vote










                up vote
                1
                down vote









                What you are seeing is an artifact of du. When you hard-link files, du keeps a note of the disk usage that has already been accounted for when it comes across the second file. Eg



                $ mkdir a b
                $ dd count=1000 </dev/zero >a/x
                $ ln a/x b/x
                $ du -s a b
                500 a
                0 b
                $ du -s b a
                500 b
                0 a


                You see how the first directory gets all the space apparently used.






                share|improve this answer












                What you are seeing is an artifact of du. When you hard-link files, du keeps a note of the disk usage that has already been accounted for when it comes across the second file. Eg



                $ mkdir a b
                $ dd count=1000 </dev/zero >a/x
                $ ln a/x b/x
                $ du -s a b
                500 a
                0 b
                $ du -s b a
                500 b
                0 a


                You see how the first directory gets all the space apparently used.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Oct 16 '17 at 11:39









                meuh

                29.8k11751




                29.8k11751



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f398383%2frsync-differential-backup-move-files%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Bahrain

                    Postfix configuration issue with fips on centos 7; mailgun relay