This question already has an answer here:

My dual boot Ubuntu system has its Ubuntu OS corrupted. Efforts to fix it via changing source.list and other means proved in vain. Now I want to re-install Ubuntu on that partition with a USB stick. Will my files on that partition and other partitions be left intact? I just wanna fix the OS. Wanna confirm this as I am using the computer for many things and cant afford to have it screwed up. Thanks.

marked as duplicate by karel, Melebius, user535733, Eric Carvalho, N0rbert Sep 13 '18 at 20:19

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Before you do anything to your OS you should always make sure to have an up-to-date backup of all your personal files. – Takkat Sep 13 '18 at 9:45

It depends on how you've set up Ubuntu and what choices you make during the re-installation.

Of course, before going any further, back up!

First, about your current installation... Ubuntu is installed in the root partition (/). That partition will be erased. If your /home partition is separated, then you are fine. If it is just another directory in /, then yes, that too will be erased. If you don't know, then run df -h.

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2          -     -     -   2% /
/dev/sdb1          -     -     -  41% /home

This shows that my /home is separate from /. If /home doesn't appear, then it is part of /, and it will get erased. This is true for any other partition... If /etc, /var, etc. do not show up here, then it'll be erased along with /. You said you can't boot up so you probably cannot run the df -h command, but you can use a boot disk and run gparted to take a look at how everything is organized.

Anything of value in / that you want, you should use a boot disk and an external drive and copy it out manually.

During installation, you will be presented with the image here, under "Installation Type". You should pick "Something else". You will then be presented with images similar to those shown here. (I can't remember if it uses gparted -- I think it does.) You'll be able to choose which partition is mounted as /, /home, and so far. The key here is to select your home partition to be mounted as /home but do not have it erased. / will be erased...there's nothing you can do about that.

In summary, you need to be weary of two things:

  1. Anything of value to you isn't currently in the root (/) partition. If it is, use a boot disk and either move it to an external drive or move it to another drive if you have more than one on the computer. Everything in (/) will be deleted.
  2. During installation, carefully select which drives are being erased. Ubuntu 18.04 no longer has a tmp partition. If memory serves, this means only two partitions will be marked as reformatted: (a) the root partition and (b) the EFI system partition which is mounted on /boot/efi . Anything else won't be erased, provided you are careful and select that option. (You can make a mistake and choose your /home partition to be mounted and erased.)

Hope this helps! I just had to go through this a month ago... Re-installation of Ubuntu took less than 15 minutes. Moving files out of the root partition to a place that won't be erased took well over a day. But, obviously, such preparation is worth it and I wouldn't rush it...

Good luck!

Not the answer you're looking for? Browse other questions tagged or ask your own question.