Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating incremental backup with tar - --listed-incremental -g

Tags:

bash

tar

backup

I have problem with the tar linux program. I would like to create a incremental backup. I use following tar command for the first full backup:

tar --create --gzip --listed-incremental=$SAVEDIR/backup.snar --file=$SAVEDIR/$DATE.tar.gz $EXCLUDE $DIRECTORY

$EXCLUDE contains for example "--exclude test/testdir --exclude test/testdir2" $DIRECTORY contains "-C /Users/user1/Desktop/ test"

If I execute the command I get following error:

tar: Option --listed-incremental=/Users/hofmeister/Desktop/test/backup.snar is not supported
Usage:
  List:    tar -tf <archive-filename>
  Extract: tar -xf <archive-filename>
  Create:  tar -cf <archive-filename> [filenames...]
  Help:    tar –help

If I change the --listed-incremental option to -g =$SAVEDIR/backup.snar. I get:

Usage:
  List:    tar -tf <archive-filename>
  Extract: tar -xf <archive-filename>
  Create:  tar -cf <archive-filename> [filenames...]
  Help:    tar --help

What went wrong? I use following version of tar: bsdtar 2.8.3 - libarchive 2.8.3

The problem is the tar version which is bsd. With macports you could install gnutar. Here everything works fine!

like image 690
Andre Hofmeister Avatar asked Nov 07 '25 08:11

Andre Hofmeister


1 Answers

Looks like you're using bsdtar, and not the gnu tar. bsdtar doesn't support incremental backups. They have slightly different flags too.

like image 64
k107 Avatar answered Nov 10 '25 09:11

k107



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!