11

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...

4

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.

  • Thanks Florian, I did that and get the following ( astra3177:~# ./backups/fullserver.sh tar: /backups/fullbackup.tar: Cannot open: No such file or directory tar: Error is not recoverable: exiting now ) – Bill Bird May 2 '15 at 18:16
  • Most likely the folder /backup/ doesn't exist. Use another one or create it using sudo mkdir /backup/ – Florian Diesch May 2 '15 at 18:40
  • The folder is ( backups) and the file .sh is inside it. maybe a problem with folder's permission ( chmod ) ? – Bill Bird May 2 '15 at 18:55
  • I found it YEEEEESSSS, in fact, I should remove "/" from ( /backups/fullbackup.tar), so now it is like that ( backups/fullbackup.tar, and it is work :) – Bill Bird May 2 '15 at 18:56
10

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/

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.