Rsync with crontab help












1















I am not a great linux user, and am just attempting to backup my server files in case of a drive failure. I currently have an SSD running docker containers for a media server, and the media is stored on a ZFS pool of 4 drives in a RAIDZ array. I am attempting to figure out how to rsync my crontab directory to the ZFS pool, and possibly also put it onto a usb to make sure my .env files don't get lost if the SSD fails. I don't know if I worded all of what I'm trying to get across correctly, so sorry! I suppose this would make more sense to just do as /home /mnt (name of the zpool).



rsync -av --delete /home /mnt- 


does this command look correct?



Below is what my Docker backup cronjob looks like, as well as the ZFS scrub.



# m h  dom mon dow   command
0 2 * * * /home/<USER>/.docker/main.sh -b max

# zpool scrub every month
0 2 1 * * /sbin/zpool scrub mnt
0 13 1 * * /sbin/zpool status


Thanks in advance!










share|improve this question





























    1















    I am not a great linux user, and am just attempting to backup my server files in case of a drive failure. I currently have an SSD running docker containers for a media server, and the media is stored on a ZFS pool of 4 drives in a RAIDZ array. I am attempting to figure out how to rsync my crontab directory to the ZFS pool, and possibly also put it onto a usb to make sure my .env files don't get lost if the SSD fails. I don't know if I worded all of what I'm trying to get across correctly, so sorry! I suppose this would make more sense to just do as /home /mnt (name of the zpool).



    rsync -av --delete /home /mnt- 


    does this command look correct?



    Below is what my Docker backup cronjob looks like, as well as the ZFS scrub.



    # m h  dom mon dow   command
    0 2 * * * /home/<USER>/.docker/main.sh -b max

    # zpool scrub every month
    0 2 1 * * /sbin/zpool scrub mnt
    0 13 1 * * /sbin/zpool status


    Thanks in advance!










    share|improve this question



























      1












      1








      1








      I am not a great linux user, and am just attempting to backup my server files in case of a drive failure. I currently have an SSD running docker containers for a media server, and the media is stored on a ZFS pool of 4 drives in a RAIDZ array. I am attempting to figure out how to rsync my crontab directory to the ZFS pool, and possibly also put it onto a usb to make sure my .env files don't get lost if the SSD fails. I don't know if I worded all of what I'm trying to get across correctly, so sorry! I suppose this would make more sense to just do as /home /mnt (name of the zpool).



      rsync -av --delete /home /mnt- 


      does this command look correct?



      Below is what my Docker backup cronjob looks like, as well as the ZFS scrub.



      # m h  dom mon dow   command
      0 2 * * * /home/<USER>/.docker/main.sh -b max

      # zpool scrub every month
      0 2 1 * * /sbin/zpool scrub mnt
      0 13 1 * * /sbin/zpool status


      Thanks in advance!










      share|improve this question
















      I am not a great linux user, and am just attempting to backup my server files in case of a drive failure. I currently have an SSD running docker containers for a media server, and the media is stored on a ZFS pool of 4 drives in a RAIDZ array. I am attempting to figure out how to rsync my crontab directory to the ZFS pool, and possibly also put it onto a usb to make sure my .env files don't get lost if the SSD fails. I don't know if I worded all of what I'm trying to get across correctly, so sorry! I suppose this would make more sense to just do as /home /mnt (name of the zpool).



      rsync -av --delete /home /mnt- 


      does this command look correct?



      Below is what my Docker backup cronjob looks like, as well as the ZFS scrub.



      # m h  dom mon dow   command
      0 2 * * * /home/<USER>/.docker/main.sh -b max

      # zpool scrub every month
      0 2 1 * * /sbin/zpool scrub mnt
      0 13 1 * * /sbin/zpool status


      Thanks in advance!







      server backup cron rsync zfs






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 17 at 9:21









      Jeff

      814619




      814619










      asked Mar 16 at 22:37









      Alschmitt44Alschmitt44

      61




      61






















          1 Answer
          1






          active

          oldest

          votes


















          1














          If you are looking to use rsync to back up files on a regular base you probably want to make some changes. --delete will remove the file you have deleted which means if you accidentally delete all your files and then rsync -av --delete /home /mnt- runs it will remove all of your backups. If all you want to do is to make a copy then this will work, and it will probably save you from a failed disk but you should think about what are you trying to protect your self from.
          I would suggest taking a look at this post on stack overflow if you are using rsync as your regular backup tool Use rsync for backup without overwrite.



          I realize there are many articles out there suggesting to do what you are doing, howtogeek linux.com and while this works great as a one time backup and is even ok if you want to run your backups manually when you know your computer is in a state you are ok with. It is risky to do it automatically. I would suggest using the built-in tool for backups (just search for backup) as it handles the case of deleting or overwriting files by mistake and you can set it up to run weekly/monthly etc and can set how long you want to keep backups for. but if you are just trying to protect from a disk failure what you have is probably ok.






          share|improve this answer
























          • So would you recommend using Rsnapshot on the first link? This is a headless server, so I don't have the os version of the built in backup tool. I am mainly attempting to prevent the settings on the SSD from being lost should it fail. The Zpool seems to do that by itself if I am understanding things correctly.

            – Alschmitt44
            Mar 18 at 21:12











          • @Alschmitt44 yes rsnapshot seems like a good option if you are in a headless system. It even deals with cleaning up old snapshots it makes and that can be configured however you want, so you could keep snapshots for weeks or months ect whatever works best for you. They have a FAQ page which looks helpful. I will note that I have not used rsnapshot myself but from what I see of it it looks like a great tool and it will be my goto for this kind of thing.

            – Jeff
            Mar 19 at 12:21











          • @Alschmitt44 if this solution solved your problem you asked please upvote and accept the answer. You can accept the answer by selecting the checkmark to the left of the answer.

            – Jeff
            7 hours ago













          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          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%2faskubuntu.com%2fquestions%2f1126268%2frsync-with-crontab-help%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









          1














          If you are looking to use rsync to back up files on a regular base you probably want to make some changes. --delete will remove the file you have deleted which means if you accidentally delete all your files and then rsync -av --delete /home /mnt- runs it will remove all of your backups. If all you want to do is to make a copy then this will work, and it will probably save you from a failed disk but you should think about what are you trying to protect your self from.
          I would suggest taking a look at this post on stack overflow if you are using rsync as your regular backup tool Use rsync for backup without overwrite.



          I realize there are many articles out there suggesting to do what you are doing, howtogeek linux.com and while this works great as a one time backup and is even ok if you want to run your backups manually when you know your computer is in a state you are ok with. It is risky to do it automatically. I would suggest using the built-in tool for backups (just search for backup) as it handles the case of deleting or overwriting files by mistake and you can set it up to run weekly/monthly etc and can set how long you want to keep backups for. but if you are just trying to protect from a disk failure what you have is probably ok.






          share|improve this answer
























          • So would you recommend using Rsnapshot on the first link? This is a headless server, so I don't have the os version of the built in backup tool. I am mainly attempting to prevent the settings on the SSD from being lost should it fail. The Zpool seems to do that by itself if I am understanding things correctly.

            – Alschmitt44
            Mar 18 at 21:12











          • @Alschmitt44 yes rsnapshot seems like a good option if you are in a headless system. It even deals with cleaning up old snapshots it makes and that can be configured however you want, so you could keep snapshots for weeks or months ect whatever works best for you. They have a FAQ page which looks helpful. I will note that I have not used rsnapshot myself but from what I see of it it looks like a great tool and it will be my goto for this kind of thing.

            – Jeff
            Mar 19 at 12:21











          • @Alschmitt44 if this solution solved your problem you asked please upvote and accept the answer. You can accept the answer by selecting the checkmark to the left of the answer.

            – Jeff
            7 hours ago


















          1














          If you are looking to use rsync to back up files on a regular base you probably want to make some changes. --delete will remove the file you have deleted which means if you accidentally delete all your files and then rsync -av --delete /home /mnt- runs it will remove all of your backups. If all you want to do is to make a copy then this will work, and it will probably save you from a failed disk but you should think about what are you trying to protect your self from.
          I would suggest taking a look at this post on stack overflow if you are using rsync as your regular backup tool Use rsync for backup without overwrite.



          I realize there are many articles out there suggesting to do what you are doing, howtogeek linux.com and while this works great as a one time backup and is even ok if you want to run your backups manually when you know your computer is in a state you are ok with. It is risky to do it automatically. I would suggest using the built-in tool for backups (just search for backup) as it handles the case of deleting or overwriting files by mistake and you can set it up to run weekly/monthly etc and can set how long you want to keep backups for. but if you are just trying to protect from a disk failure what you have is probably ok.






          share|improve this answer
























          • So would you recommend using Rsnapshot on the first link? This is a headless server, so I don't have the os version of the built in backup tool. I am mainly attempting to prevent the settings on the SSD from being lost should it fail. The Zpool seems to do that by itself if I am understanding things correctly.

            – Alschmitt44
            Mar 18 at 21:12











          • @Alschmitt44 yes rsnapshot seems like a good option if you are in a headless system. It even deals with cleaning up old snapshots it makes and that can be configured however you want, so you could keep snapshots for weeks or months ect whatever works best for you. They have a FAQ page which looks helpful. I will note that I have not used rsnapshot myself but from what I see of it it looks like a great tool and it will be my goto for this kind of thing.

            – Jeff
            Mar 19 at 12:21











          • @Alschmitt44 if this solution solved your problem you asked please upvote and accept the answer. You can accept the answer by selecting the checkmark to the left of the answer.

            – Jeff
            7 hours ago
















          1












          1








          1







          If you are looking to use rsync to back up files on a regular base you probably want to make some changes. --delete will remove the file you have deleted which means if you accidentally delete all your files and then rsync -av --delete /home /mnt- runs it will remove all of your backups. If all you want to do is to make a copy then this will work, and it will probably save you from a failed disk but you should think about what are you trying to protect your self from.
          I would suggest taking a look at this post on stack overflow if you are using rsync as your regular backup tool Use rsync for backup without overwrite.



          I realize there are many articles out there suggesting to do what you are doing, howtogeek linux.com and while this works great as a one time backup and is even ok if you want to run your backups manually when you know your computer is in a state you are ok with. It is risky to do it automatically. I would suggest using the built-in tool for backups (just search for backup) as it handles the case of deleting or overwriting files by mistake and you can set it up to run weekly/monthly etc and can set how long you want to keep backups for. but if you are just trying to protect from a disk failure what you have is probably ok.






          share|improve this answer













          If you are looking to use rsync to back up files on a regular base you probably want to make some changes. --delete will remove the file you have deleted which means if you accidentally delete all your files and then rsync -av --delete /home /mnt- runs it will remove all of your backups. If all you want to do is to make a copy then this will work, and it will probably save you from a failed disk but you should think about what are you trying to protect your self from.
          I would suggest taking a look at this post on stack overflow if you are using rsync as your regular backup tool Use rsync for backup without overwrite.



          I realize there are many articles out there suggesting to do what you are doing, howtogeek linux.com and while this works great as a one time backup and is even ok if you want to run your backups manually when you know your computer is in a state you are ok with. It is risky to do it automatically. I would suggest using the built-in tool for backups (just search for backup) as it handles the case of deleting or overwriting files by mistake and you can set it up to run weekly/monthly etc and can set how long you want to keep backups for. but if you are just trying to protect from a disk failure what you have is probably ok.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 16 at 23:34









          JeffJeff

          814619




          814619













          • So would you recommend using Rsnapshot on the first link? This is a headless server, so I don't have the os version of the built in backup tool. I am mainly attempting to prevent the settings on the SSD from being lost should it fail. The Zpool seems to do that by itself if I am understanding things correctly.

            – Alschmitt44
            Mar 18 at 21:12











          • @Alschmitt44 yes rsnapshot seems like a good option if you are in a headless system. It even deals with cleaning up old snapshots it makes and that can be configured however you want, so you could keep snapshots for weeks or months ect whatever works best for you. They have a FAQ page which looks helpful. I will note that I have not used rsnapshot myself but from what I see of it it looks like a great tool and it will be my goto for this kind of thing.

            – Jeff
            Mar 19 at 12:21











          • @Alschmitt44 if this solution solved your problem you asked please upvote and accept the answer. You can accept the answer by selecting the checkmark to the left of the answer.

            – Jeff
            7 hours ago





















          • So would you recommend using Rsnapshot on the first link? This is a headless server, so I don't have the os version of the built in backup tool. I am mainly attempting to prevent the settings on the SSD from being lost should it fail. The Zpool seems to do that by itself if I am understanding things correctly.

            – Alschmitt44
            Mar 18 at 21:12











          • @Alschmitt44 yes rsnapshot seems like a good option if you are in a headless system. It even deals with cleaning up old snapshots it makes and that can be configured however you want, so you could keep snapshots for weeks or months ect whatever works best for you. They have a FAQ page which looks helpful. I will note that I have not used rsnapshot myself but from what I see of it it looks like a great tool and it will be my goto for this kind of thing.

            – Jeff
            Mar 19 at 12:21











          • @Alschmitt44 if this solution solved your problem you asked please upvote and accept the answer. You can accept the answer by selecting the checkmark to the left of the answer.

            – Jeff
            7 hours ago



















          So would you recommend using Rsnapshot on the first link? This is a headless server, so I don't have the os version of the built in backup tool. I am mainly attempting to prevent the settings on the SSD from being lost should it fail. The Zpool seems to do that by itself if I am understanding things correctly.

          – Alschmitt44
          Mar 18 at 21:12





          So would you recommend using Rsnapshot on the first link? This is a headless server, so I don't have the os version of the built in backup tool. I am mainly attempting to prevent the settings on the SSD from being lost should it fail. The Zpool seems to do that by itself if I am understanding things correctly.

          – Alschmitt44
          Mar 18 at 21:12













          @Alschmitt44 yes rsnapshot seems like a good option if you are in a headless system. It even deals with cleaning up old snapshots it makes and that can be configured however you want, so you could keep snapshots for weeks or months ect whatever works best for you. They have a FAQ page which looks helpful. I will note that I have not used rsnapshot myself but from what I see of it it looks like a great tool and it will be my goto for this kind of thing.

          – Jeff
          Mar 19 at 12:21





          @Alschmitt44 yes rsnapshot seems like a good option if you are in a headless system. It even deals with cleaning up old snapshots it makes and that can be configured however you want, so you could keep snapshots for weeks or months ect whatever works best for you. They have a FAQ page which looks helpful. I will note that I have not used rsnapshot myself but from what I see of it it looks like a great tool and it will be my goto for this kind of thing.

          – Jeff
          Mar 19 at 12:21













          @Alschmitt44 if this solution solved your problem you asked please upvote and accept the answer. You can accept the answer by selecting the checkmark to the left of the answer.

          – Jeff
          7 hours ago







          @Alschmitt44 if this solution solved your problem you asked please upvote and accept the answer. You can accept the answer by selecting the checkmark to the left of the answer.

          – Jeff
          7 hours ago




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Ask Ubuntu!


          • 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%2faskubuntu.com%2fquestions%2f1126268%2frsync-with-crontab-help%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 did Captain America manage to do this?

          迪纳利

          南乌拉尔铁路局