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.
Daniele BrunengoIT Consultant, Web DesignerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sikhumbuzo NtsadaIT AdministrationCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.