Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How can i move a enrypted home directory to another partition? Are there differences between moving an unencrypted home directory to another partition and an encrypted home directory?

Perhaps does Ubuntu installer offer an option to place your home directory on an other partition?

share|improve this question

4 Answers 4

up vote 7 down vote accepted

I am assuming you want to keep your data encrypted on the new partition.

First close all running applications, we don't want files being updated during the copy. Copy the encrypted data to the new partition:

ecryptfs-umount-private
chown $USER /new_mount_point/$USER
rsync -avP $HOME/.Private $HOME/.ecryptfs /new_mount_point/$USER
editor /etc/passwd # Change the user's home dir to point to the new location

Log-off Log-in

If you want to move/copy an encrypted home you only need to copy/move ~/.Private and the encryption keys (~/.ecryptfs). If you want to copy/move to an unencrypted location just copy everything except .Private and .ecryptfs.

share|improve this answer
    
thanks, now i just have to learn how i can create a new partition with mountpoint by splitting an existing partition. will open a new question for that. –  NES Dec 14 '10 at 18:02

After half a day of getting confused trying to move an encrypted home to a new drive with ubuntu 10.04 I eventually found this thread.

mount your new drive
make a new folder on it with your user name
make sure your the owner of it

chown $USER /new_mount_point/$USER

if your file structure under home looks like this

  • home/user/.Private
  • home/user/.ecryptfs
  • home/.ecryptfs

use this replacing $HOME and $USER otherwise try How can i move an encrypted home directory to another partition?

ecryptfs-umount-private
rsync -avP $HOME/$USER/.Private $HOME/$USER/.ecryptfs /new_mount_point/$USER
rsync -avP $HOME/.ecryptfs /new_mount_point

rename your home folder to something else "homeold"
make a new folder called home

Edit your fstab
mount the new drive to /home

Restart

share|improve this answer

There's another way to do this still:

Using the Ubuntu Help page found at https://help.ubuntu.com/community/Partitioning/Home/Moving

That tutorial will show you how to move an unencrypted partition, but the tweak I used for moving an encrypted partition was to follow that tutorial with the following difference in commands. My explanation for why I did it this way may need some corrections from someone who knows more than me, so please edit or comment if you have time.

  1. Create your partition in Gparted, and give it a label that you will easily recognize. Some of us have too many disks and partitions to remember by numbers.

  2. Before using rsync to copy the files over, unmount your encrypted home using ecryptfs-umount-private. The reason I did this was because rsync seemed to copy the mounted/unencrypted stuff AND the .Private ecryptfs thingies. You only need the .Private and .ecryptfs folders mentioned in the earlier posts.

  3. To copy the files, enter the command "sudo rsync -aVP /home/ /media/home/" instead of using " sudo rsync -aXS --exclude='/*/.gvfs' /home/. /media/home/. " as the tutorial says.


a note on the output from the command "sudo diff -r /home /media/home"

The diff command did report a long list of differences in my case, but I think that was because I was still using Firefox and opening a bunch of documents which changed bookmarks,history etc. I checked my files after completing all of the steps in the tutorial and didn't notice anything missing. After restarting, Firefox reopened a session with a bunch of tabs that I had closed long before copying the files over, hence my assumption about the output of the diff command.

share|improve this answer

Copy your home directory to other partition and then use System->Administration->Users & Groups to open user settings dialog. Click on the keys icon to authenticate your self

alt text

After that select the user that you want to change and click properties, go to advanced tab

alt text

change the home directory to new directory i.e the directory that you copied to other partition.

share|improve this answer
    
can i do this logged in under the same user profile i want to move? –  NES Dec 14 '10 at 14:27
    
yes you can but dont cut i.e dont move your home directory, copy it –  binW Dec 14 '10 at 14:52
    
Please note that this answer will copy your data from an encrypted home directory to an unencrypted directory. –  João Pinto Dec 14 '10 at 16:36
    
thanks for the hint. –  NES Dec 14 '10 at 17:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.