Difference between pages "Dell PowerEdge 11G Servers" and "Install/ru/Partitioning"

From Funtoo
(Difference between pages)
Jump to navigation Jump to search
 
 
Line 1: Line 1:
__NOTITLE__
<noinclude>
{{InstallPart|процесс разбиения диска и создания файловых систем}}
</noinclude>
=== Подготовка жесткого диска ===


== Funtoo Linux on Dell PowerEdge 11G Servers ==
В этой части  мы научимся различным способам установки Funtoo Linux -- и загрузки с -- жесткий диск.


This section provides valuable information regarding the use of Funtoo Linux on Dell PowerEdge 11G servers. This information has been validated on Dell PowerEdge R710 systems with Intel Xeon 5500 processors but should also apply to varying degrees to the entire Dell PowerEdge 11G family.
==== Введение ====


'''Please be sure to read all important compatibility notes associated with your specific Dell PowerEdge model, which can be found in the ''Important Compatibility Notes'' column in the table below:'''
В прежние времена существовал лишь один способ загрузить PC-совместимый компьютер. Все наши дектопы и сервера имели стандартный PC BIOS, все наши харды использовали MBR и были разбиты используя схему разбивки MBR.  Вот как это все было и нам это нравилось!


{| {{table}}
Затем появились EFI и UEFI, встроенные программы нового образца наряду со схемой разбивки GPT, поддерживающая диски размером более 2.2TБ. Неожиданно, нам стали доступны различные способы установки и загрузки Линукс систем . То, что было единым методом, стало чем-то более сложным.
!System
!Form Factor
!Processor
!Integrated NIC
!Important Compatibility Notes
|-
|R210
|1U
|Intel Xeon 3400 series
|BCM 5716
|<ref group="hw" name="bcm">'''When using a non-RHEL-5 kernel, it's highly recommended to <tt>emerge broadcom-netxtreme2</tt> after installing your kernel, in order to use the latest drivers from Broadcom.com rather than the in-kernel <tt>bnx2</tt> (1GbE) or <tt>bnx2x</tt> (10GbE) drivers. This will help resolve firmware initialization and other hardware compatibility issues that may result in your network interfaces being unavailable at boot or performing sub-optimally under load. See [[#Kernel Compatibility|Kernel Compatibility]] for more information.'''</ref>
|-
|R310
|1U
|Intel Xeon 3400 series
|2x1GbE (BCM 5716)
|<ref group="hw" name="bcm"/>
|-
|R410
|1U
|Intel Xeon 5500 series
|2x1GbE (BCM 5716)
|<ref group="hw" name="bcm"/><ref group="hw" name="intel5500">'''The Intel Xeon 5500 and 5600 series processors used in Dell PowerEdge 11G servers have known errata (bugs) related to C-states (CPU power saving states) that can and will result in unexpected and unpleasant server behavior in real-world, day-to-day operation. Intel has released CPU microcode updates in 2010 and early 2011 to address these issues. Be sure to update your BIOS to the most recent available from Dell. Dell includes Intel CPU microcode updates as part of their BIOS updates. BIOS 3.0.0 or greater is recommended.'''


For more information on Intel Xeon 5500 errata, see [http://www.intel.com/assets/pdf/specupdate/321324.pdf Intel's Xeon Processor 5500 Series Specification Update, April 2011].</ref>
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.
|-
|R415
|1U
|AMD Opteron 4100 series
|2x1GbE (BCM 5716)
|<ref group="hw" name="bcm"/>
|-
|R510
|2U
|Intel Xeon 5500 series
|2x1GbE (BCM 5716)
|<ref group="hw" name="bcm"/><ref group="hw" name="intel5500"/>
|-
|R515
|2U
|AMD Opteron 4100 series
|2x1GbE (BCM 5716)
|<ref group="hw" name="bcm"/>
|-
|R710
|2U
|Intel Xeon 5500/5600 series
|4x1GbE (BCM 5709c)
|<ref group="hw" name="bcm"/><ref group="hw" name="intel5500"/>
|-
|R715
|2U
|AMD Opteron 6100 series
|4x1GbE (BCM 5709c)
|<ref group="hw" name="bcm"/>
|-
|R810
|2U
|Intel Xeon 6500/7500 series
|4x1GbE (BCM 5709c)
|<ref group="hw" name="bcm"/>
|-
|R815
|2U
|AMD Opteron 6100 series
|4x1GbE (BCM 5709c)
|<ref group="hw" name="bcm"/>
|-
|R910
|4U
|Intel Xeon 7500/E7 series
|4x1GbE (BCM 5709c) or 2x10GbE + 2x1GbE (BCM 57771)
|<ref group="hw" name="bcm"/>
|-
|T310
|Tower
|Intel Xeon 3400 series
|optional BCM 5709c (PCI-E)
|<ref group="hw" name="bcm"/>
|-
|T610
|Tower
|Intel Xeon 5500/5600 series
|2x1GbE (BCM 5709c)
|<ref group="hw" name="bcm"/><ref group="hw" name="intel5500"/>
|-
|T710
|Tower
|Intel Xeon 5500/5600 series
|4x1GbE (BCM 5709c)
|<ref group="hw" name="bcm"/><ref group="hw" name="intel5500"/>
|-
|}


==== Important Hardware Notices ====
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.


<references group="hw"/>
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.


=== Updating Firmware ===
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.


The most reliable method to update firmware is to use Dell Repository Manager. This program requires Windows but has the ability to make a bootable Linux ISO image that can update your server firmware in an efficient manner. The PowerEdge R710 also has a built-in "Unified Server Configurator" that can be used to update firmware in a pinch, but it is can take an extremely long time to download and apply server updates.
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.


'''Use of the Dell Repository Manager to build a Linux bootable ISO image is the recommended method of updating Dell firmware. A step-by-step guide for using Dell Repository Manager can be found below:'''
'''The big question is -- which boot method should you use?''' Here's how to tell.


==== Dell Repository Manager ====
;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.
'''Important: It is recommended that you download the latest Dell Repository Manager which can be downloaded following instructions in [http://en.community.dell.com/support-forums/servers/f/177/p/19433362/20058722.aspx#20058722 this thread post]. It resolves issues creating ISOs under Windows 7.'''


Here's a complete list of steps to update Dell firmware using the Dell Repository Manager:
;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.


# Download Dell Repository Manager from http://ftp.dell.com/FOLDER00313115M/1/Dell_Repository_Manager_1.4.113.msi and install on a Windows system.
;What's the Big Difference between Old School and New School?: Here's the deal. If you go with old-school MBR partitions, your <code>/boot</code> partition will be an ext2 filesystem, and you'll use <code>fdisk</code> to create your MBR partitions. If you go with new-school GPT partitions and UEFI booting, your <code>/boot</code> partition will be a vfat filesystem, because this is what UEFI is able to read, and you will use <code>gdisk</code> 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.
# Launch the program.
# In the main window, choose to automatically import ftp.dell.com, and click "Import Repository": <br/>[[image:dellrepoman.PNG]]
# Welcome: The Create/Load Repository dialog will open. Select "Create New Repository" and click "Next".
# Name and Description: Type in a name of your choice, such as "Dell R710", and click "Next".
# Select Repository: Select "(Server) ftp.dell.com" and click "Next".
# Select Form Factor: Select the type(s) of equipment you want to build a driver disk for and click "Next".
# Select OS: Select "Linux". Click "Next".
# Select Models: Choose the specific model of equipment ("PowerEdge R710", for example.) Click "Next".
# Select Bundle(s): Choose to "ONLY include most recent and custom bundle(s)". Click "Next".
# Additional Components: Select "Yes". Click "Next".
# Summary: click "Finish".
# "Please wait" will appear for a few minutes, and then the dialog will disappear.
# The "Bundles" tab will now be active with your bundle visible.
# Select your bundle by clicking the square check-box to the left of it.
# Click "Export" in the lower right corner of the main window, and click "Next" on the Welcome screen.
# Export Destination: Select "Deployment Media (Linux only) Export to ISO/Script format for deployment." Click "Next".
# At this point, you may be prompted to install a plugin. Install the plugin and click "Next".
# Select an output folder for the ISO, click "OK", and then "Next".
# Select Custom Script: Select "No" and click "Next".
# Click "Finish".
# Your ISO will take 5-10 minutes to build. The program will let you know when it's done.
# Burn ISO to CD-R/DVD-R.
# Insert burnt disc into server, reboot server, press F11 for boot menu and choose to boot from CD.
# The disc will boot. Select the first menu option to launch the firmware update process.
# The process will take 20-30 minutes to complete. Press Alt-F2 for a console if you get bored.
# When the firmware update process is complete, a message will appear on the screen. Hit Enter to reboot.


The disc can now be used to update other similar systems in your datacenter.
;Also Note: To install Funtoo Linux to boot via the New School UEFI method, you must boot System Rescue CD using UEFI -- and see an initial black and white screen. Otherwise, UEFI will not be active and you will not be able to set it up!


==== iDRAC6 ====
{{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.}}


iDRAC is the Dell Integrated Remote Access Controller, which is typically accessed via the dedicated management interface using a Web browswer.
==== Old-School (BIOS/MBR) Method ====


Sometimes, the iDRAC firmware will not be successfully updated via the firmware CD-R created using the steps in the section above. This was experienced on our servers when attempting to update from iDRAC firmware 1.54 to 1.70. To work around this issue, you can log in directly to the iDRAC via a Web browser and update the iDRAC's firmware (just the iDRAC firmware itself, not the firmware of other system components) via its user interface.
{{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.]]}}


