I've recently created a tarball backup of my Ubuntu system (/ and /home partitions both ext4). When I was creating a backup I booted off Live DVD and I used a tar command. Now I wonder which would be the best way to untar the gzipped archive in order to restore the system. More specifically, if I should add --numeric-owner switch at the end of the tar command? I heard that it might be needed to preserve an original ownership permissions. Otherwise, I would get those from a storage media and there could be a mismatch. On the other hand, both times I use Live DVD to boot from, so maybe it's irrelevant in my particular case?


In this situation you should use the tar --numeric-owner option.

The files in the archive were created using the user IDs from the /etc/passwd file that's in the archive.

It's possible that users and groups exist in the archive with different numeric IDs than on the Live DVD image.

Even if you ran the same Live DVD each time, there can still be different user or group IDs in the /etc/passwd and /etc/group files.

There are situations where you might not want to use the --numeric-owner option. Section 8.2, Handling File Attributes, in the GNU tar manual contains more information on this topic.

  • What do you mean when you said "Live DVD image"? and what packages you were referring to in your 3rd paragraph? – Gregory Feb 6 '16 at 14:49
  • @Gregory "Live DVD image" refers to the copy of the operating system that you were running when you made the archive. I've edited this answer to clarify that the real problem is with user names with different numeric IDs. Non-existent user names are not really a problem because tar will use the numeric ID if the user name is not in the passwd file. My statement about non-existent users from adding packages was actually irrelevant. Thanks for your question and comment. – RobertL Feb 8 '16 at 9:38

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.