Ubuntu – Why I get “tar: Cowardly refusing to create an empty archive”? when trying to backup the whole server

backupservertar

I am new at ubuntu and dealing with servers. I use Ubuntu 16.04 x64. I want to have a backup for my entire system, So I followed this video https://www.youtube.com/watch?v=KTayZIou-1M

I type this command

sudo tar -cvpzf mybackup.tar.gz --exclude=/backup/mybackup.tar.gz --one-file-system 

But I got this error

tar: Cowardly refusing to create an empty archive

Then I realised that I forget to add '/' after '–one-file-system'
So I add it.

sudo tar -cvpzf mybackup.tar.gz --exclude=/backup/mybackup.tar.gz --one-file-system/

and get this error

tar: unrecognized option '--one-file-system/'

Thanks in advance.

Best Answer

Add a space before the / at the end of your command. Change your:

sudo tar -cvpzf mybackup.tar.gz --exclude=/backup/mybackup.tar.gz --one-file-system/

to

sudo tar -cvpzf mybackup.tar.gz --exclude=/backup/mybackup.tar.gz --one-file-system /