Thou shalt partition your Home from its Roots

10. maj 2012 - Avtor Mariano Cecowski

10. maj 2012
Avtor Mariano Cecowski

Even though most modern, user-friendly Linux distributions do not do this by default, it is the least to say advisable to create, during installation, a separate partition for the /home folder, and another one for the root of the filesystem (/).

What does this mean? Partition are logical segments that correspond to physical parts of your disk drive. In Linux, you can mount them in the single filesystem tree (or graph if you wish) that starts at / (root). Thus; if you have one single partition and you create a /myfolder directory, and all its contents will be located at that partition. But you could also choose to have a separate partition and mount it in that directory, so that the contents will actually be located in a different partition.

Creating a home partition is actually not that complicated. For instance in Ubuntu, instead of telling it which disk you want to install to (which will remove everything from, and create a single partition) you choose to do it manually, and then create 2 partition; one for the operating system and global applications of something between 20~50 Gb (or 5~10% of your total capacity) which you’ll choose to mount at /, and another one for user files with the rest of the available space that will be mounted at ‘/home. (You can choose, for instance, the EXT4 filesystem) Additionally, you might want to create a swap` type partition of ~4Gb (Historically, of the size of your RAM, not necessarily true any more). But, why should you bother?

Well, for instance, if you’d like to have your personal data encrypted (yes, Linux might be secure, but if someone has physical access to your computer it won’t help much), which is one option provided by Ubuntu since some time already.

You could also mount your root partition as read only in order to avoid accidental (or otherwise) wipes, overwrites, etc. (be careful though; you’ll need to create some more partition for things that need to be written, such as /var/log).

There are other reason for partitioning, including performance and data sharing, but probably the most important advantage is that of installation independence. That is; no matter how bad did that last update do, or if you’re not been even able to boot after a video driver update: you can always re-install your Linux, or even try something else, and keep not only your personal files intact, but also the configurations for the programs you use.

And that’s what happened to me after updating from Ubuntu 10.4 directly to 12.04: I got the black screen of death, and wasn’t able to fix it even after booting on text mode. Pissed of, I installed Linux Mint Debian Edition on the root partition, formatting it, but leaving the /home partition alone. LMDE didn’t play nice with my darn graphic card either, so I made a fresh install of Ubuntu 12.04.

Apart from having Unity instead of good’ol Gonme 2, my computer felt like nothing happened: Thunderbird showed my mail and calendar the minute I opened it, Firefox had the same bookmarks, and I had the document history as before the crash.

True, I had install some apps that are not in the default installation, but almost all from the repositories: Pidgin (all contacts and history intact), eclipse (last workspace up and running), Opera (it even saved the session because I didn’t close it properly!) and Wine (Microsoft Office running like nothing happened).

True, some programs’ configuration might change between versions, so there could be problems (but only if they don’t properly handle document versifying as they should), and you do have to install all the programs that you had installed in the system and not in your user-space. but it really pays off to have a home partition.

Unsure if you have one? Try this:

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        38G  7.3G   29G  21% /
udev            2.9G  4.0K  2.9G   1% /dev
tmpfs           1.2G  996K  1.2G   1% /run
none            5.0M  8.0K  5.0M   1% /run/lock
none            2.9G  352K  2.9G   1% /run/shm
/dev/sda6       258G  215G   31G  88% /home

You don’t have a home partition? No worries; you can move your home, here is a tutorial.

Now that you have your home partition; how about creating an image to back up?

If you are storing into optical format, it might be a good idea to do so before the next solar magnetic storm.

Družbena omrežja

Ostanite v stiku z nami.