Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I tar my /home/username and create the .tar file in /home/username, then I get an error of the sort . file changed as we read it probably because the directory file itself is changing due to the creation of the .tar file. Of course I could have the file created one level up in /home but that would require sudo or a login. I want to archive and restore without sudo and a re-login.

I don't want to nest the .tar file deep somewhere in /home/username that is less convenient and I suspect that might not even solve the problem.

share|improve this question
up vote 7 down vote accepted

You can try to create file in /tmp directory.

share|improve this answer
@brunopereira81 points out that people should pay attention to what /tmp is. "tmp" means temporary so copy it to something like a DVD. – H2ONaCl Oct 5 '11 at 0:54
@brunopereira81 points out /tmp is not private. – H2ONaCl Oct 14 '11 at 14:48

You can use the --exclude= flag to create one archive that ignores a directory were you are writing your backup to.

Make a /home/<username>/Backups folder.

Try it like this (replace any other extra options and the file you want to create): tar <extra options> /home/<username>/Backups/yourhomefolderbackup.tar.gz --exclude=/home/<username>/Backups/ /home/<username>/

This way you can save your backups, make new ones, remove them, burn them without the worry that if you reboot your machine your previous backups are deleted (that will happen if you are saving them to /tmp, once you reboot your backups are gone!).

Also you should use the --exclude= to exclude the /home/<username>/.local/share/trash folder (or where is your .trash folder at. EDIT: In Ubuntu its located at /home/<username>/.trash) from the archive you are creating or your trash will be added to the backup you are creating. Just add another --exclude=/home/<username>/.trash after the first --exclude= and that is all!

Hf, gl ;)

share|improve this answer
That's not what was said ;) You are creating and archive under your home that contains your home files and directories except you archive file. – Bruno Pereira Oct 3 '11 at 12:16
Saw a fault, fixed it. – Bruno Pereira Oct 3 '11 at 12:19
I also like this answer. – H2ONaCl Oct 3 '11 at 13:52
Yeah, I know. There is always 100 ways of frying an egg, not all of them will make good fried eggs! ;) (included reasons why you should save to /home backup folder and not to /tmp, the /tmp version is still valid ofc) – Bruno Pereira Oct 3 '11 at 14:14
Added instructions to remove your .trash folder so it doesn't show (is added) on your backup archive. – Bruno Pereira Oct 3 '11 at 14:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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