Re-installing Ubuntu without affecting Windows partition (dual-boot) [duplicate]

I was experiencing problems with Ubuntu Desktop like missing and broken system packages, missing Unity package and other problems. So I decided that the best solution (without touching Windows files) is just to reinstall Ubuntu.

I looked everywhere and found the way but got confused as some say that I supposed to choose "Erase Ubuntu and reinstall", others say that I supposed to choose "Something else" and just select it manually while installation. I thought the first option would be better and just safer as I don’t want any of Windows files to be touched but it says that it has a bug that erases all other partitions...

  • Current Ubuntu version: 17.04 desktop 32bit

  • will be replaced with 16.04.0 desktop 32bit (as 32bit 17.04 version is no longer available)

What’s the safer option to choose? And if the second one is, how to make sure it’s Ubuntu partition?


I prefer the "something else" option, because then I know exactly what's going on.

It should be fairly straightforward:

  • Don't touch any partitions other than ext4 or swap.
  • Double click the existing 'ext4' partition that currently has Ubuntu 17.04 on it.
  • Leave the size as it is.
  • Select 'use as ext4 journaling file system'.
  • Check 'format the partition'.
  • Choose '/' as mount point from the drop-down menu.
  • Click OK.
  • Double click the swap partition to see if 'Use as swap area' is selected, if so, click OK.
  • Choose the device for bootloader installation. In a normal case, this is just your primary hard drive (i.e. /dev/sdx). It will overwrite the Windows bootloader with Grub, allowing you to select the OS to boot in Grub. If you are running a dual boot right now, this is most likely how it is configured already. If so, you can select your primary hard drive as bootloader device. If, on the other hand, you don't want to overwrite the Windows bootloader, and you want to manually add Ubuntu to the current bootloader after installation, you should select the 'ext4' Ubuntu partition (/dev/sdan) as the device for bootloader installation. (I don't recommend the latter, I've been using Grub for years in a Windows-Ubuntu dual-boot configuration and it works just fine.)
  • When clicking 'Install now', it will ask you to confirm your actions. Just make sure that you didn't accidentally select your Windows partition to be formatted.

Something Else Ubuntu Installation

Note that in my case, /dev/sda1 and /dev/sda2 are Windows partitions (you can tell because they are 'ntfs' partitions). /dev/sda3 is my Ubuntu partition of type 'ext4'. It will be formatted during installation, and it will be used as the root / of the file system. /dev/sda4 is the swap partition.

Note: If you installed Ubuntu 17.04 without LVM, or if you didn't upgrade from a previous version to 17.04, you probably don't have a swap partition in the list. If that's the case, it's a good idea to create one now. When selecting the size to use for the 'ext4' partition, leave a couple of GiB for swap, then create a new partition in the free space you created, and use it as swap. You could also use GParted to create this partition, if that's more familiar to you. The same rule applies there: don't touch any Windows partitions, and double-check everything before confirming.


First thing to do:

Back up your data! If anything goes wrong, you can always restore your files.

Second important thing:

Remember (better write it down somewhere) your username and password. To see your username use this command:

whoami

To avoid conflicts, you need to enter the same username and password after reinstall.

Reinstalling

Simple "Reinstall Ubuntu" should work just fine:

enter image description here

However, to control the whole process and understand exactly what you are doing - the second option ("Something else"):

enter image description here

You'll see partitions, something like this:

enter image description here

Select only the root / partition (/dev/sda6 in this example - yours will be different).

Mount point should still be the / one:

enter image description here

And here we go! Do not forget to write the same username and password.