Difference between pages "Install/Overview" and "Install/Partitioning"

(Difference between pages)
(Live CD)
 
(Filesystem Resources)
 
Line 1: Line 1:
 
<noinclude>
 
<noinclude>
{{InstallPart|an initial overview of the installation process as well as LiveCD download and boot instructions.}}
+
{{InstallPart|the process of partitioning and filesystem creation}}
 
</noinclude>
 
</noinclude>
== Installation Overview ==
+
=== Prepare Hard Disk ===
  
This is a basic overview of the Funtoo installation process:
+
==== Introduction ====
  
# [[#Live CD|Download and boot the live CD of your choice]].
+
In earlier times, there was only one way to boot a PC-compatible computer. All of our desktops and servers had a standard BIOS, all our hard drives used Master Boot Records, and were partitioned using the MBR partition scheme. And we liked it that way!
# [[#Prepare Hard Disk|Prepare your disk]].
+
# [[#Creating filesystems|Create]] and [[#Mounting filesystems|mount]] filesystems.
+
# [[#Installing the Stage 3 tarball|Install the Funtoo stage tarball]] of your choice.
+
# [[#Chroot into Funtoo|Chroot into your new system]].
+
# [[#Downloading the Portage tree|Download the Portage tree]].
+
# [[#Configuring your system|Configure your system]] and [[#Configuring your network|network]].
+
# [[#Configuring and installing the Linux kernel|Install a kernel]].
+
# [[#Installing a Bootloader|Install a bootloader]].
+
# [[#Finishing Steps|Complete final steps]].
+
# [[#Restart your system|Reboot and enjoy]].
+
  
=== Live CD ===
+
Then, along came EFI and UEFI, which are new-style firmware designed to boot systems, along with GPT partition tables to support disks larger than 2.2TB. All of the sudden, we had a variety of options to boot Linux systems, turning what once was a one-method-fits-all approach into something a lot more complex.
  
Funtoo doesn't provide an "official" Funtoo Live CD. We recommend using the Gentoo-based [http://www.sysresccd.org/ System Rescue CD] as it contains lots of tools and utilities and supports both 32-bit and 64-bit systems. Download it here:
+
Let's take a moment to review the boot options available to you. This Install Guide uses, and recommends, the old-school method of BIOS booting and using an MBR. It works. There's nothing wrong with it. If your system disk is 2TB or smaller in size, it won't prevent you from using all of your disk's capacity, either.
  
http://www.sysresccd.org/Download
+
But, there are some situations where the old-school method isn't optimal. If you have a system disk >2TB in size, then MBR partitions won't allow you to access all your storage. So that's one reason. Another reason is that there are some so-called "PC" systems out there that don't support BIOS booting anymore, and force you to use UEFI to boot.
  
{{Note|If using an older version of System Rescue CD, '''be sure to select the <code>rescue64</code> kernel at the boot menu if you are installing a 64-bit system'''. By default, System Rescue CD used to boot in 32-bit mode though the latest version attempts to automatically detect 64-bit processors.}}
+
Our recommendation is still to go old-school unless you have reason not to. We call this method the '''BIOS + GRUB (MBR)''' method. It's the traditional method of setting up a PC-compatible system to boot Linux.
 +
 
 +
If you need to use UEFI to boot, we are supporting two options. One still uses the BIOS to boot, but with GPT partition tables to support system disks >2.2TB in size. We refer to this method as the '''BIOS + GRUB (GPT)''' method.
 +
 
 +
There is also another method, which avoids using the BIOS for booting at all. Instead, it uses UEFI, with GPT. We call this the '''UEFI + GRUB (GPT)''' method.
 +
 
 +
 
 +
===== Partitioning Recommendations =====
 +
 
 +
Below are our partitioning recommendations in table form. For MBR-based partitions, use the MBR Block Device and MBR code columns with <code>fdisk</code>. For GPT-based partitions, use the GPT Block Device and GPT Code columns with <code>gdisk</code>:
 +
 
 +
{{TableStart}}
 +
