What's the best practice for backing up encrypted Ubuntu home dir?












3















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?)










share|improve this question
















bumped to the homepage by Community 8 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 2





    I asked a similar but not identical question here: askubuntu.com/questions/176268/…

    – ImaginaryRobots
    Dec 24 '13 at 21:27
















3















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?)










share|improve this question
















bumped to the homepage by Community 8 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 2





    I asked a similar but not identical question here: askubuntu.com/questions/176268/…

    – ImaginaryRobots
    Dec 24 '13 at 21:27














3












3








3








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?)










share|improve this question
















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?)







backup encryption home-directory ecryptfs






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 26 '13 at 13:28







fpghost

















asked Dec 24 '13 at 17:31









fpghostfpghost

83721731




83721731





bumped to the homepage by Community 8 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 8 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.










  • 2





    I asked a similar but not identical question here: askubuntu.com/questions/176268/…

    – ImaginaryRobots
    Dec 24 '13 at 21:27














  • 2





    I asked a similar but not identical question here: askubuntu.com/questions/176268/…

    – ImaginaryRobots
    Dec 24 '13 at 21:27








2




2





I asked a similar but not identical question here: askubuntu.com/questions/176268/…

– ImaginaryRobots
Dec 24 '13 at 21:27





I asked a similar but not identical question here: askubuntu.com/questions/176268/…

– ImaginaryRobots
Dec 24 '13 at 21:27










1 Answer
1






active

oldest

votes


















0














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.






share|improve this answer

























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f395283%2fwhats-the-best-practice-for-backing-up-encrypted-ubuntu-home-dir%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    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.






    share|improve this answer






























      0














      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.






      share|improve this answer




























        0












        0








        0







        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.






        share|improve this answer















        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.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Apr 13 '17 at 12:24









        Community

        1




        1










        answered May 18 '15 at 18:50









        nealmcbnealmcb

        2,0342444




        2,0342444






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f395283%2fwhats-the-best-practice-for-backing-up-encrypted-ubuntu-home-dir%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            數位音樂下載

            When can things happen in Etherscan, such as the picture below?

            格利澤436b