Setting up a new gentoo linux machine: partitioning

After eight years of service my poor old companion notebook, a Sony Vaio VGN-S2XP, was in need of retirement and a new laptop had to be bought. After searching around a bit my choice fell on a Toshiba r840-125. Good price, good video card, good feeling to the hardware and a trusty brand (you would not find me getting a HP or Dell for sure).

Unfortunately it's still almost impossible to buy a computer without paying homage to Microsoft Coorporation and to deliver money to their doorstep even when we have no intention of using it's faulty OS. Ok, maybe not faulty, maybe just slow, laggy, buggy, annoying, incomplete, ugly, etc. You know what I mean and if you don't then you should try to get out some more... Incredible how governments allow this small sucking of their citizens to go on. If people don't give money to M$ then the gov guys could come and get some more, no? (this is irony)

Well.. so setting up a new machine... I decided to leave the legacy OS installed (that windows stuff) and the rescue partition too. This way if something goes wrong with the hardware I can try it with the software that was chosen by Toshiba.

That lead me to the first step of setting up the computer: partitioning the hard disk.

Partitions

Keeping the legacy OS and the existing partitions

This was the very easy part. Just record a CD with the wonderful System Rescue CD, boot it to a graphical interface and use GParted to do the hard work.

Toshiba ships this hardware with three primary partitions:

  1. Sytem, a hidden NTFS partition, a bootable partition where I guess the boot of the installed OS is
  2. disk, the normal disk for the owner to use (ahhh.. the assumptions the hardware manufacturers do...)
  3. HDRecovery, another hidden NTFS partition, where the data for reconstructing the original OS is

The first and third partitions I left them as they were (no resizing, no moving). The second I did resize to about 10% of its original size (little more than what was already being used.

Using one single extended partition for linux

In my experience with gentoo I became used to have the following partition layout:

/ : the root of the system, where the main OS is installed (binaries, libraries, resources, temporary stuff, etc)

/boot : the place where the binaries and disk images needed to boot linux are placed

/home : where the user home directories are located

/usr/portage : where the portage tree (the files that describe each of the available software used by the system) is placed

It might not be the best possible layout but it works for me. Some people like to have a specific partition for /var but I can't really see the point and my machines have been running happily since '94.

I couldn't use primary partitions for my Linux gentoo system (only one of a limit of four was available) but I could use extended partitions (think of it as partitions inside a partition). So a extended partition was created in the freed disk space (from the resizing of partition two) and then three partitions were created, one for the /boot, one for SWAP and one for the entire linux system... but there's a catch. The last partition created is a LVM partition. With a bit more effort to do the initial setup of the system I will end up having a abstraction on the storage space - if I ever feel short of space I can throw away the space reserved by Toshiba for a legacy OS and simple expand (move and resize probably) the LVM partition to use more space).

Some tweaks for the partitioning

Most of the previous partition are straight forward to setup as ext4 (still one of the most stables and speedy fs for linux) but the last one, /usr/portage is somewhat special in it's contents: mostly lots of small files (less than 1 Kib).

My guess is that for this kind of usage it's a waste of space to only handle blocks of 4 KiB. At the expense of needing more space to have more inodes (the entries in the tree that describe the files that are on the disk) I rather have the filesystem managing more or less one block for each file.

Speed is also important in this partitions. The fastest it's possible to transverse all of its information the better for when using the portage tools. My gut feeling is that the easiest way to speed up reading information from the disk is to reduce the amount of data needed to be read. Therefore having small inodes is also a plus.

But enough chat chat. What options did I actually used when creating the filesystem for the portage tree? Well, here they are with a small description:

-b 1024 : use 1024 bytes per block

-i 1024 : one inode for each 1024 bytes of space, so one inode for each block so that in the limit we could address all the blocks in the filesystem

-I 128 : set the size of each inode to its minimum, meaning that there won't be any of the fancy stuff like extended attributes (I don't need them for the portage tree)

-L PORTAGE : just labeling the filesystem