<tr class="active"><th>Partition</th>
 +
<th>Size</th>
 +
<th>MBR Block Device (<code>fdisk</code>)</th>
 +
<th>GPT Block Device (<code>gdisk</code>)</th>
 +
<th>Filesystem</th>
 +
<th>MBR Code</th>
 +
<th>GPT Code</th>
 +
</tr><tr>
 +
<td><code>/boot</code></td>
 +
<td>512 MB</td>
 +
<td><code>/dev/sda1</code></td>
 +
<td><code>/dev/sda1</code></td>
 +
<td>ext2</td>
 +
<td>83</td>
 +
<td>8300</td>
 +
</tr><tr>
 +
<td>GRUB boot loader partition</td>
 +
<td>1 MB</td>
 +
<td>''not required for MBR''</td>
 +
<td><code>/dev/sda2</code></td>
 +
<td>For GPT/GUID only, skip for MBR - no filesystem.</td>
 +
<td>''N/A''</td>
 +
<td>EF02</td>
 +
</tr><tr>
 +
<td>swap</td>
 +
<td>2x RAM for low-memory systems and production servers; otherwise 2GB.</td>
 +
<td><code>/dev/sda2</code></td>
 +
<td><code>/dev/sda3</code></td>
 +
<td>swap (default)</td>
 +
<td>82</td>
 +
<td>8200</td>
 +
</tr><tr>
 +
<td><code>/</code> (root)</td>
 +
<td>Rest of the disk, minimum of 10GB.  Note: to compile the <code>debian-sources</code> kernel, as described later on this page, requires a minimum of 14GB free space in <code>/tmp</code>; consider a minimum of 20GB in this case.</td>
 +
<td><code>/dev/sda3</code></td>
 +
<td><code>/dev/sda4</code></td>
 +
<td>XFS recommended, alternatively ext4</td>
 +
<td>83</td>
 +
<td>8300</td>
 +
</tr><tr>
 +
<td><code>/home</code> (optional) </td>
 +
<td>User storage and media. Typically most of the disk.</td>
 +
<td><code>/dev/sda4</code> (if created)</td>
 +
<td><code>/dev/sda5</code> (if created)</td>
 +
<td>XFS recommended, alternatively ext4</td>
 +
<td>83</td>
 +
<td>8300</td>
 +
</tr><tr>
 +
<td>LVM (optional)</td>
 +
<td>If you want to create an LVM volume.</td>
 +
<td><code>/dev/sda4</code> (PV, if created)</td>
 +
<td><code>/dev/sda5</code> (PV, if created)</td>
 +
<td>LVM PV</td>
 +
<td>8E</td>
 +
<td>8E00</td>
 +
</tr>{{TableEnd}}
 +
 
 +
===== Partitioning Using fdisk (MBR) =====
 +
 
 +
{{important|If you need to create a GPT partition table, see [[Partitioning using gdisk]] or [[Partitioning using parted]].}}
 +
 
 +
{{note|These install instructions assume you are installing Funtoo Linux to an hard disk using Master Boot Record partition tables (MBR). If you are installing Funtoo Linux on a machine where another OS is installed, there is an existing Linux distribution on your system that you want to keep or any other scenario (such as differing swap size requirements), then you will need to adapt these instructions to suit your needs.}}
 +
 
 +
<code>fdisk</code> is the tool used to create an MBR partition table. MBR is well-supported on PCs and is recommended if your system disk is 2TB or smaller.
 +
 
 +
====== Preparation ======
 +
 
 +
First, it's a good idea to make sure that you've found the correct hard disk to partition. Try this command and verify that <code>/dev/sda</code> is the disk that you want to partition:
 +
 
 +
<console>
 +
# ##i##fdisk -l /dev/sda
 +
 
 +
Disk /dev/sda: 640.1 GB, 640135028736 bytes, 1250263728 sectors
 +
Units = sectors of 1 * 512 = 512 bytes
 +
Sector size (logical/physical): 512 bytes / 512 bytes
 +
I/O size (minimum/optimal): 512 bytes / 512 bytes
 +
Disk label type: gpt
 +
 
 +
 
 +
#        Start          End    Size  Type            Name
 +
1        2048  1250263694  596.2G  Linux filesyste Linux filesystem
 +
</console>
 +
 
 +
Now, it's recommended that you erase any existing MBR or GPT partition tables on the disk, which could confuse the system's BIOS at boot time. We do this using <code>sgdisk</code>:
 +
{{fancywarning|This will make any existing partitions inaccessible! You are '''strongly''' cautioned and advised to backup any critical data before proceeding.}}
 +
 
 +
<console>
 +
# ##i##sgdisk --zap-all /dev/sda
 +
 
 +
Creating new GPT entries.
 +
GPT data structures destroyed! You may now partition the disk using fdisk or
 +
other utilities.
 +
</console>
 +
 
 +
This output is also nothing to worry about, as the command still succeded:
 +
 
 +
<console>
 +
***************************************************************
 +
Found invalid GPT and valid MBR; converting MBR to GPT format
 +
in memory.
 +
***************************************************************
 +
</console>
 +
 
 +
====== Partitioning ======
 +
 
 +
Now we will use <code>fdisk</code> to create the MBR partition table and partitions:
 +
 
 +
<console>
 +
# ##i##fdisk /dev/sda
 +
</console>
 +
 
 +
Within <code>fdisk</code>, follow these steps:
 +
 
 +
'''Empty the partition table''':
 +
 
 +
<console>
 +
Command (m for help): ##i##o ↵
 +
</console>
 +
 
 +
'''Create Partition 1''' (boot):
 +
 
 +
<console>
 +
Command (m for help): ##i##n ↵
 +
Partition type (default p): ##i##↵
 +
Partition number (1-4, default 1): ##i##↵
 +
First sector: ##i##↵
 +
Last sector: ##i##+128M ↵
 +
</console>
 +
 
 +
'''Create Partition 2''' (swap):
 +
 
 +
<console>
 +
Command (m for help): ##i##n ↵
 +
Partition type (default p): ##i##↵
 +
Partition number (2-4, default 2): ##i##↵
 +
First sector: ##i##↵
 +
Last sector: ##i##+2G ↵
 +
Command (m for help): ##i##t ↵
 +
Partition number (1,2, default 2): ##i## ↵
 +
Hex code (type L to list all codes): ##i##82 ↵
 +
</console>
 +
 
 +
'''Create the root partition:'''
 +
 
 +
<console>
 +
Command (m for help): ##i##n ↵
 +
Partition type (default p): ##i##↵
 +
Partition number (3,4, default 3): ##i##↵
 +
First sector: ##i##↵
 +
Last sector: ##i##↵
 +
</console>
 +
 
 +
'''Verify the partition table:'''
 +
 
 +
<console>
 +
Command (m for help): ##i##p
 +
 
 +
Disk /dev/sda: 298.1 GiB, 320072933376 bytes, 625142448 sectors
 +
Units: sectors of 1 * 512 = 512 bytes
 +
Sector size (logical/physical): 512 bytes / 512 bytes
 +
I/O size (minimum/optimal): 512 bytes / 512 bytes
 +
Disklabel type: dos
 +
Disk identifier: 0x82abc9a6
 +
 
 +
Device    Boot    Start      End    Blocks  Id System
 +
/dev/sda1          2048    264191    131072  83 Linux
 +
/dev/sda2        264192  4458495  2097152  82 Linux swap / Solaris
 +
/dev/sda3        4458496 625142447 310341976  83 Linux
 +
</console>
 +
 
 +
'''Write the parition table to disk:'''
 +
 
 +
<console>
 +
Command (m for help): ##i##w
 +
</console>
 +
 
 +
Your new MBR partition table will now be written to your system disk.
 +
 
 +
==== Creating filesystems ====
 +
 
 +
Before your newly-created partitions can be used, the block devices need to be initialized with filesystem ''metadata''. This process is known as ''creating a filesystem'' on the block devices. After filesystems are created on the block devices, they can be mounted and used to store files.
 +
 
 +
You will not create a filesystem on your swap partition, but will initialize it using the <code>mkswap</code> command so that it can be used as disk-based virtual memory. Then we'll run the <code>swapon</code> command to make your newly-initialized swap space active within the live CD environment, in case it is needed during the rest of the install process.
 +
 
 +
Note that we will not create a filesystem on the GRUB boot loader partition, as GRUB writes binary data directly to that partition when the boot loader is installed, which we'll do later.
 +
 
 +
You can see the commands you will need to type below. Like the rest of this document, it assumes that you are using a GPT partitioning scheme. If you are using MBR, your root filesystem will likely be created on <code>/dev/sda3</code> instead and you will need to adjust the target block devices. If you are following our recommendations, then simply do this:
 +
 
 +
'''We generally recommend XFS for root filesystems, although ext4 is also a good choice.''' This tutorial assumes the use of XFS. If you want to use ext4, then be sure that your <code>/etc/fstab</code> file reflects this.
 +
 
 +
{{fancywarning|1=
 +
When deploying an OpenVZ host, please use ext4 exclusively. The Parallels development team tests extensively with ext4, and modern versions of <code>openvz-rhel6-stable</code> are '''not''' compatible with XFS, and you may experience kernel bugs.
 +
}}
 +
 
 +
'''To use ext4 as your root filesystem:'''
 +
 
 +
<console>
 +
# ##i##mke2fs -t ext2 /dev/sda1
 +
# ##i##mkfs.ext4 /dev/sda3
 +
# ##i##mkswap /dev/sda2
 +
# ##i##swapon /dev/sda2
 +
</console>
 +
 
 +
'''To use XFS as your root filesystem:'''
 +
 
 +
<console>
 +
# ##i##mke2fs -t ext2 /dev/sda1
 +
# ##i##mkfs.xfs /dev/sda3
 +
# ##i##mkswap /dev/sda2
 +
# ##i##swapon /dev/sda2
 +
</console>
 +
 
 +
==== Mounting filesystems ====
 +
 
 +
Mount the newly-created filesystems as follows, creating <code>/mnt/funtoo</code> as the installation mount point:
 +
 
 +
<console>
 +
# ##i##mkdir /mnt/funtoo
 +
# ##i##mount /dev/sda3 /mnt/funtoo
 +
# ##i##mkdir /mnt/funtoo/boot
 +
# ##i##mount /dev/sda1 /mnt/funtoo/boot
 +
</console>
 +
 
 +
Optionally, if you have a separate filesystem for <code>/home</code> or anything else:
 +
 
 +
<console>
 +
# ##i##mkdir /mnt/funtoo/home
 +
# ##i##mount /dev/sda4 /mnt/funtoo/home
 +
</console>
 +
 
 +
If you have <code>/tmp</code> or <code>/var/tmp</code> on a separate filesystem, be sure to change the permissions of the mount point to be globally-writeable after mounting, as follows:
 +
 
 +
<console>
 +
# ##i##chmod 1777 /mnt/funtoo/tmp
 +
</console>

Revision as of 22:32, November 18, 2014


Note

This is a template that is used as part of the Installation instructions which covers: the process of partitioning and filesystem creation. Templates are being used to allow multiple variant install guides that use most of the same re-usable parts.


Prepare Hard Disk

Introduction

In earlier times, there was only one way to boot a PC-compatible computer. All of our desktops and servers had a standard BIOS, all our hard drives used Master Boot Records, and were partitioned using the MBR partition scheme. And we liked it that way!

