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!
Best 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 thenrsync -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 usingrsync
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.