Monday, August 15, 2011

A bit on partitioning

Linus Trovalds created Linux, but ever since its there in the open source world, there have been countless varieties and versions and the list is exponentially growing. Unlike Windows, Linux is a playground where people can tweak around, experiment (and mess it up). Whenever there's a new version or a distribution which makes lot of fuss on the Internet, users tend to move on to the new version. Quite obvious they want to.

Being into Ubuntu evangelism for quite a long time, I often come across people who complain that they lose their home folder contents on installing a different version or a distribution. So how do we not lose home folder contents then?

Rather explaining each individual I thought I write it down. The problem lies in specifying partitions during the installation. Here's my advise. While installing any Linux, it is of best practice to have these three partitions -

swap
Without specifying this partition, you will not be allowed to install any Linux distribution. When you start an application installed on your hard disk, the application's required resources are first brought to RAM before it runs. When your RAM is overloaded, a bit of unused data from RAM is transfered to swap space making room for the application to run. And when its done, the data moved to swap space is brought back to your RAM thus acting like a secondary RAM. If you have a huge capacity of RAM, then a small hard disk partition is enough for swap. It is ideal to keep your swap partition as big as your RAM capacity.

root (/) 
root file system, represented by a forward slash (/) is the top most node of your directory tree. This contains the linux kernel, device drivers and every other files that you install. This is where your actual linux is running from. This is similar to the C drive of your windows where windows and other programs (C:\Program Files) are stored. The size of this partition depends on the size of the linux distribution you are about to install. Minimum requirement will be specified in its documentation but the partition size must have a few extra bytes for you to install extra applications. For starters, 5GB of space is more than enough, but if you have a really huge hard disk space, then you can always keep some room for more applications.

/home
This is the final partition which will hold /home directory. Every user will have his/her own directory under /home. If your username is 'john' then your home folder will be at the path '/home/john'. All the user specific files will be stored in their respective home directories. Every document you create, pictures you download or any files specific to you are stored in your home directory.
Strictly speaking, you can install Linux without specifying partition to /home but in which case, the /home will be mounted under root (/) and is erased next time you reinstall.

Now that you have the idea of these three partitions, you should remember that whatever you install (like GIMP, VLC media player, any application) is stored in your root directory while whatever you download or create (like documents, pictures, music, webpages) is stored in your home directory.

Once you install linux with these three partitions, you can save as much content as you want in your home directory and next time while installing Linux, it is enough to specify your root and swap partitions. This way, your /home partition remains untouched and you don't lose any data. 

1 comment: