I just created a rootfs with debootstrap in a Debian Jessie VirtualBox VM. Now I would like to transfer this to the host, by first compressing the directory to a tar archive, so I can upload it and download it again on the host.

I want the tar archive to preserve permissions and make an exact copy of the rootfs. So I used tar -czpvf --one-file-system like the Arch Linux Wiki suggests. However I get "tar: Exiting with failure status due to previous errors", those previous errors seem to "tar: $path: Cannot open: Permission denied" errors. I am afraid that running tar as root will modify the ownership/permissions of the files and directories in the rootfs folder. How do I preserve the permissions and ownership of this rootfs when compressing it to a gzipped tar?


1 Answer 1


To make a copy of a filesystem as you want you have to be root. In addition you need a "clean version". As such you want to use a bind mount of your root so you get the entire filesystem as is. You may even be able to bind mount read only if you're worried about tar.

You must log in to answer this question.

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