10

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?

4 Answers 4

8

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.

1
  • 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, 2010 at 18:02
2

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

2

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.

0

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.

3
  • can i do this logged in under the same user profile i want to move?
    – NES
    Dec 14, 2010 at 14:27
  • yes you can but dont cut i.e dont move your home directory, copy it
    – binW
    Dec 14, 2010 at 14:52
  • Please note that this answer will copy your data from an encrypted home directory to an unencrypted directory. Dec 14, 2010 at 16:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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