Then, along came EFI and UEFI, which are new-style firmware designed to boot systems, along with GPT partition tables to support disks larger than 2.2TB. All of the sudden, we had a variety of options to boot Linux systems, turning what once was a one-method-fits-all approach into something a lot more complex.

Let's take a moment to review the boot options available to you. This Install Guide uses, and recommends, the old-school method of BIOS booting and using an MBR. It works. There's nothing wrong with it. If your system disk is 2TB or smaller in size, it won't prevent you from using all of your disk's capacity, either.

But, there are some situations where the old-school method isn't optimal. If you have a system disk >2TB in size, then MBR partitions won't allow you to access all your storage. So that's one reason. Another reason is that there are some so-called "PC" systems out there that don't support BIOS booting anymore, and force you to use UEFI to boot.

Our recommendation is still to go old-school unless you have reason not to. We call this method the BIOS + GRUB (MBR) method. It's the traditional method of setting up a PC-compatible system to boot Linux.

If you need to use UEFI to boot, we are supporting two options. One still uses the BIOS to boot, but with GPT partition tables to support system disks >2.2TB in size. We refer to this method as the BIOS + GRUB (GPT) method.

There is also another method, which avoids using the BIOS for booting at all. Instead, it uses UEFI, with GPT. We call this the UEFI + GRUB (GPT) method.


Partitioning Recommendations

Below are our partitioning recommendations in table form. For MBR-based partitions, use the MBR Block Device and MBR code columns with fdisk. For GPT-based partitions, use the GPT Block Device and GPT Code columns with gdisk:

Partition Size MBR Block Device (fdisk) GPT Block Device (gdisk) Filesystem MBR Code GPT Code
/boot 512 MB /dev/sda1 /dev/sda1 ext2 83 8300
GRUB boot loader partition 1 MB not required for MBR /dev/sda2 For GPT/GUID only, skip for MBR - no filesystem. N/A EF02
swap 2x RAM for low-memory systems and production servers; otherwise 2GB. /dev/sda2 /dev/sda3 swap (default) 82 8200
/ (root) Rest of the disk, minimum of 10GB. Note: to compile the debian-sources kernel, as described later on this page, requires a minimum of 14GB free space in /tmp; consider a minimum of 20GB in this case. /dev/sda3 /dev/sda4 XFS recommended, alternatively ext4 83 8300
/home (optional) User storage and media. Typically most of the disk. /dev/sda4 (if created) /dev/sda5 (if created) XFS recommended, alternatively ext4 83 8300
LVM (optional) If you want to create an LVM volume. /dev/sda4 (PV, if created) /dev/sda5 (PV, if created) LVM PV 8E 8E00
Partitioning Using fdisk (MBR)

Important

If you need to create a GPT partition table, see Partitioning using gdisk or Partitioning using parted.

Note

These install instructions assume you are installing Funtoo Linux to an hard disk using Master Boot Record partition tables (MBR). If you are installing Funtoo Linux on a machine where another OS is installed, there is an existing Linux distribution on your system that you want to keep or any other scenario (such as differing swap size requirements), then you will need to adapt these instructions to suit your needs.

fdisk is the tool used to create an MBR partition table. MBR is well-supported on PCs and is recommended if your system disk is 2TB or smaller.

Preparation

First, it's a good idea to make sure that you've found the correct hard disk to partition. Try this command and verify that /dev/sda is the disk that you want to partition:

# fdisk -l /dev/sda

Disk /dev/sda: 640.1 GB, 640135028736 bytes, 1250263728 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt


#         Start          End    Size  Type            Name
 1         2048   1250263694  596.2G  Linux filesyste Linux filesystem

Now, it's recommended that you erase any existing MBR or GPT partition tables on the disk, which could confuse the system's BIOS at boot time. We do this using sgdisk:

Warning

This will make any existing partitions inaccessible! You are strongly cautioned and advised to backup any critical data before proceeding.