To do this, follow these steps:
===== Preparation =====


# Go to http://support.dell.com, and download the latest Dell iDRAC6 firmware. You will want to download the Windows executable format file, ie. <tt>iDRAC6_1.70_A02_FW_IMG.exe</tt>.
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:
# Execute this file on a Windows machine. It is a self-extracting archive and will prompt you for a location to store the firmware. Choose a location and a file named <tt>firmimg.d6</tt> will be extracted. This is the iDRAC firmware you will upload.
# Log in to the iDRAC using a Web browser. If updating from 1.54, use Google Chrome instead of Internet Explorer 9 to avoid issues.
# Select "Remote Access" (or in newer versions, "iDRAC Settings") from the menu on the left, and the "Update" tab at the top of the page.
# On this page, click the "Choose File" button and select the <tt>firmimg.d6</tt> file extracted earlier.
# Click "Upload". Uploading the firmware will take a minute or two.
# Once the firmware image is uploaded, you will be able to click a button to update the firmware. You will be presented with a status page similar to this:<br/>[[Image:Idrac6update.PNG]]
# Once the iDRAC firmware is 100% complete, you can reload the iDRAC Web page and log in to the new version of iDRAC.
# Note that because iDRAC is independent from the underlying hardware, your Linux system will typically not power cycle during this process, so it will still be available.


=== Kernel Compatibility ===
<console>
# ##i##fdisk -l /dev/sda


The following table documents kernel compatibility with the Dell PowerEdge R710 server, and is likely to apply to other PowerEdge 11G servers based on Intel Xeon 5500/5600 series processors.
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


{{fancynote|Funtoo Linux kernel testing is performed on Dell PowerEdge R710 servers equipped with Intel 5500 series processors.}}


All kernels listed below were built by setting the <tt>binary</tt> USE variable and emerging, which causes full kernel sources as well as a binary kernel and initrd (built using <tt>genkernel</tt>) to be installed. Note that for the <tt>openvz-rhel5-stable</tt> kernel, udev must be downgraded to 146-r3 in order for the system to function properly after reboot. This can be accomplished by adding <tt>>=sys-fs/udev-147</tt> to <tt>/etc/portage/package.mask</tt> and running <tt>emerge udev</tt> prior to booting your new kernel.
#        Start          End    Size  Type            Name
1        2048  1250263694  596.2G  Linux filesyste Linux filesystem
</console>


{| {{table}}
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>:
!Kernel
{{fancywarning|This will make any existing partitions inaccessible! You are '''strongly''' cautioned and advised to backup any critical data before proceeding.}}
!Version
!Minimum Dell BIOS
!Req'd USE flags
!Stability
!Req'd drivers
!Req'd udev
|-
|openvz-rhel5-stable
|2.6.18.028.089.1
|3.0.0<ref group="kernel" name="bios">Without an up-to-date BIOS, you may experience system instability or a system clock that jumps forward (and back) 5 minutes for no apparent reason. Upgrading to at least Dell BIOS 3.0.0 should update Intel CPU microcode sufficiently to correct these issues.</ref>
|<tt>binary</tt>
|'''Excellent'''
|Broadcom <tt>bnx2</tt> driver module bundled with kernel appears to be OK
|=sys-fs/udev-146*
|-
|openvz-rhel5-stable
|2.6.18.028.091.1
|3.0.0<ref group="kernel" name="bios"/>
|<tt>binary</tt>
|'''Excellent'''
|Broadcom <tt>bnx2</tt> driver module bundled with kernel appears to be OK
|=sys-fs/udev-146*
|-
|ubuntu-server
|2.6.32.32.62
|3.0.0<ref group="kernel" name="bios"/>
|<tt>binary</tt>
|'''Excellent'''
|<tt>emerge broadcom-netxtreme2</tt> for reliable BCM5709+ support (integrated NIC)
|N/A <ref group="kernel" name="udevany"/>
|-
|openvz-rhel6-stable
|2.6.32.014.1
|3.0.0<ref group="kernel" name="bios"/>
|<tt>binary</tt>
|''Buggy, do not use''
|<tt>emerge broadcom-netxtreme2</tt> for reliable BCM5709+ support (integrated NIC)
|N/A <ref group="kernel" name="udevany">Any standard Funtoo Linux udev version is fine.</ref>
|-
|openvz-rhel6-stable
|2.6.32.015.1
|3.0.0<ref group="kernel" name="bios"/>
|<tt>binary</tt>
|''Buggy, do not use''
|<tt>emerge broadcom-netxtreme2</tt> for reliable BCM5709+ support (integrated NIC)
|N/A <ref group="kernel"  name="udevany"/>
|-
|openvz-rhel6-stable
|2.6.32.016.1
|3.0.0<ref group="kernel" name="bios"/>
|<tt>binary</tt>
|''Buggy, do not use''
|<tt>emerge broadcom-netxtreme2</tt> for reliable BCM5709+ support (integrated NIC)
|N/A <ref group="kernel" name="udevany"/>
|}


