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.

  • 1
    Please check your question, your two commands appear the same, and there is a missing space implied in your error message (the message which doesn't match your command as currently written).
    – guiverc
    Feb 13, 2020 at 11:08
  • my bad sorry, I edited the '/' in the second command. Feb 13, 2020 at 12:20

3 Answers 3


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/


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

Just for completeness:

A simple invocation of tar might be something like: tar cf foo.tar file1 file2 file3. This tells tar to create an archive in a file named foo.tar containing file1, file2 and file3. (Note that with tar, the - before the "command" arguments is optional, so you can use cf or -cf as you see fit).

Eliminating some other (somewhat irrelevant, for the moment) flags, your first invocation is essentially equivalent to tar cf foo.tar. Like above, this tells it to create an archive in a file named foo.tar, but it does not tell it any files to put into the archive. And that's what the error message is telling you: since you haven't specified any files to archive, there's no point in creating an archive to contain nothing.

When you add the / (and properly separate it from the other parameters), that tells it what files you want to add to the archive, so now it can create an archive that actually contains something (so, barring other errors, it'll do so).

  • 1
    Great explanation of why the original command failed.
    – TripeHound
    Feb 14, 2020 at 14:32

Because you never told it to back up anything

You have

  • the command tar
  • some options that go before the tar file name: -cpzvf
  • the tar file name: mybackup.tar.gz
  • some options that go after the tar file name: --exclude=/backup/mybackup.tar.gz --one-file-system

and then nada. You do not specify a directory to back up. That is a required argument, as you might guess.

Then you caught yourself, and you added the /, but thought it was a modification of an option, rather than a parameter all its own.

The / is a directory. It is the root directory. Saying that in this context means "back up the entire filesystem".

As Peter discussees, tar is not the best way to back up a boot volume. Not least, leaving the tarball on the boot volume does nothing for you if the disk fails.

  • Plus, backups shouldn't contain the previous backup.
    – wizzwizz4
    Feb 14, 2020 at 21:58
  • 1
    They don’t, if exclude means what I think it means.
    – WGroleau
    Feb 15, 2020 at 20:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .