This howto explains how you should partition your hard disk to install Linux
Important: it is strongly suggested to backup your data before repartitioning your hard disk. It's the only way to protect yourself against data loss
A partition is a portion of your hard disk assigned to a specific use, each partition has a different size that you can configure
The first thing that you need to know is which structure of partitions you want to have in your hard disk and for which purpose, there's some example:
To simply install and boot a Linux system you should not require more than one partition where to install the entire system, this is commonly named the root partition, and unless it is configured with a rare filesystem you don't need to have a /boot partition to install the system.
It is also strongly suggested to add a SWAP partition, which is used by the system as a virtual memory exchange for when your RAM memory becomes full, this means that the applications can still run instead of crashing by being out of memory.
Unfortunately, using a SWAP partition can make your computer feel slower sometimes and especially when you are running out of memory it can become entirely unresponsive by the bottleneck of fetching the data from it (which makes a simple crash more desired sometimes), the fight for having an efficient SWAP setup without bottlenecks has always been a strong headache in Linux, but fortunately this problem is finally over since the version 3.8.14 of Elive which includes a very well-tuned swap configuration
It is traditionally known to add a /boot partition, this is not needed at all unless you are using a very rare filesystem for your root partition which is not readable by grub, or you have a very strange setup like requiring special drivers or network configurations to set up before to boot the system
The idea of a boot partition is to let the computer load the kernel and a micro Linux system (initrd) that loads required drivers and configurations, before switching to the real Linux system
Elive doesn't require at all to have an extra partition for /home, which is where the user's files belong, some traditional installations recommend to add it to separate the user's and system's files but for Elive we don't even recommend to set up it unless you really want to for a specific purpose
It is also known that some people share this /home partition between different operating systems and this is really not recommended at all, because:
- another operating system has a different version of the applications, so the configurations in the home of the user can be (probably) broken when using one or other version of the software
- they can also have a different setup, drivers, or hardware recognition that can be differently configured, like your audio card in your .asoundrc file
- the user ID (UUID) can be different between operating systems and this can lead to "permission problems"
except for these points, you can share a home partition between different operating systems, but is important that you know what you are doing
Some people also want to add a /var or /usr/local mount points, but that's of course something for very specific purposes
That's basically all you need to know for your partitioning basic setup, the remaining thing is to know how to create these partitions, the different types of disk setup, and if you want to have encryption or not
Encryption: secure your data:
It is strongly suggested to encrypt your partition if you don't want to have your data stolen, and probably you think that this won't happen to you but let's take a look at these few examples:
- your laptop is robbed, with all your data on it, now is too late to worry about this.
- even if your username has a password, your disk is not encrypted, so simply booting from a Live system you can mount the hard disk and access all its data inside it, like photos but also:
- if somebody access to your disk data, they can run a session of the web browser from it, this means to have direct access to your facebook, bank logins, every website login, and also your emails (that can be used to recover the password of any website).
So, if you want to encrypt your hard disk, the best option is to select the "Automated Partitioning" option in the Elive installer, which creates an encryption layer for both the root partition and the swap partition (it is not common at all but some information can be stolen from the swap partition too, because is a temporal memory of the running data), so that's for sure the best and optimal option for performance tunning.
If you are partitioning manually, you can encrypt easily a single partition from the tool "gnome-disks" instead of "gparted" (also known as palimpsest), you simply need to select the Luks encryption option and a password to use will be asked, this is good for encrypting your /home partition (or /root partition if you don't have it) but doesn't include the SWAP or similar
To encrypt in advanced mode, like creating a Luks layer and then the partitions inside like the root one or the Swap or other ones, you will need to search for a more advanced howto on internet
Disk types and structures
There are different types of disk setups, so here's some information about them:
MBR vs GPT
GPT is the new structure of partitioning, MBR is the traditional one
MBR doesn't allows to have more than 4 partitions and that's why if your hard disk is using MBR, you will need to instead, create a "Extended Partition" which is like a layer, and then inside it, you can create any amount of "logical partitions"
GPT allows to have any number of partitions and in fact doesn't allow you to create an extended one. GPT also requires a small partition of only 8 MB (suggested at the start of the disk) called "BIOS partition" where GRUB (the boot loader) will be installed. By other side if you are using an UEFI boot mode (commonly implemented on recent windows-installed computers), you don't need the "bios partition" but the "EFI partition" will be used instead, if is your case, you will probably already have it.
In any case don't worry about all those details so the installer of Elive takes care of everything, detecting these partitions or asking about them only in the case that needs them
SSD / NVMe
An SSD or NVMe hard disk is a recent technology that makes the hard disk much faster by not having mechanical parts which are slower. If your hard disk is not SSD it can be a good option to upgrade to this type of hard disk the next time you change it. In any case don't worry about anything, the installer of Elive will take care of optimizing your installation to profit all the speeds of this type of disks
Example of repartitioning:
This is an example of how to use the Gparted tool to repartition your hard disk using a basic setup, we will resize (shrink) a windows partition to free some space in the hard disk to fit our new operating system together with it:
The sda2 partition is what is known as the C: partition, is the one that takes the most size and the one that we want to shrink to make it smaller
So we click on it to resize, and we slide it to the desired size that we want, in this case will give half of the hard disk size for this windows partition and the other half for your new Elive Linux system
Now we will create a new partition on the new free space
Since the hard disk is a traditional MBR structure, it's limited to only 4 partitions, so better we will create an extended partition using all the free space available first, and then we will create other partitions inside it
We created a SWAP partition of only 1.7 GB
And then we create another to install our Elive system with the rest of the free space
After verifying that everything is correct, we Apply our changes
Important: this step can be very slow and can take hours (in the case of resizing partitions especially), it is important to not stop the process since it can lead to a broken hard disk structure