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
if you have files in say /home/olduser
where the prior install had them in /home/newuser
; and you're happy with how your new [near empty] "user1" is working; you can copy the files into your new directory, eg.
sudo cp -prn /home/olduser/* /home/newuser
which will copy (-p=preserve.filespecs
, -r=recursive
, -n=new.files.only
) the files to the new user directory. the -p
will mean they remain owned by "user" or your old userid. I do this probably so I can inspect what it did before I do the next step
chown -R newuser /home/newuser/
which will now change old owner.attributes to your new "newuser" id. the -R
tells it to recursively do subdirectories
benefits of this is it'll copy, not move, so if something stuffs up, you can do it again (even if its creating a new user.id & using that instead of re-installing whole OS). it does require you to have enough free space to have two copies of your data, ie. /home/olduser
data will be copied to /home/newuser
. when completed and you're happy you can always delete data in /home/olduser
other alternatives|hacks could be to edit /etc/passwd
& change your $HOME
directory to be the directory you want; but there is more that can go wrong with this if you don't understand what you're doing. this 'hack' is more what you want, hence my clues, but I'm not sure of your level of understanding and whether or not more detail is appropriate. this 'hack' is by far quickest and simplest, but more can go wrong [ie. you may be tempted to install a third time, when again a simple edit can fix - if you know how]
more alternatives exist; some I'd like to know before hand is /home
is on a different fs|partition to the /
partition, so I'll skip (edits to /etc/fstab
etc)
Best Answer
Answer is yes, you don't need to re-install OS. You can create a new partition (block device like /dev/sdb2) and use it for /home. You can also copy the data in old /home over if you have a good backup or the old home is still readable.
In your case, it seems that the old /home (disk) became faulty. You want to use a new partition or new disk for /home. It is fine and you don't need to re-install the OS.
Steps in brief (recommend doing this using a LIVE CD, you don't HAVE TO though):
/home
mkfs.ext4 /dev/sdb2
/home
=> for example =>mount -t ext4 /dev/sdb2 /home
mount -t fs_type /dev/sdaX /mnt/old_home
otherwise you'll have to restore data from a good backuprsync -axHAX --progress --verbose /backup/home/ /home
/etc/fstab
and update the block device/FS for new/home
Reboot and you should be good to go;-)