<references group="kernel"/>
<console>
# ##i##sgdisk --zap-all /dev/sda


== Server Best Practices ==
Creating new GPT entries.
GPT data structures destroyed! You may now partition the disk using fdisk or
other utilities.
</console>


This section contains a list of recommended programs, utilities and best practices for production servers.
This output is also nothing to worry about, as the command still succeded:


=== Accurate System Time (NTP) ===
<console>
***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory.
***************************************************************
</console>


My favorite and recommended NTP client/server is <tt>net-misc/chrony</tt>. It is recommended for production servers:
===== Partitioning =====


<pre>
Now we will use <code>fdisk</code> to create the MBR partition table and partitions:
# emerge chrony
# rc-update add chronyd default
</pre>


Use something like the following for your <tt>/etc/chrony/chrony.conf</tt>:
<console>
# ##i##fdisk /dev/sda
</console>


<pre>
Within <code>fdisk</code>, follow these steps:
server time.apple.com
maxupdateskew 100
driftfile /etc/chrony/chrony.drift
keyfile /etc/chrony/chrony.keys
commandkey 1
dumponexit
dumpdir /var/log/chrony
initstepslew 10 time.apple.com
logdir /var/log/chrony
log measurements statistics tracking
logchange 0.5
mailonchange me@emailprovider.com 0.5
rtcfile /etc/chrony/chrony.rtc
rtconutc
sched_priority 1
lock_all
</pre>


Chronyd can then be started immediately by running <tt>rc</tt> to start all new services:
'''Empty the partition table''':


<pre>
<console>
# rc
Command (m for help): ##i##o ↵
</pre>
</console>


You should notice a marked improvement in your system clock's accuracy. If your system time was off by a significant amount, <tt>chronyd</tt> will gradually correct your clock while the system runs.
'''Create Partition 1''' (boot):


=== SMART Disk Monitoring ===
<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>


Emerge <tt>smartmontools</tt> and use an <tt>/etc/smartd.conf</tt> with these settings for a PERC 6/i with 5 physical disks installed:
'''Create Partition 2''' (swap):


