I'm using tar to backup my entire file system with the following command

tar -cvpzf test/backup.tar.gz / --exclude=/test

And I'm getting the following error

tar: test/backup.tar.gz: Cannot write: Broken pipe
tar: Child returned status 2
tar: Error is not recoverable: exiting now

Can anybody tell me how to fix the problem?

closed as off-topic by phk, countermode, Rui F Ribeiro, user34720, Archemar Jun 13 '17 at 14:24

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – phk, countermode, Rui F Ribeiro, Community, Archemar
If this question can be reworded to fit the rules in the help center, please edit the question.

  • does the folder test exist? If not, just create it, with mkdir test! – marc Jun 6 '17 at 16:23
  • Yes, I'm running in that directory – Nicole Louise Jun 6 '17 at 16:24
  • Then just run cd .. and re-execute the tar command! Just as side info...I would rather backup the system with a live os booting from a USB pendrive for example and the running the backup. You can for instance use rsync for that among lot of other available tools! – marc Jun 6 '17 at 16:25

That error probably means that the test directory doesn’t exist in the current directory, or that it’s not writable. Perhaps

tar -cpvzf /test/backup.tar.gz / --exclude=/test

is closer to what you meant.

  • Got it to work with that command! Thank you! – Nicole Louise Jun 6 '17 at 16:29

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