# sgdisk --zap-all /dev/sda

Creating new GPT entries.
GPT data structures destroyed! You may now partition the disk using fdisk or
other utilities.

This output is also nothing to worry about, as the command still succeded:

***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory. 
***************************************************************
Partitioning

Now we will use fdisk to create the MBR partition table and partitions:

# fdisk /dev/sda

Within fdisk, follow these steps:

Empty the partition table:

Command (m for help): o ↵

Create Partition 1 (boot):

Command (m for help): n ↵
Partition type (default p): 
Partition number (1-4, default 1): 
First sector: 
Last sector: +128M ↵

Create Partition 2 (swap):

Command (m for help): n ↵
Partition type (default p): 
Partition number (2-4, default 2): 
First sector: 
Last sector: +2G ↵
Command (m for help): t ↵ 
Partition number (1,2, default 2): 
Hex code (type L to list all codes): 82 ↵

Create the root partition:

Command (m for help): n ↵
Partition type (default p): 
Partition number (3,4, default 3): 
First sector: 
Last sector: 

Verify the partition table:

Command (m for help): p

Disk /dev/sda: 298.1 GiB, 320072933376 bytes, 625142448 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x82abc9a6

Device    Boot     Start       End    Blocks  Id System
/dev/sda1           2048    264191    131072  83 Linux
/dev/sda2         264192   4458495   2097152  82 Linux swap / Solaris
/dev/sda3        4458496 625142447 310341976  83 Linux

Write the parition table to disk:

Command (m for help): w

Your new MBR partition table will now be written to your system disk.

Creating filesystems

Before your newly-created partitions can be used, the block devices need to be initialized with filesystem metadata. This process is known as creating a filesystem on the block devices. After filesystems are created on the block devices, they can be mounted and used to store files.

You will not create a filesystem on your swap partition, but will initialize it using the mkswap command so that it can be used as disk-based virtual memory. Then we'll run the swapon command to make your newly-initialized swap space active within the live CD environment, in case it is needed during the rest of the install process.

Note that we will not create a filesystem on the GRUB boot loader partition, as GRUB writes binary data directly to that partition when the boot loader is installed, which we'll do later.

You can see the commands you will need to type below. Like the rest of this document, it assumes that you are using a GPT partitioning scheme. If you are using MBR, your root filesystem will likely be created on /dev/sda3 instead and you will need to adjust the target block devices. If you are following our recommendations, then simply do this:

We generally recommend XFS for root filesystems, although ext4 is also a good choice. This tutorial assumes the use of XFS. If you want to use ext4, then be sure that your /etc/fstab file reflects this.

Warning

When deploying an OpenVZ host, please use ext4 exclusively. The Parallels development team tests extensively with ext4, and modern versions of openvz-rhel6-stable are not compatible with XFS, and you may experience kernel bugs.

To use ext4 as your root filesystem:

# mke2fs -t ext2 /dev/sda1 
# mkfs.ext4 /dev/sda3
# mkswap /dev/sda2
# swapon /dev/sda2

To use XFS as your root filesystem:

# mke2fs -t ext2 /dev/sda1 
# mkfs.xfs /dev/sda3
# mkswap /dev/sda2
# swapon /dev/sda2

Mounting filesystems

Mount the newly-created filesystems as follows, creating /mnt/funtoo as the installation mount point:

# mkdir /mnt/funtoo
# mount /dev/sda3 /mnt/funtoo
# mkdir /mnt/funtoo/boot
# mount /dev/sda1 /mnt/funtoo/boot

Optionally, if you have a separate filesystem for /home or anything else:

# mkdir /mnt/funtoo/home
# mount /dev/sda4 /mnt/funtoo/home

If you have /tmp or /var/tmp on a separate filesystem, be sure to change the permissions of the mount point to be globally-writeable after mounting, as follows:

# chmod 1777 /mnt/funtoo/tmp