how to reinstall OS without affecting /home folder

Asked by rmccaman

How can I reinstall ubuntu root(/) with out affecting existing files in /home folder or involving a mounted second hard drive?

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Jim J (morlockhq) said :
#1

I don't know if this will solve your issue specifically, but generally I always partition my hard drive so that the /home directory is on a separate partition. This allows the flexibility of reinstalling Ubuntu (or even another distribution) without affecting the home directory.

If you have partitioned your drive in this way, you just have to point your next installation at the partition where you have stored your /home directory in the past and make sure to mount it as /home. Also make sure to mark it so that it does NOT get formatted.

This can save some headaches down the road.

In your case, if you haven't done this, I would probably make a backup of the /home directory using something like:

sudo tar -cvzf backupofhome.tgz /home

from the root directory

then burn this to CD or DVD (or to USB disc or large jump drive). Then, after making sure that your backup is good (you might try a test restore of some of the files in another directory), wipe the drive and reinstall the OS. At this time, you could partition the /home directory to be on its own partition. Make sure you choose the same username during the install as you used last time.

Then when you are all done, restore your tar file:

sudo tar -xvzf backupofhome.tgz in the / directory.

I hope this helps.

Jim

Revision history for this message
John McCabe-Dansted (gmatht) said :
#2

I think that the Ubuntu installer can resize your partitions. If you have over 3GB of space free you should be able to create a new partition (preferably over 5GB in size), and install onto that partition. Then once you have the new version of Ubuntu running you can set your user directory to be the same as your old directory in System->Administration->Users and Groups->Advanced->Home directory.

If you don't have enough space free you could delete all the stuff in /usr etc. before you repartition your drive.

BTW, why do you want to reinstall Ubuntu?

Revision history for this message
Daniel de Souza Telles (danielsouza) said :
#3

Copy the /home and save to a location, reinstall all the OS and paste the /home do the disk again, I think this work but you can copy only the configuration you need or the files, to have a better compatibility.

Can you help with this problem?

Provide an answer of your own, or ask rmccaman for more information if necessary.

To post a message you must log in.