Wednesday, April 17, 2013

[How to] Install Linux using partitions

Install Ubuntu (Linux) using partions

De qué está hablando? Versión en español

You can apply this tutorial to almost every distribution that you like. I have used this principle with openSUSE, LinuxMint, Arch Linux and almost any Linux distribution.
 

Motivation and interest


Why would I install Ubuntu using partitions? If the only thing I need to do is to let the manager do the work for me.

Well, when I started using Linux I let the installer of my distro do all the installation for me. Which is very convenient, specially if you are just trying out new operating systems.

But if you are like me, from time to time you like to test a new kernel or a new driver or packages that you aren't sure that are going to work. This could crash your system and make it unbootable. That's why you may be interested in this little article.

The idea behind this post is to show you how useful it can be to use a partition table when you install your distro.
Where are going to mount three different partitions: "/home" (where all your personal data is saved), "/" (the root, where the actual system is installed) and the swap partition. (You can make more partitions like mounting /boot in another space in the disk, but I think three are just enough).

Partition table


When you are installing Ubuntu again, instead of choosing the "Erase disk and install Ubuntu" option you should choose "Something else".

In Ubuntu 12.10
In Ubuntu 12.04

Once you're in the next window you are going to see your hard drive. There might be some partitions or just one. I recommend you to do a clean installation and delete all the partitions using the button "-". If you are using a new hard drive you need to choose the option "New Partition Table...".



Now we can start making our different partitions.

Swap area

First of all we are going to do the swap partition. This will depend on how much RAM memory you have in your computer. Normally this partition has to be at least the same size as your RAM. But it's recommended that it is the double of capacity than your RAM, in order to have a "good" partition.

What does swap do?
 
When you run out of memory in you RAM, because you have too many programs running, the system is going to put some of this processes in the hard-drive. Then when your computer will need some of the processes that are in your hard-drive, it will load them into the RAM again. If you have a big RAM memory (like 8GB for example) maybe you haven't used swap at all. But if you plan to put your computer into hibernation mode, your session is going to be saved in the swap partition. That's why resuming from hibernation takes more time.

Click in the "+" button. Once the new window pop up you choose the size of the partition (In this example it's about 4GB). Then in the section "Use as:" we choose the option "swap area". And then just click in "OK".


Now we are going to prepare the / [root] partition.

/ (root)

In this case you choose the size that you judge convenient. In my computer I have a 10GB partition. But if you want to install a lot of software maybe you should try a 20GB partition, it really depends on you. I think the minimum is 3GB.

In this example I am using a virtual machine, so the space I am giving to this partition is very small.

Click again in the "+" button, after you select "free space". Then we are going to create the new partition: it's a "Primary" partition and we are going to use Ext4 journaling file system. Here is the important part: when you select your "Mount point" you need to choose the "/" option. And that's all.


/home

We can use the rest of the free space to store all your personal data. Many folders are going to be saved in your /home. Some of them are your configuration files for all your programs like Firefox, Thunderbird, SSH, etc... You can't see them because they are hidden. In Nautilus you can do Crtl + H to show hidden files. Or if you are in a Terminal use ls -a.

Like with the root partition we are going to use Ext4. The type of the partition is going to be "Logical" and the "Mount Point" is going to be "/home".


Before we finish

Don't forget to double check if your partitions are ok. Your partition table should look like the one in this example. After you check everything just click in "Install Now".



If you have a new computer with UEFI

You are going to need another partition. It is an efi partition and without it you are not going to be able to boot in Ubuntu. I haven't try this myself because my only computer doesn't have this functionality (and apparently it saved me a lot of troubles).
The partition has to be around 40MB, but you could give it like 250MB to be sure. Then when you select the "Use as" option, make sure you choose "efi boot".


There you have it. How to install your system using partitions. That was simple, right? Now I will explain you why this is so convenient.

Recover your system


Let's suppose like for some strange reason (you installed a new driver, you tried something dangerous, ...) your system isn't able to boot anymore.

Partitions are going to save you a lot of time.
 
Boot your system using a LiveCD or an USB key.

Choose again "Install Ubuntu" and choose "Something else".

En Ubuntu 12.10
En Ubuntu 12.04
The difference is that now, you are going to see all the partitions that you made before.
You need to repeat the steps we did before: choosing your swap, / and /home. Make sure you are using the same disk space for every partition and that you set it up like you did the first time.

But here is the difference: there is an option that says "Format?". Here we are going to make sure that this option isn't enable for the /home partition. Unmark that option. We need to format the / (root) partition because the system needs to be installed again.



And that's it! You install your system again without loosing your personal data. You are going to loose all the programs that you installed but well, you can check my other tutorial with the top things to do after installing Ubuntu 12.04/12.10 to make your computer run smoothly again.

Did you like this post? Here you can see what I'm going to write about in this blog (for the moment). Don't forget to add me to your circles in G+ or to follow me in Twitter: @RobertoXMed

No comments:

Post a Comment