• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3372
  • Last Modified:

Copy Ubuntu Home folder to a new installation

Hello, let me say first of all that I'm an Ubuntu newbie. I am trying to do something a customer asked me to do: recover his Home folder from a broken Ubuntu install and copy it (including hidden subfolders) to a new Ubuntu install.

Although the old Ubuntu doesn't boot and doesn't show up as an OS in any way, I can access the drive and see the Home folder using any live cd.

There are hidden folders which I'm not able to copy because I don't have read permissions. So can anybody point me to the best way to copy the whole Home folder somewhere else, as to recover this Ubuntu install? Thanks in advance.
0
Daniele Brunengo
Asked:
Daniele Brunengo
1 Solution
 
Sikhumbuzo NtsadaCommented:
Ubuntu has a comprehensive step by step for this here.

Preferable, use Ubuntu as your live CD to follow the commands given on the tutorial.
0
 
TobiasHolmCommented:
Copy the old home-folder to an external drive using rsync.

- Connect an extra hard drive to the the computer (USB or SATA) for the home-backup/transfer.
- Boot a live Ubuntu from USB-stick or USB-harddrive.
- Check where the old home folder is by starting a terminal (CTRL+T) and using
$ sudo fdisk -l
$ mount
$ df -h
- With the help of the above commands you should be able to figure out where the old home is and the extra backup/transfer disk.
- Replace USERID with the users username, like "joe". Check the username with (assuming your old home folder is mounted at /media/old/home/) :
$ls -l /media/old/home/
- Copy the old home folder to the extra disk. I'll assume the old home is at /media/old/home and the extra disk is at /media/extradisk. Do a test first:
$ sudo rsync -avn /media/old/home/USERID/ /media/extradisk/home/USERID/
If it seems to work, remove the "n" switch and run a sharp rsync:
$ sudo rsync -av /media/old/home/USERID/ /media/extradisk/home/USERID/

Check that the data size matches:
$ sudo du -hsc /media/old/home/USERID/*
$ sudo du -hsc /media/extradisk/home/USERID/*

Install the new Ubuntu installation. Don't overwrite the old disk, it's good to save as backup!

When finished, copy the old home to the new Ubuntu installation:
- Connect the extra hard drive to the the computer.
- Check where the old home folder is by starting a terminal (CTRL+T) and using
$ sudo fdisk -l
$ mount
$ df -h

- Copy the old home folder to the new disk. I'll assume the old home is at /media/extradisk/home and the new disks home is at /home. Do a test first:
$ sudo rsync -avn /media/extradisk/home/USERID/ /home/USERID/
If it seems to work, remove the "n" switch and run a sharp rsync:
$ sudo rsync -av /media/extradisk/home/USERID/ /home/USERID/

Check that the data size matches:
$ sudo du -hsc /media/extradisk/home/USERID/*
$ sudo du -hsc /home/USERID/*

Check that the old user id is the same as the new one. Show current users id:
$ id
Show id of old user in the files you just copied:
$ ls -l /home/USERID
If the user id's don't match, you can change them with
$ chown -R newuserid:newuserid /home/USERID

Reboot the new Ubuntu and test!
0
 
Daniele BrunengoIT Consultant, Web DesignerAuthor Commented:
@ Sikhumbuzo Ntsada: Are you sure this is the right guide? It's about "Use Ubuntu Live CD to Backup Files from Your Dead Windows Computer", but the problem here is with a Ubuntu computer, not Windows. Also, I can mount all drives with no problem, but I can't get permissions to copy the Home folder somewhere else.

@TobiasHolm: I'll try this out and let you know.
0
 
gheistCommented:
Connect both systems. Start SSHD on old.
rsync -avz old:~/ ~/
0
 
Daniele BrunengoIT Consultant, Web DesignerAuthor Commented:
Thanks, that worked.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now