LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Command to perform Full and Differential backups (https://www.linuxquestions.org/questions/linux-newbie-8/command-to-perform-full-and-differential-backups-4175623365/)

ceantuco 02-08-2018 03:46 PM

Command to perform Full and Differential backups
 
Hey Guys,

I have searched the net and found a few ideas/solutions to perform full backups using the TAR utility. I would like to perform a weekly full backup (Saturdays) and daily differential backups (Su-Fri) for a folder located on a Ubuntu server.

So far I have tried:

Code:

tar puvf /mnt/backup/test.tar /foldertobackup
but this duplicates the folders on the tar file

I also tried:

Code:

tar Gpcvf /mnt/backup/test.tar /foldertobackup/
and it seems to create a new one tar

Server: Ubuntu Server 16.04

Thank you

michaelk 02-08-2018 05:41 PM

tar can be used to create an incremental backup using the --listed-incremental option. If the snapshot file does not exist or if you use the --level=0 option then a full backup (level 0) is performed otherwise it is a level 1 backup.

Code:

tar --listed-incremental=snapshot.file -cvzf backup.tar.gz /path/to/dir
https://www.gnu.org/software/tar/man...tal-Dumps.html

Always verify your backups...

ceantuco 02-09-2018 08:02 AM

Thank you. I will read the documentation on the link below, test and verify my backups.

fatmac 02-09-2018 12:53 PM

You will likely be better served to use rsync, take a look at it's man page - it is what most back up programs use. :)

Also, look into cron to do the work for you.

scasey 02-09-2018 02:23 PM

+1 for rsync -- and rsnapshot to control and manage it with minimum effort.

ceantuco 02-13-2018 09:11 AM

Thank you guys for your responses! After testing different scenarios I will use Rsync for incremental backups and tar for weekly full backups. Thank you so much!


All times are GMT -5. The time now is 05:40 PM.