After installing Ubuntu 12.04 and electing to encrypt my entire home directory, I am now wondering what the best way would be to back up the data here.

I backed up the rest of my file system with the command

tar -cvpjf sysbackup.tar.bz2 --exclude=/sysbackup.tar.bz2 
--exclude=/sysbackup.log --exclude=/home --one-file-system / 1> sysbackup.log

(and the boot/efi partition in a similar way), but I am unsure what do about the /home/user directory.

Option 1) Backup the encrypted /home/.encryptfs/$USER/.Private and /home/.encryptfs/$USER/.encryptfs dirs. Then in the future, in case of disaster, recover it to access files with sudo ecryptfs-recover-private, as detailed here, from a live-CD. With the rest of my system backup, I could format and partition as before with gParted, then restore /, /home/.encryptfs/$USER/.Private and /home/.encryptfs/$USER/.encryptfs. Downside: possibly no tar compression, and probably no way to exclude subdirs.

Option 2) When I log in, the home dir is mounted with all files unencrypted automatically, so presumably I could simply make a tar of everything here (the .encryptfs and .Private in /home/$USER are just symlinks to the real encrypted data at /home/.encryptfs/$USER/...I think they may have something to with launching the auto-mount on login? So I won't include these in backup)

The problem I see with Option 2) in the event of system failure, it might not be possible just to format and partition the disk from the live-CD, restore / and then simply restore /home/$USER because now /home/.encryptfs would be missing, so this might lead to issues, with Ubuntu expecting encrypted home and trying to unexcrypt and mount the private directories normally in /home/.encryptfs but not finding these.. (A secondary downside would be the tar is not stored in encrypted form, although gpg or deja dup could solve that concern anyway).

What I'm really asking is: if the system died, and I had to boot up via a live CD, format my linux partition and get out my backup, let's say it's on a USB stick, would I be able to simply mount the partion to /media/whatever extract everything excluding home from the backup of / ( via sudo tar -xvpzf /media/USB/path/to/backup.tar.gz -C /media/whatever --numeric-owner), then create a /media/whatever/home/$USER and simply copy all my plain-text home dir there...and then reboot and get a system as it always was, or would the fact that I previously had an encrypted home dir cause some issue upon reboot? would something in the way encryptfs start to complain (and maybe not load my home dir properly), or would things be totally fine?

I suppose this is equivalent to if right now I just deleted my encrypted /home/$USER and /home/.encryptfs dirs (after unmounting on another user acc etc etc) then recreated my /home/$USER contents with the plain text files..I tried this experiment on a virtual machine and everything seemed to go through just fine, so I think encryptfs would not mess things up...(perhaps so long as the symlinks in the home dir are gone?)

  • 2
    I asked a similar but not identical question here: askubuntu.com/questions/176268/… Dec 24, 2013 at 21:27
  • Ubuntu stopped using encryptfs in favor of LUKS partition encryption for security reasons long time ago. This question is not relevant any more.
    – user68186
    Dec 18, 2021 at 23:19

1 Answer 1


Option 1 is generally recommended. You don't get compression, but you can exclude sub-directories. It it can be a pain to figure out how the names have been mangled, but the directory hierarchy is preserved.

You do need to practice recovering from this or any other backup scheme, and the advice at How to safely back up the "Private" folder? is good on how to test that out.

Option 2 means you have to do something to protect the backup data.

You must log in to answer this question.

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