Tutoriels gratuits en Informatique
IT Tricks Random

Windows 10 dual boot tutorial and Ubuntu Linux


Dual Boot to coexist Ubuntu Linux Windows 10

In an approach aimed at using free software as often as possible, operating with open and standardized protocols and formats, the question of the operating system, its kernel and the tools that compose it always comes up. Because it’s the heart of the system, which runs all the software we use and stores our data. After having made a smooth transition while remaining under Microsoft Windows but by replacing a certain number of proprietary software by their free equivalents, often much better, we say that it may be time to deprive Microsoft of our telemetry. This tutorial on dual boot Windows / Linux is there for that!

After trying one (or more) Linux distribution (s) such as Ubuntu with a live USB without damaging our system, we realized that we were going to miss a few things by migrating to it. Few things except maybe specific software, with which we have our habits, and for which there is no equivalent under Linux. It can be a video game. For this reason, although the decision to migrate to Linux is taken, it will still have to respect the constraint of being able to use Windows from time to time on the computer, as before the migration. This is entirely possible with the dual boot ((double start in French) which allowsinstall Linux alongside Windows 10. This may be a good alternative to upgrading from Windows 7 to Windows 10.

Indeed, we can make several operating systems coexist on the same computer, distributed on several hard disks or several partitions of the same disk. We call this the multiboot, in which a boot manager (the boot loader) will be able to list and initialize all the operating systems installed on the computer. So we can flourish in freedom with software that only cares about working well and being interoperable, while allowing yourself to start Windows occasionally, to continue your game of the latest fashionable game.

Warning on dual boot and this tutorial

The manipulations that will be necessary to achieve this result are relatively simple, and within everyone’s reach. However, they are not harmless, and should be done in a calm environment., to be fully focused on the task. The number and nature of the operations to be carried out vary depending on the initial situation, whether we have an entire hard disk to dedicate to the installation of our Linux distribution or not, for example. We will deal with a specific case here: how to configure a dual-boot Windows 10 / Ubuntu Linux 19.10, with no dedicated hard drive, and no partition initially available to install Ubuntu. Note that the operations which will be described, although carried out many times with success, are provided here without any guarantee, and that the author or help-informatics-tricks.info can in no case be held responsible for the consequences of a possible handling error.

Preparation of the environment, and imperative precautions before the installation of the Dual boot

First of all, a certain number of preparations, checks and precautions must be taken.

Full computer backup

It’s the first and most important thing. A complete and reliable backup of the entire computer will guarantee us a return to the initial state in the event of a handling error causing the operation to fail. In no case should you save the time and energy required to perform this backup. It will most certainly not be used in 99% of cases, but its absence in the event of a glitch will probably be greatly regretted. It is also an excellent habit to back up your computer regularly, and you can only advise to use this healthy activity.

The most reliable and easiest way to do this backup is to back up the entire computer by taking a full disk image. Thus, we will be able to restore the entire system, software and data to their initial state. To do this, we can for example use Acronis True Image or else clonezilla, and a good old external hard drive with enough capacity.

Prepare installation media

The installation will be carried out from a USB key to which the installation image of Ubuntu will have been transferred. To make this key, we can follow the tutorial on how to test Ubuntu without modifying your computer, relating the use of a Ubuntu live USB key.

Make room for Ubuntu and dual boot

As a reminder, the case presented here involves a single hard drive in the computer, on which there is no partition additional blank available to install Ubuntu. So we will have to make room, reduce the size of one of the partitions used by Windows 10, and use the unpartitioned space thus newly available to install Ubuntu. This stage is one of the most delicate of the operation. Resizing a partition is not a trivial operation, even more so when it comes to reducing it.

If at this stage you do not yet have a backup of your entire system, there is still time to stop everything to make it. The success of the manipulation is partly based here on the amount of available space that there is on the Windows 10 partition chosen to be reduced. Although a basic installation of Ubuntu will be able to settle for less than 10GB, cutting so tight will quickly prove to be far too tight when it comes to installing additional software, or storing data.

However, with regard to data storage proper, the allocation of a dedicated volume will be optional at the start, because we will see that we will be able to access the data stored by Windows 10 from our Ubuntu, both for reading and for reading. writing. So they may very well stay in their original location for now.

In the following example, Windows 10 is installed on a 120 GB partition occupied up to 80 GB. The goal will be to recover 20 GB of free space to dedicate it to installing Ubuntu. We will therefore take advantage of the free 40 GB to reduce the partition by 20 GB; so we will have 20 GB of unpartitioned space that we can dedicate to Ubuntu, and there will still be 20 GB for the partition dedicated to Windows 10.

From Windows 10 started with a session with administrative privileges, press the “windows” key and the “R” key at the same time to open the “execute” dialog box. In the latter, enter “diskmgmt.msc”.

Then click on “OK” to open the Windows disk and partition management component.

Windows disk management component
The Windows disk management component, where we see the 120 GB partition on which Windows 10 is installed.

In the example, the computer’s hard drive has a reserved 500 MB partition, and a 119.5 GB C: partition with 39.97 GB free. It is the latter that will be reduced. The reduction is carried out by clicking with the right mouse button on the rectangle representing the partition, and by choosing the “reduce volume” action from the contextual menu.

launch of volume reduction
Launch of the partition reduction assistant C which contains the Windows 10 system.

The reduction configuration dialog box appears. The value to be reduced is entered in the “amount of space to be reduced (in MB)” field. As the configuration unit is MB, and since 1 GB = 1024 MB, we enter 20 x 1024 = 20480. Note that it is quite possible to round off by putting 20,000, the reduction will then be a whole little less than 20 GB, but will be just as functional; any value that does not collide with the location of non-movable files may be suitable.

reduction setting
The setting of the reduction: here, it will be 20,480 MB.

Details on fragmentation and non-movable files

The success of a reduction operation depends largely on the state of the file system to reduce, and in particular by its fragmentation. Indeed, files stored in a file system are not necessarily stored continuously, and one after the other. A file can therefore be stored in a fragmented manner, and each of the pieces constituting it can be placed in different places on the hard disk: this is fragmentation. This therefore implies that the space available on a partition is itself non-contiguous. However, to reduce a partition, we need the amount of space to be recovered to consist of blocks of storage that are next to each other, and at the end of the partition to be reduced.

The reduction therefore begins with a defragmentation operation, which consists in trying to gather the pieces of files to make them as fragmented as possible, while making sure to move the fragments of files located in the end of partition area concerned by the reduction of cut. Some files cannot be defragmented because they are in use by the system for example: they are not movable. If one or more of these is in the space recovery area, we cannot go beyond it and the recoverable value will be lower than the target.

The reduction begins after clicking on the reduce button. It is recommended to use the computer as little as possible during the operation, so as not to stimulate writings on the hard disk which could disturb defragmentation and reduction. In our example, for information, the reduction time was a quarter of an hour on a mechanical disc, but the file system was not very fragmented (5% of fragmentation approximately) and we tried to recover only 20 GB. The reduction time can be much longer, depending on the state of fragmentation of the system. files, space to recover, disk usage rate during operation, and performance.

Once the operation is finished, hard drive has unpartitioned space available. This is the space in which the installation of Ubuntu will take place. It is important not to create a partition at this stage, and leave the free space unpartitioned. Indeed, the Ubuntu installer will look for unpartitioned space to perform automatic partitioning during the installation phase.

the result of the reduction
The result of the reduction: 20 GB of unpartitioned space is now available.

What if the Windows Disk Manager fails to shrink my partition the way I want?

For the considerations mentioned above, but also in other situations (sometimes when using a solid state drive), it may happen that the Windows integrated disk manager fails to reduce the partition by the desired amount, although there is enough free space on the partition. In these cases, specialized software such as AOMEI Partition Assistant (the “Standard” edition is free) which will offer for example the possibility of reducing the offline partition, ie Windows off (in a Microsoft environment WinPE or the environment PreOS Partition Assistant), so there will be no locked system files for example.

Ubuntu installation

The hard drive now has unpartitioned space that can be used to install Ubuntu, which can begin.

Boot from installation media

The operations required to boot on the installation media are identical to using a Ubuntu live USB. The media is the same and can be used to perform the installation. The procedure is identical to that described in the article, until the step of choosing between the “live” mode and the installation: here we will choose the installation, after having selected the French language.

live or installation
The choice between live mode or installation mode. This time we install for good!

Installation

The installation of Ubuntu itself is very accessible, and is carried out by answering a few simple questions, the installer taking care of automatically managing the parts which can be a little technical.

Choice of language
Installation begins with the choice of interface language.

It is advisable at the keyboard selection step to test some specific keys of the French keyboard, to verify that they correspond well; it’s important not to miss the password setting step.

keyboard choice
The choice of keyboard language. Do not hesitate to test a few specific keys.

For the installation type, we choose the normal installation, which includes the automatic installation of the graphical desktop environment and associated tools and software. We can also check the box activating the installation of third-party software (here understand “owners”, as opposed to “free”) to maximize the support of certain hardware requiring it.

If you connected the computer to the network during startup on the installation media, it will be possible to install system updates during the installation process so that Ubuntu will be completely up to date after the end of the installation. ‘installation. Otherwise, it doesn’t matter, there will always be time to update the system anytime after installation.

installation type
The choice of the type of installation: the so-called normal installation includes a maximum of software.

The next step will determine how we will use the unpartitioned free space on the hard drive. Here we will choose “Install Ubuntu next to Windows 10” and let the installer make the partitioning decisions. It is possible to manually partition the disk yourself, but we will talk about this a little later.

partitioning choice
The choice of the type of partitioning: we let the installer manage this step automatically.

Before any final operation, the installer confirms the actions he will take to prepare the disc. This is an opportunity to verify that he is going to do what is expected of him.

partitioning confirmation
The installer indicates which operations will be performed on the disk; here it will create and format a new partition.

The rest of the installation is extremely simple; we choose the time zone:

choice of time zone
The time zone determination step.

Then we create the first user.

user creation
The creation of the first user of the system. For security, we prefer to have to enter the password each time you log in.

First start

At the end of the installation, the computer asks to restart while asking the user to remove the USB key. This is the opportunity to see for the first time the boot manager grub.

grub
The grub boot manager menu, including several entries, one for Ubuntu and another for Windows 10.

We can see that Ubuntu is the operating system that is launched by default, if no choice has been made after a few seconds. We also note that an entry has been automatically configured for Windows 10, and we can select it if we want to start on it.

After the first login using the user created during installation, the desktop environment Gnome proposes to add an online account of certain large suppliers or self-hosting solutions; indeed, Gnome’s calendar and contacts applications are able to synchronize with online applications, for example.

online account connection
The optional step of connecting online accounts.

Ubuntu can perform telemetry from the systems installed on users’ computers to improve its services, but unlike Windows 10, here we can refuse it.

telemetry configuration
Telemetry, easily disabled in Ubuntu.

The same applies if you do not wish to activate the geolocation services.

deactivation of geolocation
The geolocation configuration stage.

Finally the Ubuntu software library presents some installable applications, but this is only a sample and it will be possible to return to it at any time.

Ubuntu software library
A sample of the software library accessible from our Ubuntu.

If all the updates were not applied during the installation phase, the following window may appear:

update manager
The update manager.

Either way, it will pop up from time to time when the system detects that there are updates to be made.

Some quick details on the partitioning used for the installation

Partition used

During the installation step which determined how to exploit the free partition of the hard drive, we had chosen the option “Install Ubuntu next to Windows 10”. This option was equivalent to letting the installer prepare the hard drive as it intended. Let’s take a look at what has been done.

view of scores

We see that the installer has created an extended partition containing the 20 GB logical partition in which the Ubuntu system was installed. This was the choice that was made automatically, but we could have made another choice by manually configuring the unpartitioned space made available by reducing the partition in Windows 10.

And the swap?

The swap is very schematically a dedicated area of ​​the hard drive to simulate RAM, when it may run out, or in other circumstances. The swap is optional, and many system administrators do not use it on their servers, after ensuring that they have a sufficient amount of RAM. Most often, the disk area prepared for the swap is a dedicated partition. Except here, this partition does not exist. However, the “free” command shows us that there is a quantity of swap usable by the system.

free command output
The result of the “free” command which shows that there is a configured swap.

In fact, in this example, the Ubuntu installer chose to configure the swap so that it is done in a file placed at the root of the tree of our Ubuntu, much like it is done for Windows.

the swap in the fstab file
The swap configuration in the fstab file; here, it’s not a dedicated partition, it’s a file.

swap file
The swap file at the root of the Ubuntu file system.

How do I access my Windows 10 data from Ubuntu?

The type partition NTFS on which Windows 10 is installed can very well be accessed from Ubuntu, in read as in write. This allows you to take advantage of its data stored in the Windows 10 partition from Ubuntu.

Mount partition from file explorer

A simple solution is to “mount” the Windows partition, which is recognized as such, from Ubuntu’s file explorer.

gnome file explorer
The Gnome environment file explorer, open in the user’s folder.

You have to go to the “other locations” section to reach the Windows 10 partition to mount.

windows partition view
The Windows 10 partition appears in the “other locations” section of file explorer.

mounted windows partition
The partition containing Windows 10, mounted in our Ubuntu.

However, this method does not automate the assembly at each restart, and it will be necessary to do the same manipulation each time. In addition, if you have created a bookmark for faster access to a sub-folder of the partition, it will no longer work the next time you start it, until the partition has been reassembled manually.

Automate editing with the fstab file

The file fstab is the configuration file which describes how to make the different disks of the computer accessible; we saw it briefly earlier, when we analyzed how the installer had partitioned the drive. We could see that the Windows partition of about 99.5 GB was carried by the device identified as / dev / vda2 (ie the second partition of the hard drive aka “device” vda). We are therefore going to complete this file to add a line requesting the automatic mounting of the / dev / vda2 partition in a folder that we have created in our user’s profile.

Let’s create an empty folder in our user profile, in which the contents of the Windows disk will be made accessible. This is done intuitively with the file explorer, just as it would have been done under Windows, by right-clicking in the base folder of the user profile, then making the choice “new folder”.

new folder

windows folder

We will then open a command terminal, from which we will edit the fstab file. Click on the activities button, then enter the keyword “terminal” in the search box and press “enter”.

terminal launch

In our example, the 99.5 GB partition containing Windows is / dev / vda2. Depending on the case, this device name will vary and will have to be adapted. We now need to determine the unique identifier for this partition, by typing the following command:

ls -l /dev/disk/by-uuid/
uuid display
The uuid of the different partitions.

The unique identifier is the sequence of capital letters, whose arrow which follows points to our partition vda2. In our example, it’s 16F81B30F81B0E1D. It is under this reference that we will identify our partition to be automatically mounted in the fstab file. We edit it by typing the following command:

sudo gedit /etc/fstab

(enter user password if requested)

gedit fstab
Launch of the edition of the fstab file, with gedit as a user with elevated privileges.

A text editor containing the fstab file opens. Add the following line at the end of the file:

UUID=16F81B30F81B0E1D /home/julien/windows ntfs defaults 0 0
contents of the fstab file
The contents of the fstab file, as desired.

The path of the empty folder in which to mount the partition is here in the user profile “julien”: / home / julien / windows. This path will also have to be adapted as appropriate. Save and close the file. Finally, in the terminal still open, enter the following command to immediately mount the Windows partition:

sudo mount -a
mount minus a
Execute the “mount -a” command to mount the Windows partition immediately.

This editing will take place automatically each time Ubuntu is started. The Gnome environment nicely pins a shortcut launcher pointing the Windows partition in the sidebar, however it opens the root of the partition, which contains the root of the Windows partition which is not what interests us the most.

shortcut to Windows partition
The shortcut to the Windows partition that Gnome automatically added to the side launcher.

So we are going to make a small bookmark to quickly access the interesting files of the Windows profile. Just open the file browser on the Windows partition, then dive into the tree to reach the Windows profile of the user “Julian” (located in the “Users” folder). Once inside the folder for which you want to create a bookmark, just click on the folder symbolized with the chevron going down, and choose “add a bookmark”.

add bookmark

The bookmark is now accessible from the left side of the file explorer.

bookmark access

Can Grub start Windows by default instead of Ubuntu?

Absolutely, we can ask grub to start Windows instead of Ubuntu when no choice has been made within 10 seconds during which the boot menu is displayed.

Change grub configuration

To do this, you must edit the / etc / default / grub file. In a command terminal, enter:

sudo gedit /etc/default/grub

Type the password if necessary.

sudo_gedit_grub

The file contains several grub parameters, but the one we are interested in is GRUB_DEFAULT. The value to the right of the equal sign indicates the line number of the boot menu that will correspond to the system to be loaded by default. Attention, the lines are counted from 0, and not from 1. In our case, Windows is on the fifth line, so we will set the value 4 and save the changes.

edition_configuration_grub
Configuration of the system launched by grub by default. Here, the value 4 will be entered to launch Windows.

menu_grub_numeros_lignes
How the lines are numbered in the grub menu. The fifth line, at number 4 therefore, is the one that corresponds to Windows in this example.

Instead of the figure indicating the line number, it is also possible to put the title of the line in quotes, or to configure grub so that it remembers the last choice made and makes it the default. For more details, we can refer to the dedicated section from the francophone ubuntu wiki.

Apply the new grub configuration

Still in a command terminal, enter the following command:

sudo update-grub

The new configuration is applied, we can now restart to verify that we obtain the desired result.

I changed my mind, can I go back and delete Ubuntu?

Yes of course, but it’s a shame. However, here is the procedure to go back, remove all traces of the installation of Ubuntu and recover the free space in the partition. You have to restart the computer on the Windows 10 system by choosing the option in the boot manager; then launch the disk manager “diskmgmt.msc” again as we did to reduce the initial Windows partition.

boot on windows
This time we ask grub to start the computer on Windows.

Delete Ubuntu partition

In the view that represents the partitions of the hard disk, just right click on the 20 GB partition dedicated to Ubuntu, and choose “delete the volume”.

delete logical partition
Removed the logical partition that contained Ubuntu.

We saw earlier that the Ubuntu installer had created an extended partition containing a logical partition, itself containing the Ubuntu file system. We have just deleted this logical partition; you must now delete the extended partition, repeating the same operation.

delete extended partition
Delete the extended partition.

Enlarge Windows partition

Still from the Windows 10 disk manager, right-click on the 99.5 GB partition belonging to Windows, and choose “expand the volume”.

Windows partition magnification
Enlargement of the Windows partition to take up the space freed up.

By default, the system proposes to extend the volume over all of the available non-partitioned space, which is desired: all you have to do is next – next – finished to extend the volume to its original size. The enlargement is effective in a few moments.

Clean the boot sector of the hard drive

Cette fois-ci nous allons exécuter l’interpréteur de commandes de Windows 10, en demandant explicitement à le faire avec des privilèges administratifs. Pour ce faire, il faut saisir dans le champ de recherche de la barre des tâches (ou appuyer sur la touche windows ») et saisir « cmd ». Le programme cmd apparaît dans les résultats de la recherche : cliquer dessus avec le bouton droit et choisir « exécuter en tant qu’administrateur ».

execution cmd
Lancement de l’interpréteur de commandes cmd avec les privilèges maximum.

Dans l’interpréteur de commandes, il faut saisir la commande suivante :

bootsect /nt60 SYS /mbr
exécution de bootsec
Résultat de la commande bootsect.

L’utilitaire bootsect cherche à mettre à jour le code de démarrage de la partition système et échoue, car nous avons démarré Windows dessus et elle est par conséquent verrouillée ; ce n’est pas grave, ce n’est pas la partie de l’opération qui nous intéresse.

La deuxième partie du résultat de la commande montre que le code de démarrage du disque a lui bien été mis à jour, et c’est cela que nous cherchions à faire, pour remplacer grub par le gestionnaire de démarrage de Windows 10 dans le mbr du disque dur. Le retour en arrière est terminé.

Leave a Reply

Your email address will not be published. Required fields are marked *