Announcement

Collapse
No announcement yet.

Backing up /home from the command line

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Backing up /home from the command line

    Dear all,

    Got a fairly simple question that shouldn't prove too hard, but still, I'm struggling anyway. I'd appreciate any help I could get on it.

    I have an encrypted /home partition. I want to back it up - but simple drag and drop copy from my /home to a (vfat) USB drive fails repeatedly. The specific failure is that it gets some way through the process and then tells me that it cannot create a folder. This causes the whole thing to fail, and stop. It happens repeatedly, and even if I remove that folderset from the backup and try again, it seems to happen again later with another folder. I kept going like this, repeatedly removing folders from the backup - but it keeps failing.

    I have stopped trying now that it fails on my ./thunderbird folder. I really need my e-mails!! I can't afford to not have it back that one up...!

    I need to find a way to back up my data and be sure that I have everything. However, because I currently have a problem with apt-get (see this post: ) I cannot currently install new software to do it.

    So I'm looking for alternative solutions. How can I do this from the command line? Is this possible?

    I can boot to a GUI using the nouveau driver, and I can log in to my account. As such, the partition is decrypted whilst I have access to it. But is there anything getting in the way of me backing up the data on this partition? Why am I not able to make a backup with a simple drag and drop?

    What alternatives are there for making a full decrypted backup from the command line, and if possible, verifying it at the same time etc?

    I intend to make a clean install of 12.04 once I have the full back-up made, so this only needs to be a simple, do-once solution that works. It does not need to be a perfect long-term solution that I can use repeatedly with incremental backups etc.

    Your help would be really appreciated.

    Many thanks in advance,

    Bag.

    #2
    After you log in, drop to a Konsole and try to cp someplace, as I mentioned in the other thread. I'd suggest copying to a folder on your hard drive outside /home, to avoid any potential interactions with USB problems.

    First make the directory:
    Code:
    sudo mkdir /save
    Then take ownership of that:
    Code:
    sudo chown $USER:$USER /save
    Now copy files:
    Code:
    cp -r $HOME/* /save
    Let us know how this works.
    Last edited by SteveRiley; Jun 25, 2012, 11:26 PM.

    Comment


      #3
      I hate to highjack, but have a stupid question. I assume once you log in the data in NOT encrypted anymore? I usually just tar up my ./home directory, but was afraid to advise because I know nothing about how encryption works. The sounded like the OP was having problems with file/folder permissions. The "p" option when creating a tarball will preserve permissions. Using something like
      Code:
      sudo tar -cvzpf /home/Backup.tgz
      will zip up your ./home directory into a tarball named Backup.tgz.
      Klaatu Barada Nikto

      Comment


        #4
        Steve,

        OK, so I did that. Seemed to do most things - but threw up the following complaints...

        Code:
        ~$ cp -r $HOME/* /data/save
        cp: cannot open `/home/markh/Dropbox/.dropbox.cache/.~5958074485471609210HI' for reading: Input/output error
        cp: cannot open `/home/markh/Dropbox/.dropbox.cache/.~2140134469733055943HI' for reading: Input/output error
        cp: cannot open `/home/markh/Pictures/thumbnails-digikam.db-journal.old' for reading: Input/output error
        cp: cannot open `/home/markh/Pictures/digikam4.db-journal.old' for reading: Input/output error
        To be fair, I dont' think I need them. Dropbox will sync later on its own, and the digikam files are older versions. However, I noted that it did not seem to copy across any config files. In particular, I really need to back up my thunderbird folder which contains all my e-mails etc.

        What would be the command to back those up as well?

        67GTA - Thanks for your comments. Will try that later if you don't mind - although can you tell me if it will pick up the config files too?

        Thanks all,

        Bag.

        Comment


          #5
          Have you checked whether everything else in your original home folder was copied successfully? The bits mentioned in the error messages are, as you surmised, not important to preserve.

          Comment


            #6
            Oh wait, I see you mentioned that config files weren't copied. I forget -- where does Thunderbird store its config files?

            Comment


              #7
              Originally posted by bag View Post
              Code:
              ~$ cp -r $HOME/* /data/save
              ...
              However, I noted that it did not seem to copy across any config files. In particular, I really need to back up my thunderbird folder which contains all my e-mails etc.
              Yes, I think "$HOME/*" selects all non-hidden files in $HOME. (The subtleties of globbing.) You clearly need the hidden (.dot) files as well!

              Any command that just specifies a directory not "*" should be fine, so
              Code:
              cp -r $HOME/ /data/save
              should work (not tested). The tar command above should be fine.
              Or
              Code:
              cp -r $HOME/* $HOME/.* /data/save
              Personally I prefer rsync ... I do some of my backups with a command like this
              Code:
              rsync -Prh --out-format "%i%12l %M %n%L" --stats /drive/DATA/Documents/ /media/GoFlexA1/Backup/ -t --links --safe-links --one-file-system
              ... but you certainly don't need all those options!
              Code:
              rsync -Prti $HOME/ /data/save/
              should be sufficient for you.
              I'd rather be locked out than locked in.

              Comment


                #8
                Originally posted by SteveRiley View Post
                I forget -- where does Thunderbird store its config files?
                I bet you can guess ... ~/.thunderbird
                (The other guess might be ~/.mozilla/thunderbird but I don't have any thunderbird files there.)
                I'd rather be locked out than locked in.

                Comment


                  #9
                  Originally posted by SecretCode View Post
                  Yes, I think "$HOME/*" selects all non-hidden files in $HOME. (The subtleties of globbing.) You clearly need the hidden (.dot) files as well!

                  Any command that just specifies a directory not "*" should be fine
                  Duh! You're absolutely right. Silly me. I just tested it, works fine when omitting the asterisk.

                  Comment

                  Working...
                  X