Previous Page
21 Starting out the Gentoo Install
  • 16 May 2010 17:33:43

For Gentoo installs, my preferred options are using either the Gentoo Minimal CD or the System Rescue CD. Make sure to choose the right architecture (processor) for the Minimal CD; SRCD works for x86 and AMD, so this choice is less relevant there. These are ISO files, so just burn off the disc images. SystemRescueCD works fine, because like many Live CDs, it is based on Gentoo. However, with some recent SRCD installs, please be aware of bug 271942, which, later in the install, will give emerge errors like:

/usr/bin: file not recognized: Is a directory

If you get such an emerge error, the solution is simply:

# export path=

As a general note, if you are working in console mode, you can scroll up and down by holding the Shift key while pressing the Page Up and Page Down keys; this is useful for looking at errors!

Other than this trivial error, SRCD is a somewhat nicer way to install compared to the Gentoo Minimal CD because it has a few more tools for backups, partitioning, a GUI, NetworkManager, and so on. Once it is booted, if you prefer a graphical environment, which will give you access to a web browser among other things, simply issue the command:


For these instructions, I will assume you have only the Minimal tools and are working at the command line; personally, I always install Gentoo from console mode since I think it's a fun part of the experience. If you are using SRCD, and, for example, have dhcp to setup your network configurations automatically, then you can obviously skip details here on manual network configuration, and so on.

Once you burned the CD from some other operating system, put it into the drive and boot from it. Booting from CD may require altering the BIOS or holding down certain keys, depending on your machine.

The simplest command-line tool for partitioning is fdisk; although it is simple, using it is not so obvious, since most of the commands are single characters, and, for example, the character 'p' could correspond to either print (print the current partition table) or primary (selecting what type of partition it will be). In any case, this tool is sufficient for the work and will be available on nearly any install CD.

Before you start altering your partition table, it's a good idea to know what device your harddisk is called, and what partition structure you plan to setup; this can avoid painful errors of over-writing data on another partition, or installing Gentoo in the wrong place and being confused why it won't boot later on.

Generally speaking, you can just look at the structure in /dev and get a sense of what kind of disk you have. This can be done basically by issuing the following two commands:

# ls /dev/hd*
# ls /dev/sd*

Most older harddrives will use IDE connections, and these are labeled starting with hd. Most new harddrives are using something like SATA, so they are labeled starting with sd.

The first drive will be labeled a, the second b, the third c, and so on. The first partition on a drive will be labeled 1, the second 2, the third 3, and so on. (These ideas are important to understand later when we setup GRUB, because it uses a different naming scheme for drives and partitions, so you need to understand not only the name of the disk and partitions you make, but physically which ones they are!)

If you have multiple drives and you aren't sure which one is which, there are a number of ways to determine which ones are which. IF YOU HAVE MORE THAN ONE HARDDRIVE, DO NOT ASSUME THE NAMING SCHEME OR ORDER IN THE LIVE CD IS IDENTICAL TO THAT IN ANOTHER OPERATING SYSTEM— confirm it yourself. On the other hand, the partition order will remain the same for all cases I've ever seen.

One way to look at a partition layout is using fdisk simply to print the partition layout of a specific drive and then quit without making any changes. For fdisk you feed it as an argument the harddisk device name, not individual partitions. So, for a device at /dev/sda (the first SATA harddisk the Live CD found) (example given for my laptop harddisk):

# fdisk /dev/sda

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): p

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x80998099

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1          26      204819+  ee  GPT
/dev/sda2              28         409     3068415   af  HFS / HFS+
/dev/sda3   *         412        8849    67778235   83  Linux
/dev/sda4            8851        9730     7056920    c  W95 FAT32 (LBA)

Command (m for help): q

The above shows my triple-booting Linux system on a MacBook, a nice example of various things one could see on a harddisk. Under Device one can see what the system is calling each partition. Under Boot one can see if any of the systems are set as Linux boot drives, denoted as an asterisk (*). Start, End, and Blocks gives us an idea of the size of the partition in DOS-compatible mode, which as you can see from the output, is now deprecated. The Id tells us what idenfitication Linux gives to the filesystem, with 83 being the extended filesystem number. Finally, under System you can see a human-readable name of the type of system.

Perhaps based on the filesystem types, the sizes, and order, you can understand which harddisk it is. A more sure way would be to mount the various drives and look at the data contained on them. In general mount will auto-detect the filesystem type (if not, use man mount and look at the options under the -t option (the type of filesystem)). To do this, you should make a directory to mount the drive, mount it, and view it.

To look at the data on a partition, make an arbitrary directory, preferably in /mnt, mount a partition there, and list the data:

# mkdir /mnt/sda1
# mount /dev/sda1 /mnt/sda1
# ls /mnt/sda1

I assume from these two techniques, a general knowledge of the harddisk's history, and use of tools available in other operating systems that might be on the disk, you can understand which harddisks and partitions are of interest. Once you are done looking at one partition, be sure to unmount it:

# umount /mnt/sda1

Now that you know which device(s) correspond(s) to which harddisk(s), we can proceed with partitioning the system. Please follow the link below to the page corresponding to the type of install you will do.

For solo-booting Gentoo Linux, continue here.

If you find any errors, please tell me!

I welcome any feedback, particularly for improvements or corrections. My contact information can be found on the about page.

This documentation is based on my own notes and experience, and I have successfully installed a number of Gentoo systems. However, typographical errors or thoughtless omissions can easily occur in any large document set. This page is, up to now, unedited by anyone but myself. In terms of omissions, if I'm doing an install, then obviously something will force me to remember during the install, but not while simply typing up how to do it. It terms of typography, I'm entering this text into vi, not a Gentoo console, so I have really no negative feedback mechanism to catch errors, but I have attempted to be very thorough and read every page a number of times for content and clarity.

For less experienced users, I would prefer you to do a sanity check yourself first before telling me I've made an error; this website is not meant to serve as a help hotline, for example, for new bugs. In other words, please google your problem before emailing me to be sure it's an error in my documentation. Otherwise, please give me the relevant details, like which section you were on, and verbatim output you received leading you to conclude there was an error.

For more experienced users who may be reading out of some perverted obsession with Gentoo, just let me know what is wrong, why you think it's wrong, and what the section in question should say.

        (__)               __(^^)              /   /    (__)      / PhD  \  (oO)     /|  /---^^---/     / | /| daid  ||    *  || ||------||
Next pageNext page