Why I get "Cowardly refusing to create an empty archive" with TAR command?

I'm trying to follow this tutorial to full backup my linux / Ubuntu 12.04 after a fresh restore.

my code in fullserver.sh:

tar -cvpf /backups/fullbackup.tar --directory=/ --exclude=proc
--exclude=sys --exclude=dev/pts --exclude=backups .

gives after executing ./backups/fullserver.sh the following error:

tar: Cowardly refusing to create an empty archive Try `tar --help' or `tar --usage' for more information.
./backups/fullserver.sh: line 2: --exclude=sys: command not found

Any help to resolve this issue? I read somewhere that I have to remove "/" from the tar line, but I'm not sure that this is true...

3 Answers

I encountered this warning when trying to execute the command without specifying the zipped file name. For example:

tar -zcvf directoryName

The warning was not issued when I executed this:

tar -zcvf directoryName.tar.gz directoryName/

The command should be just one line:

tar -cvpf /backups/fullbackup.tar --directory=/ --exclude=proc --exclude=sys --exclude=dev/pts --exclude=backups .

It seems you've split it into two lines.

4

I recently got that error too. Turns out I forgot to specify the files to add to the archive:

tar -cf hello.tar

After I selected the current directory as the files to add, it worked:

tar -cf hello.tar ./*

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like