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.

I have /home on a separate partition. I want to reinstall Ubuntu.

I don't want to lose my personal files in /home (I already have a backup but I would like to avoid the hassle of restoring the backup). I know how to reinstall Ubuntu using an existing /home partition without formatting it, but I don't want any configuration from previous Ubuntu to be in the new install.

In other words, I would like a new and fresh install of Ubuntu, with my previous personal files in /home but WITHOUT any configuration file from the previous Ubuntu install. Is this possible? How could I accomplish that?

I was thinking about manually deleting all the hidden configuration files in /home (those starting with a "dot") from the Live CD before starting the installer, but I'm not sure if the file permissions will allow me to delete those files and I'm also not sure if that will be enough to not bring any configuration setting from the previous install. I thought it would be good to ask here before trying to do that, for "safety" reasons ;)

share|improve this question
    
+1 - this question is something that I've often wondered but never had to worry about. –  jrg Aug 7 '11 at 19:42
add comment

5 Answers 5

I've done this quite often now - almost every time I did upgrade my system or (especially) if I switched to another distro. I normally log out, go to a console and log in as root directly (or depending on system configuration, as another user and switch to root), cd to /home folder and simply change my user's home folder name e.g. to "myUserName.bak". e.g.:

sudo mv /home/myUserName /home/myUserName.bak

After installation I can safely move all data needed to the newly created home folder for my user. (That's also a good point for thinking whether you e.g. really need that folder of big files you never touched the last 2 years ;) )

edit as suggested by comments: before you can access the files and folders from your renamed home folder you have to

sudo chown -R newUser.newUsersGroup /home/myUserName.bak
share|improve this answer
    
Can you access all files in the renamed folder after fresh Ubuntu installation ? –  Vincenzo Aug 7 '11 at 20:17
    
sure - no prob. as long as you "chown -R user.group myUserName.bak" after the reinstallation –  Roland Kohn Aug 8 '11 at 5:40
    
I installed a fresh 12.04 as per your valuable guidance. My user name is : 'aliyans'. I issued the following in a terminal:groups aliyans. And the output was: aliyans : aliyans adm dialout cdrom plugdev lpadmin admin sambashare debian-tor jupiter. So, what will be the change to newUser.newUsersGroup in my case? Will it be like sudo chown -R aliyans.aliyans.adm.dialout.cdrom.plugdev.lpadmin.admin.sambashare.debian-tor jupiter /home/myUserName.bak ? –  001neeraj Aug 7 '13 at 6:20
add comment

This is what I always do:

On the livecd I mount the /home partition and use the command

sudo chown -hR  ubuntu /path/to/home/drive

The ubuntu gives ownership to the username ubuntu (the live cd's username is ubuntu) andfolder the path is whatever the drive is mounted to. On the live cd this is usually in /media/ and the name is made up of many numbers a letters.

Now delete all the config files (files and folders beginning with a dot), but I do leave a few (such as .minecraft for my game saves). Its not just folders but also files beginning with a dot.

During the installer. Go to the custom partition manager. Set your partition as mount point /home (by clicking on it and selecting edit or change, or whatever they call it now), and leave it so it is not formatted, (in the F column of the drives list check marks mean it will be formatted) and set your OS partition (one with system files) as mount point / and DO format that one.

HOWEVER

After you finish the install and login your home drive will be useless since its ownership is still on ubuntu. to change it again run

sudo chown -hR YourUsernameHere ~/
share|improve this answer
    
+1 for confirming that a partition can be left without formatting on the installation. –  Thiago F Macedo Jun 8 '13 at 17:11
add comment

I always have a /home partition separate from the / so when i'm on a fresh install/upgrade, when i get to the "set up partitions" step, I select one for / (formatted) and another for /home (not formatted) but with the same file system as the previous one (or compatible).

Then, when creating users, I make sure to use the same user names as the previous installation so /home/user gets to the same place. What is great about this is that it doesn't overwrite the user's directory.

Thus if I had /home/mike, after my upgrade I'll have a mount on /home again and create the user mike so it gets all the files and config files from the previous version on /home/mike.

The only thing missing here are the /etc config files that need a backup/restore.

share|improve this answer
    
This is also my way of original setup. Sounds really good that Ubuntu doesn't overwrite the user's home directory. I'm going to try it as well. Is there any list btw of /etc config files to check, that you probably want to backup? –  Lode Aug 12 '11 at 5:43
add comment

I have done this by moving the hidden files and folders into a separate directory (but I guess deleting them would work too) and then shutting down and installing from the live CD exactly as suggested by grahammechanical in his answer.

I can confirm that it works (or at least it did for me).

If you keep the hidden files and folders instead of deleting them you can use them to selectively restore any configurations that you may decide you want to keep after all.

share|improve this answer
add comment

You might be the first person to try what you are wanting to do. So, you can tell us if it works.

I would suggest that you delete those hidden files/folders beginning with a dot (or, if you are nervous - rename them to .somethingold) then shutdown and boot into the live CD and reinstall without marking /home to be formatted.

Programs that are installed afresh will create new dot files/folders.

share|improve this answer
add comment

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.