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
boot/efi partition in a similar way), but I am unsure what do about the
Option 1) Backup the encrypted
/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/.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
/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/.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?)