<pre>
<console>
/dev/sda -m myemail@foo.com -d megaraid,0
Command (m for help): ##i##n ↵
/dev/sda -m myemail@foo.com -d megaraid,1
Partition type (default p): ##i##↵
/dev/sda -m myemail@foo.com -d megaraid,2
Partition number (2-4, default 2): ##i##↵
/dev/sda -m myemail@foo.com -d megaraid,3
First sector: ##i##↵
/dev/sda -m myemail@foo.com -d megaraid,4
Last sector: ##i##+2G ↵
</pre>
Command (m for help): ##i##t ↵
Partition number (1,2, default 2): ##i## ↵
Hex code (type L to list all codes): ##i##82 ↵
</console>


To figure out what configuration to use for your system, use the following command:
'''Create the root partition:'''


<pre>
<console>
# smartctl -d megaraid,X --all /dev/sdY
Command (m for help): ##i##n ↵
</pre>
Partition type (default p): ##i##↵
Partition number (3,4, default 3): ##i##↵
First sector: ##i##↵
Last sector: ##i##↵
</console>


Start using X=0 and Y=a, and keep incrementing X until you discover all physical disks backing sda. Then repeat with sdb, etc. until you discover all physical disks in your system. In typical configurations, you will have <tt>megaraid,0</tt> thru <tt>megaraid,(num_physical_disks-1)</tt>.
'''Verify the partition table:'''


{{fancynote|On Dell R910s with PERC H700, all physical disks are addressable through all /dev/sdY simultaneously, so there is no need to iterate through Y. ie: all of the same physical disks will be shown simultaneously for /dev/sda, /dev/sdb, /dev/sdc etc... so there is no need to repeat the steps for sdY+1 and onwards.}}
<console>
Command (m for help): ##i##p


[[Category:Hardware Compatibility]]
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.
 
