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

< Install(Difference between pages)
(Removed page from translation)
 
(Removed page from translation)
 
Line 1: Line 1:
 
<noinclude>
 
<noinclude>
{{InstallPart|the process of partitioning and filesystem creation}}
+
{{InstallPart|the process of installing the Stage3 tarball}}
</noinclude>=== Prepare Hard Disk ===
+
</noinclude>==== Setting the Date ====
  
In this section, we'll learn about the different ways that Funtoo Linux can boot from a hard disk. By "boot", we mean the process by which Linux starts after you press the power button on your desktop, laptop or server. You can think of "booting" as a process that starts with your computer's firmware (built-in software) running, and then "finding" the Linux kernel and running it. The Linux kernel then takes over, identifies all your hardware, and starts.
+
{{Important|If your system's date and time are too far off (typically by months or years,) then it may prevent Portage from properly downloading source tarballs. This is because some of our sources are downloaded via HTTPS, which use SSL certificates and are marked with an activation and expiration date. However, if your system time is relatively close to correct, you can probably skip this step for now.}}
  
==== Background ====
+
Now is a good time to verify the date and time are correctly set to UTC. Use the {{c|date}} command to verify the date and time:
 
+
{{Note|If you are an absolute beginner to Linux, you may be less confused if you skip to the next section, [[#Which to Use?|Which to Use?]]}}
+
 
+
In earlier times, there was only one way to boot a PC-compatible computer. All of our desktops and servers had standard firmware called the "PC BIOS," all our hard drives used Master Boot Records at the beginning of the disk, where the PC BIOS would "look" to find boot loader code which would in turn load Linux, and our hard drives were partitioned into different regions using the standard MBR partition scheme. That was just how it was done. 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 define disk partitions on disks larger than 2.2TB. All of the sudden, we had a variety of options for installing and booting 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 options available to you for configuring a hard drive to boot Funtoo Linux. This Install Guide uses, and recommends, the old-school method of BIOS booting and using an MBR. It works and (except for rare cases) is universally supported. 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. So, out of compassion for people who fall into this predicament, this Install Guide documents UEFI booting too.
+
 
+
Our recommendation is still to go old-school unless you have reason not to. The boot loader we will be using to load the Linux kernel in this guide is called GRUB, so 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 recommend not using the MBR at all for booting, as some systems support this, but others don't. Instead, we recommend using UEFI to boot GRUB, which in turn will load Linux. We refer to this method as the '''UEFI + GRUB (GPT)''' method.
+
 
+
And yes, there are even more methods, some of which are documented on the [[Boot Methods]] page. We used to recommend a '''BIOS + GRUB (GPT)''' method but it is not consistently supported across a wide variety of hardware.
+
 
+
==== Which to Use? ====
+
 
+
'''The big question is -- which boot method should you use?''' Here's how to tell.
+
 
+
;Principle 1 - Old School: If you can reliably boot System Rescue CD and it shows you an initial light blue menu, you are booting the CD using the BIOS, and it's likely that you can thus boot Funtoo Linux using the BIOS. So, go old-school and use BIOS booting, ''unless'' you have some reason to use UEFI, such as having a >2.2TB system disk. In that case, see Principle 2, as your system may also support UEFI booting.
+
 
+
;Principle 2 - New School: If you can reliably boot System Rescue CD and it shows you an initial black and white menu -- congratulations, your system is configured to support UEFI booting. This means that you are ready to install Funtoo Linux to boot via UEFI. Your system may still support BIOS booting, but just be trying UEFI first. You can poke around in your BIOS boot configuration and play with this.
+
 
+
{{Note|'''Advanced Users May Wonder:''' What's the Big Difference between Old School and New School?: Here's the deal. If you go with old-school MBR partitions, your {{f|/boot}} partition will be an ext2 filesystem, and you'll use {{c|fdisk}} to create your MBR partitions. If you go with new-school GPT partitions and UEFI booting, your {{f|/boot}} partition will be a vfat filesystem, because this is what UEFI is able to read, and you will use {{c|gdisk}} to create your GPT partitions. And you'll install GRUB a bit differently. That's about all it comes down to, in case you were curious.}}
+
 
+
To install Funtoo Linux to boot via the New School UEFI method, you must boot System Rescue CD using UEFI. If you successfully boot sysresccd with UEFI, you will see an initial black and white screen to select the mode in which you will boot system rescue cd. Otherwise, if you see a blue screen with black text, UEFI will not be active and you will not be able to set up UEFI booting later in the install process!
+
 
+
{{Note|'''Some motherboards may appear to support UEFI, but don't.''' Do your research. For example, the Award BIOS in my Gigabyte GA-990FXA-UD7 rev 1.1 has an option to enable UEFI boot for CD/DVD. '''This is not sufficient for enabling UEFI boot for hard drives and installing Funtoo Linux.''' UEFI must be supported for both removable media (so you can boot System Rescue CD using UEFI) as well as fixed media (so you can boot your new Funtoo Linux installation.) It turns out that later revisions of this board (rev 3.0) have a new BIOS that fully supports UEFI boot.  This may point to a third principle -- know thy hardware.}}
+
 
+
==== Old-School (BIOS/MBR) Method ====
+
 
+
{{Note|Use this method if you are booting using your BIOS, and if your System Rescue CD initial boot menu was light blue. If you're going to use the new-school method, [[#New-School (UEFI/GPT) Method|click here to jump down to UEFI/GPT.]]}}
+
 
+
===== 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 {[f|/dev/sda}} is the disk that you want to partition:
+
  
 
{{console|body=
 
{{console|body=
###i## fdisk -l /dev/sda
+
###i## date
 
+
Fri Jul 15 19:47:18 UTC 2011
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
+
 
}}
 
}}
 
+
If the date and/or time need to be corrected, do so using {{c|date MMDDhhmmYYYY}}, keeping in mind {{c|hhmm}} are in 24-hour format. The example below changes the date and time to "July 16th, 2011 @ 8:00PM" UTC:
Now, it is 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 accomplish this using {{c|sgdisk}}:
+
{{Warning|This will make any existing partitions inaccessible! You are '''strongly''' cautioned and advised to backup any critical data before proceeding.}}
+
  
 
{{console|body=
 
{{console|body=
###i## sgdisk --zap-all /dev/sda
+
###i## date 071620002011
 
+
Fri Jul 16 20:00:00 UTC 2011
Creating new GPT entries.
+
GPT data structures destroyed! You may now partition the disk using fdisk or
+
other utilities.
+
 
}}
 
}}
 +
Once you have set the system clock, it's a very good idea to copy the time to the hardware clock, so it persists across reboots:
  
This output is also nothing to worry about, as the command still succeded:
+
{{console|body=###i## hwclock --systohc}}
  
{{console|body=
+
=== Installing the Stage 3 tarball ===
***************************************************************
+
Found invalid GPT and valid MBR; converting MBR to GPT format
+
in memory.
+
***************************************************************
+
}}
+
===== Partitioning =====
+
  
Now we will use {{c|fdisk}} to create the MBR partition table and partitions:
+
Now that filesystems are created and your hardware and system clock are set, the next step is downloading the initial Stage 3 tarball. The Stage 3 is a pre-compiled system used as a starting point to install Funtoo Linux.  Notice: if you're using virtual machines (like Vbox) generic stage3 images are preferred rather than cpu-optimized ones.
  
{{console|body=
+
To download the correct build of Funtoo Linux for your system, head over to the [[Subarches]] page. Subarches are builds of Funtoo Linux that are designed to run on a particular type of CPU, to offer the best possible performance. They also take advantage of the instruction sets available for each CPU.
###i## fdisk /dev/sda
+
}}
+
  
Within {{c|fdisk}}, follow these steps:
+
The [[Subarches]] page lists all CPU-optimized versions of Funtoo Linux. Find the one that is appropriate for the type of CPU that your system has, and then click on its name in the first column (such as {{c|corei7}}, for example.) You will then go to a page dedicated to that subarch, and the available stage3's available for download will be listed.
  
'''Empty the partition table''':
+
For most subarches, you will have several stage3's available to choose from. This next section will help you understand which one to pick.
  
{{console|body=
+
==== Which Build? ====
Command (m for help): ##i##o ↵
+
}}
+
'''Create Partition 1''' (boot):
+
  
{{console|body=
+
'''If you're not sure, pick {{c|funtoo-current}}.'''
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 ↵
+
}}
+
'''Create Partition 2''' (swap):
+
  
{{console|body=
+
Funtoo Linux has various different 'builds':
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 ↵
+
}}
+
'''Create the root partition:'''
+
  
{{console|body=
+
{{TableStart}}
Command (m for help): ##i##n ↵
+
<tr><th class="info">Build</th><th class="info">Description</th></tr>
Partition type (default p): ##i##↵
+
<tr><td>{{c|funtoo-current}}</td><td>The most commonly-selected build of Funtoo Linux. Receives rapid updates and preferred by desktop users.</td></tr>
Partition number (3,4, default 3): ##i##↵
+
<tr><td>{{c|funtoo-stable}}</td><td>Emphasizes less-frequent package updates and trusted, reliable versions of packages over the latest versions.</td></tr>
First sector: ##i##↵
+
{{TableEnd}}
Last sector: ##i##↵
+
}}
+
'''Verify the partition table:'''
+
  
{{console|body=
+
==== Which Variant? ====
Command (m for help): ##i##p
+
  
Disk /dev/sda: 298.1 GiB, 320072933376 bytes, 625142448 sectors
+
'''If you're not sure, pick {{c|standard}}.'''
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
+
Our "regular" stage3's are listed with a variant of {{c|standard}}. The following variant builds are available:
/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:'''
+
  
{{console|body=Command (m for help): ##i##w}}
+
{{TableStart}}
Your new MBR partition table will now be written to your system disk.
+
<tr><th class="info">Variant</th><th class="info">Description</th></tr>
 +
<tr><td>{{c|standard}}</td><td>The "standard" version of Funtoo Linux</td></tr>
 +
<tr><td>{{c|pure64}}</td><td>A 64-bit build that drops multilib (32-bit compatibility) support. Can be ideal for server systems.</td></tr>
 +
<tr><td>{{c|hardened}}</td><td>Includes PIE/SSP toolchain for enhanced security. PIE does require the use of PaX in the kernel, while SSP works with any kernel, and provides enhanced security in user-space to avoid stack-based exploits. For expert users.</td></tr>
 +
{{TableEnd}}
  
{{Note|You're done with partitioning! Now, jump over to [[#Creating filesystems|Creating filesystems]].}}
+
==== Download the Stage3 ====
  
==== New-School (UEFI/GPT) Method ====
+
Once you have found the stage3 that you would like to download, use {{c|wget}} to download the Stage 3 tarball you have chosen to use as the basis for your new Funtoo Linux system. It should be saved to the {{f|/mnt/funtoo}} directory as follows:
 
+
{{Note|Use this method if you are interested in booting using UEFI, and if your System Rescue CD initial boot menu was black and white. If it was light blue, this method will not work.}}
+
 
+
The {{c|gdisk}} commands to create a GPT partition table are as follows. Adapt sizes as necessary, although these defaults will work for most users. Start {{c|gdisk}}:
+
 
+
{{console|body=###i## gdisk /dev/sda}}
+
Within {{c|gdisk}}, follow these steps:
+
 
+
'''Create a new empty partition table''' (This ''will'' erase all data on the disk when saved):
+
  
 
{{console|body=
 
{{console|body=
Command: ##i##o ↵
+
###i## cd /mnt/funtoo
This option deletes all partitions and creates a new protective MBR.
+
###i## wget http://build.funtoo.org/funtoo-current/x86-64bit/generic_64/stage3-latest.tar.xz
Proceed? (Y/N): ##i##y ↵
+
 
}}
 
}}
'''Create Partition 1''' (boot):
+
Note that 64-bit systems can run 32-bit or 64-bit stages, but 32-bit systems can only run 32-bit stages. Make sure that you select a Stage 3 build that is appropriate for your CPU. If you are not certain, it is a safe bet to choose the {{c|generic_64}} or {{c|generic_32}} stage. Consult the [[Subarches]] page for more information.
  
 +
Once the stage is downloaded, extract the contents with the following command, substituting in the actual name of your stage 3 tarball:
 
{{console|body=
 
{{console|body=
Command: ##i##n ↵
+
###i## tar xpf stage3-latest.tar.xz
Partition Number: ##i##1 ↵
+
First sector: ##i##↵
+
Last sector: ##i##+500M ↵
+
Hex Code: ##i##EF00 ↵
+
 
}}
 
}}
'''Create Partition 2''' (swap):
+
{{Important|It is very important to use {{c|tar's}} "{{c|'''p'''}}" option when extracting the Stage 3 tarball - it tells {{c|tar}} to ''preserve'' any permissions and ownership that exist within the archive. Without this option, your Funtoo Linux filesystem permissions will be incorrect.}}
 
+
{{console|body=
+
Command: ##i##n ↵
+
Partition Number: ##i##2 ↵
+
First sector: ##i##↵
+
Last sector: ##i##+4G ↵
+
Hex Code: ##i##8200 ↵
+
}}
+
'''Create Partition 3''' (root):
+
 
+
{{console|body=
+
Command: ##i##n ↵
+
Partition Number: ##i##3 ↵
+
First sector: ##i##↵
+
Last sector: ##i##↵##!i## (for rest of disk)
+
Hex Code: ##i##↵
+
}}
+
Along the way, you can type "{{c|p}}" and hit Enter to view your current partition table. If you make a mistake, you can type "{{c|d}}" to delete an existing partition that you created. When you are satisfied with your partition setup, type "{{c|w}}" to write your configuration to disk:
+
 
+
'''Write Partition Table To Disk''':
+
 
+
{{console|body=
+
Command: ##i##w ↵
+
Do you want to proceed? (Y/N): ##i##Y ↵
+
}}
+
The partition table will now be written to the disk and {{c|gdisk}} will close.
+
 
+
Now, your GPT/GUID partitions have been created, and will show up as the following ''block devices'' under Linux:
+
 
+
* {{c|/dev/sda1}}, which will be used to hold the {{c|/boot}} filesystem,
+
 
+
* {{c|/dev/sda2}}, which will be used for swap space, and  
+
 
+
* {{c|/dev/sda3}}, which will hold your root filesystem.
+
 
+
{{Tip|You can verify that the block devices above were correctly created by running the command {{c|lsblk}}.}}
+
==== Creating filesystems ====
+
 
+
{{Note|This section covers both BIOS ''and'' UEFI installs. Don't skip it!}}
+
 
+
Before your newly-created partitions can be used, the block devices that were created in the previous step 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.
+
 
+
Let's keep this simple. Are you using old-school MBR partitions? If so, let's create an ext2 filesystem on {{f|/dev/sda1}}:
+
 
+
{{console|body=###i## mkfs.ext2 /dev/sda1}}
+
If you're using new-school GPT partitions for UEFI, you'll want to create a vfat filesystem on {{c|/dev/sda1}}, because this is what UEFI is able to read:
+
 
+
{{console|body=###i## mkfs.vfat -F 32 /dev/sda1}}
+
Now, let's create a swap partition. This partition will be used as disk-based virtual memory for your Funtoo Linux system.
+
 
+
You will not create a filesystem on your swap partition, since it is not used to store files. But it is necessary to initialize it using the {{c|mkswap}} command. Then we'll run the {{c|swapon}} command to make your newly-initialized swap space immediately active within the live CD environment, in case it is needed during the rest of the install process:
+
 
+
{{console|body=
+
# ##i##mkswap /dev/sda2
+
# ##i##swapon /dev/sda2
+
}}
+
Now, we need to create a root filesystem. This is where Funtoo Linux will live. We generally recommend ext4 or XFS root filesystems. If you're not sure, choose ext4. Here's how to create a root ext4 filesystem:
+
 
+
{{console|body=###i## mkfs.ext4 /dev/sda3}}
+
...and here's how to create an XFS root filesystem, if you prefer to use XFS instead of ext4:
+
 
+
{{console|body=###i## mkfs.xfs /dev/sda3}}
+
Your filesystems (and swap) have all now been initialized, so that that can be mounted (attached to your existing directory heirarchy) and used to store files. We are ready to begin installing Funtoo Linux on these brand-new filesystems.
+
 
+
{{Warning|When deploying an OpenVZ host, please use ext4 exclusively. The Parallels development team tests extensively with ext4, and modern versions of {{c|openvz-rhel6-stable}} are '''not''' compatible with XFS, and you may experience kernel bugs.}}
+
 
+
==== Mounting filesystems ====
+
 
+
Mount the newly-created filesystems as follows, creating {{c|/mnt/funtoo}} as the installation mount point:
+
 
+
{{console|body=
+
###i## mkdir /mnt/funtoo
+
###i## mount /dev/sda3 /mnt/funtoo
+
###i## mkdir /mnt/funtoo/boot
+
###i## mount /dev/sda1 /mnt/funtoo/boot
+
}}
+
Optionally, if you have a separate filesystem for {{f|/home}} or anything else:
+
 
+
{{console|body=
+
###i## mkdir /mnt/funtoo/home
+
###i## mount /dev/sda4 /mnt/funtoo/home
+
}}
+
If you have {{f|/tmp}} or {{f|/var/tmp}} on a separate filesystem, be sure to change the permissions of the mount point to be globally-writeable after mounting, as follows:
+
 
+
{{console|body=###i## chmod 1777 /mnt/funtoo/tmp}}
+

Latest revision as of 20:34, July 16, 2015


Note

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

Setting the Date

Important

If your system's date and time are too far off (typically by months or years,) then it may prevent Portage from properly downloading source tarballs. This is because some of our sources are downloaded via HTTPS, which use SSL certificates and are marked with an activation and expiration date. However, if your system time is relatively close to correct, you can probably skip this step for now.

Now is a good time to verify the date and time are correctly set to UTC. Use the date command to verify the date and time:

# date
Fri Jul 15 19:47:18 UTC 2011

If the date and/or time need to be corrected, do so using date MMDDhhmmYYYY, keeping in mind hhmm are in 24-hour format. The example below changes the date and time to "July 16th, 2011 @ 8:00PM" UTC:

# date 071620002011
Fri Jul 16 20:00:00 UTC 2011

Once you have set the system clock, it's a very good idea to copy the time to the hardware clock, so it persists across reboots:

# hwclock --systohc


Installing the Stage 3 tarball

Now that filesystems are created and your hardware and system clock are set, the next step is downloading the initial Stage 3 tarball. The Stage 3 is a pre-compiled system used as a starting point to install Funtoo Linux. Notice: if you're using virtual machines (like Vbox) generic stage3 images are preferred rather than cpu-optimized ones.

To download the correct build of Funtoo Linux for your system, head over to the Subarches page. Subarches are builds of Funtoo Linux that are designed to run on a particular type of CPU, to offer the best possible performance. They also take advantage of the instruction sets available for each CPU.

The Subarches page lists all CPU-optimized versions of Funtoo Linux. Find the one that is appropriate for the type of CPU that your system has, and then click on its name in the first column (such as corei7, for example.) You will then go to a page dedicated to that subarch, and the available stage3's available for download will be listed.

For most subarches, you will have several stage3's available to choose from. This next section will help you understand which one to pick.

Which Build?

If you're not sure, pick funtoo-current.

Funtoo Linux has various different 'builds':

BuildDescription
funtoo-currentThe most commonly-selected build of Funtoo Linux. Receives rapid updates and preferred by desktop users.
funtoo-stableEmphasizes less-frequent package updates and trusted, reliable versions of packages over the latest versions.

Which Variant?

If you're not sure, pick standard.

Our "regular" stage3's are listed with a variant of standard. The following variant builds are available:

VariantDescription
standardThe "standard" version of Funtoo Linux
pure64A 64-bit build that drops multilib (32-bit compatibility) support. Can be ideal for server systems.
hardenedIncludes PIE/SSP toolchain for enhanced security. PIE does require the use of PaX in the kernel, while SSP works with any kernel, and provides enhanced security in user-space to avoid stack-based exploits. For expert users.

Download the Stage3

Once you have found the stage3 that you would like to download, use wget to download the Stage 3 tarball you have chosen to use as the basis for your new Funtoo Linux system. It should be saved to the /mnt/funtoo directory as follows:

# cd /mnt/funtoo
# wget http://build.funtoo.org/funtoo-current/x86-64bit/generic_64/stage3-latest.tar.xz

Note that 64-bit systems can run 32-bit or 64-bit stages, but 32-bit systems can only run 32-bit stages. Make sure that you select a Stage 3 build that is appropriate for your CPU. If you are not certain, it is a safe bet to choose the generic_64 or generic_32 stage. Consult the Subarches page for more information.

Once the stage is downloaded, extract the contents with the following command, substituting in the actual name of your stage 3 tarball:

# tar xpf stage3-latest.tar.xz
Important

It is very important to use tar's "p" option when extracting the Stage 3 tarball - it tells tar to preserve any permissions and ownership that exist within the archive. Without this option, your Funtoo Linux filesystem permissions will be incorrect.