{{Note|You're done with partitioning! Now, jump over to [[#Creating filesystems|Creating filesystems]].}}
 
==== New-School (UEFI/GPT) Method ====
 
{{Note|Use this method if you are 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 <tt>gdisk</tt> commands to create a GPT partition table are as follows. Adapt sizes as necessary, although these defaults will work for most users. Start <code>gdisk</code>:
 
<console>
# ##i##gdisk
</console>
 
Within <tt>gdisk</tt>, follow these steps:
 
'''Create a new empty partition table''' (This ''will'' erase all data on the disk when saved):
 
<console>
Command: ##i##o ↵
This option deletes all partitions and creates a new protective MBR.
Proceed? (Y/N): ##i##y ↵
</console>
 
'''Create Partition 1''' (boot):
 
<console>
Command: ##i##n ↵
Partition Number: ##i##1 ↵
First sector: ##i##↵
Last sector: ##i##+500M ↵
Hex Code: ##i##↵
</console>
 
'''Create Partition 2''' (swap):
 
<console>
Command: ##i##n ↵
Partition Number: ##i##2 ↵
First sector: ##i##↵
Last sector: ##i##+4G ↵
Hex Code: ##i##8200 ↵
</console>
 
'''Create Partition 3''' (root):
 
<console>
Command: ##i##n ↵
Partition Number: ##i##3 ↵
First sector: ##i##↵
Last sector: ##i##↵##!i## (for rest of disk)
Hex Code: ##i##↵
</console>
 
Along the way, you can type "<tt>p</tt>" and hit Enter to view your current partition table. If you make a mistake, you can type "<tt>d</tt>" to delete an existing partition that you created. When you are satisfied with your partition setup, type "<tt>w</tt>" to write your configuration to disk:
 
'''Write Partition Table To Disk''':
 
<console>
Command: ##i##w ↵
Do you want to proceed? (Y/N): ##i##Y ↵
</console>
 
The partition table will now be written to disk and <tt>gdisk</tt> will close.
 
Now, your GPT/GUID partitions have been created, and will show up as the following ''block devices'' under Linux:
 
* <tt>/dev/sda1</tt>, which will be used to hold the <tt>/boot</tt> filesystem,
* <tt>/dev/sda2</tt>, which will be used for swap space, and
* <tt>/dev/sda3</tt>, which will hold your root filesystem.
 
==== 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 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 /dev/sda1:
 
<console>
# ##i##mkfs.ext2 /dev/sda1
</console>
 
If you're using new-school GPT partitions for UEFI, you'll want to create a vfat filesystem on /dev/sda1, because this is what UEFI is able to read:
 
<console>
# ##i##mkfs.vfat -F 32 /dev/sda1
</console>
 
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 <code>mkswap</code> command. Then we'll run the <code>swapon</code> 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>
# ##i##mkswap /dev/sda2
# ##i##swapon /dev/sda2
</console>
 
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>
# ##i##mkfs.ext4 /dev/sda3
</console>
 
...and here's how to create an XFS root filesystem, if you choose to use XFS:
 
<console>
# ##i##mkfs.xfs /dev/sda3
</console>
 
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.
 
{{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.
}}
 
==== 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 13:31, January 5, 2015


   Note

This is a template that is used as part of the Installation instructions which covers: процесс разбиения диска и создания файловых систем. Templates are being used to allow multiple variant install guides that use most of the same re-usable parts.


Подготовка жесткого диска

В этой части мы научимся различным способам установки Funtoo Linux -- и загрузки с -- жесткий диск.

Введение

В прежние времена существовал лишь один способ загрузить PC-совместимый компьютер. Все наши дектопы и сервера имели стандартный PC BIOS, все наши харды использовали MBR и были разбиты используя схему разбивки MBR. Вот как это все было и нам это нравилось!

Затем появились EFI и UEFI, встроенные программы нового образца наряду со схемой разбивки GPT, поддерживающая диски размером более 2.2TБ. Неожиданно, нам стали доступны различные способы установки и загрузки Линукс систем . То, что было единым методом, стало чем-то более сложным.

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.

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.
What's the Big Difference between Old School and New School?
Here's the deal. If you go with old-school MBR partitions, your /boot partition will be an ext2 filesystem, and you'll use fdisk to create your MBR partitions. If you go with new-school GPT partitions and UEFI booting, your /boot partition will be a vfat filesystem, because this is what UEFI is able to read, and you will use 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.
Also Note
To install Funtoo Linux to boot via the New School UEFI method, you must boot System Rescue CD using UEFI -- and see an initial black and white screen. Otherwise, UEFI will not be active and you will not be able to set it up!
   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, 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 /dev/sda is the disk that you want to partition:

root # 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


root #         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.

root # 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:

root # 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.

   Note

You're done with partitioning! Now, jump over to Creating filesystems.

New-School (UEFI/GPT) Method

   Note

Use this method if you are 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 gdisk commands to create a GPT partition table are as follows. Adapt sizes as necessary, although these defaults will work for most users. Start gdisk:

root # gdisk

Within gdisk, follow these steps:

Create a new empty partition table (This will erase all data on the disk when saved):

Command: o ↵
This option deletes all partitions and creates a new protective MBR.
Proceed? (Y/N): y ↵

Create Partition 1 (boot):

Command: n ↵
Partition Number: 1 ↵
First sector: 
Last sector: +500M ↵
Hex Code: 

Create Partition 2 (swap):

Command: n ↵
Partition Number: 2 ↵
First sector: 
Last sector: +4G ↵
Hex Code: 8200 ↵

Create Partition 3 (root):

Command: n ↵
Partition Number: 3 ↵
First sector: 
Last sector:  (for rest of disk)
Hex Code: 

Along the way, you can type "p" and hit Enter to view your current partition table. If you make a mistake, you can type "d" to delete an existing partition that you created. When you are satisfied with your partition setup, type "w" to write your configuration to disk:

Write Partition Table To Disk:

Command: w ↵
Do you want to proceed? (Y/N): Y ↵

The partition table will now be written to disk and gdisk will close.

Now, your GPT/GUID partitions have been created, and will show up as the following block devices under Linux:

  • /dev/sda1, which will be used to hold the /boot filesystem,
  • /dev/sda2, which will be used for swap space, and
  • /dev/sda3, which will hold your root filesystem.

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 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 /dev/sda1:

root # mkfs.ext2 /dev/sda1

If you're using new-school GPT partitions for UEFI, you'll want to create a vfat filesystem on /dev/sda1, because this is what UEFI is able to read:

root # 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 mkswap command. Then we'll run the 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:

root # mkswap /dev/sda2
root # 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:

root # mkfs.ext4 /dev/sda3

...and here's how to create an XFS root filesystem, if you choose to use XFS:

root # 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 openvz-rhel6-stable are not compatible with XFS, and you may experience kernel bugs.

Mounting filesystems

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

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

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

root # mkdir /mnt/funtoo/home
root # 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:

root # chmod 1777 /mnt/funtoo/tmp