Difference between pages "Learning Linux LVM, Part 1" and "Install/ru/Partitioning"

From Funtoo
(Difference between pages)
Jump to navigation Jump to search
 
 
Line 1: Line 1:
{{Article
<noinclude>
|Subtitle=Storage management magic with Logical Volume Management
{{InstallPart|процесс разбиения диска и создания файловых систем}}
|Author=Drobbins
</noinclude>
}}
=== Подготовка жесткого диска ===
== LVM intro ==
 
В этой части  мы научимся различным способам установки Funtoo Linux -- и загрузки с -- жесткого диска.
 
==== Введение ====
 
В прежние времена существовал лишь один способ загрузить PC-совместимый компьютер. Все наши дектопы и сервера имели стандартный PC BIOS, все наши харды использовали MBR и были разбиты используя схему разбивки MBR.  Вот как это все было и нам это нравилось!
 
Затем появились EFI и UEFI,  встроенные программы нового образца наряду со схемой разбивки GPT, поддерживающая диски размером более 2.2TБ. Неожиданно, нам стали доступны различные способы установки и загрузки Линукс систем . То, что было единым методом, стало чем-то более сложным.
 
Воспользуемся моментом и рассмотрим доступные способы конфигурации жесткого диска для загрузки Funtoo Linux. Данное Руководство рекомендует способ "по-старинке" , загрузка BIOS и использование MBR.  Данный способ работает (за исключением редких случаев) и всесторонне поддерживается. И в этом нет ничего плохого. Если Ваш жесткий диск 2TБ или меньшего размера это не является препятствием для использования всего дискового пространства.
 
Но, бывают ситуации когда метод "по-старинке"  не является оптимальным. Если Ваш жесткий диск размером более 2TБ , MBR разбивка не сможет обеспечить доступ ко всему дисковому пространству.  Это одна из причин.  Вторая причина: существуют  "PC" системы, которые более не поддерживают  BIOS загрузку  и  форсируют UEFI загрузку. Из чувства сострадания к тем, кто попал в затруднение перед выбором, это Руководство также описывает установку и загрузку UEFI систем.
 
Мы всё же рекомендуем разбивку "по-старинке". Загрузчик, который мы используем для загрузки Линукс в этом руководстве называется GRUB,  таки образом мы называем метод  как '''BIOS + GRUB (MBR)''' . Это традиционный способ установки на PC-совместимые компьютеры.
 
Если Вам необходимо использование UEFI для загрузки, мы советуем не использовать MBR вообще, ввиду того, что некоторые системы поддерживают MBR,  а некоторые нет. Вместо, мы советуем использование UEFI  для загрузки GRUB, который, затем в свою очередь загрузит Линукс. Мы называем этот  метод как '''UEFI + GRUB (GPT)'''.
 
И да, есть еще несколько способов, некоторые из них задокументированы в [[Boot Methods]] . Обычно мы рекомендуем  '''BIOS + GRUB (GPT)''' метод, но он ограничивается не столь широкой поддержкой со стороны комплектующих.
 
'''Вопрос --  какой из методов использовать?'''  Вот какой.
 
;Принцип 1 - "По-старинке":  Если Вы можете успешно загрузить System Rescue CD и видите синее меню, то Вы используете BIOS,  и скорее всего Вы можете загрузить Funtoo Linux используя BIOS. Итак,  следуйте этому способу и используйте BIOS загрузку,  кроме случаев Вам по-какой либо причине необходим UEFI, например если размер жесткого диска >2.2TБ.  В этом случае следуйте Принцип  2.
 
;Принцип 2 - "Модерн":  Если Вы можете успешно загрузить System Rescue CD и видите черно-белое меню -- поздравления,  Ваша система поддерживает UEFI загрузку. Это значит, что Вы готовы установить Funtoo Linux к загрузке с помощью UEFI.  Ваша система также может поддерживать загрузку BIOS,  но попрбуйте UEFI для начала. Вы можете "покопаться" в настройках BIOS.
 
;Какая разница между "По-старинке" и "Модерн"?:  Если Вы следуете  MBR разбивке, Ваш <code>/boot</code> раздел будет отформатирован файловой системой ext2 , и Вы будете использовать <code>fdisk</code> для создания MBR разделов.  Если Вы следуете "модерн", GPT разделам и UEFI загрузке,  Ваш <code>/boot</code> раздел будет отформатирован  в файловую систему vfat,  поскольку это единственная файловая система поддерживаемая UEFI, и Вы будете использовать <code>gdisk</code> для создания GPT разделов.  И Вы установите GRUB несколько иначе.  Вот к чему сводится различие между методами.
 
;Имейте в виду: Для установки Funtoo Linux используя метод "модерн", Вы должны загрузить System Rescue CD в UEFI режиме -- и увидеть начальное черно-белое меню. В противном случае, UEFI не активно и Вы не сможете продолжить!
 
{{Note|'''Некоторые материнские платы якобы поддерживают UEFI, но на самом деле нет.''' Исследуйте . К примеру,  Award BIOS в моей Gigabyte GA-990FXA-UD7 rev 1.1 имеет возможность включить UEFI загрузку для CD/DVD. '''Этого не достаточно для обеспечения UEFI загрузки для жестких дисков и установки Funtoo Linux.''' UEFI должно поддерживать и сьемные носители (таким образом Вы сможете загрузить System Rescue CD используя  UEFI) и жесткие диски (Вы можете загрузить Funtoo Linux.) Оказывается, что более поздние ревизии этой платы (rev 3.0) имеют новую версию BIOS который полностью поддерживает UEFI.  Это приводит к третьему принципу -- знайте Ваши комплектующие.}}
 
==== Метод (BIOS/MBR) "По-старинке" ====
 
{{Note|Используйте данный метод при загрузке с помощью BIOS,  и если System Rescue CD имеет начальное меню загрузки светло-голубое.  Если Вы собираетесь использовать "модерн", [[#Метод (UEFI/GPT) "Модерн"|кликните здесь в меню UEFI/GPT.]]}}
 
===== Подготовка =====
 
Прежде чем начать , неплохо бы удостовериться, что Вы используете нужный диск для разбивки.  Попробуйте эту комманду и проверьте, что <code>/dev/sda</code> тот самый диск, который Вы желаете разбить:
 
<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>
 
Теперь, рекомендуем стереть  существующие таблицы разделов  MBR или GPT,  которые могут помешать BIOS во время загрузки. Мы используем комманду <code>sgdisk</code>:
{{fancywarning|Это необратимый процесс, который уничтожит все разделы!  Вы предупреждены! Советуем сохранить критические данние перед этим.}}
 
<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>
 
Не стоит беспокоится об этом сообщении, так как комманда успешно выполнена:
 
<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.
 
{{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:


In this series, I'm going to show you how to install and use the new Logical Volume Management support built-in to the Linux kernel. If you've never used a form of LVM before, you're in for a treat; it's a wonderful technology. Before we actually get LVM up and running, I'm going to explain exactly what it is and how it works. Then, we'll be ready to test out LVM and get the most out of it.
'''Create a new empty partition table''' (This ''will'' erase all data on the disk when saved):


If you're like me, then your experience with UNIX and Linux began on a PC platform, rather than on large, commercial UNIX servers and workstations. On the basic PC, we've always had to deal with partitioning our hard drives. PC people are generally well-acquainted with tools such as fdisk, which are used to create and delete primary and extended partitions on hard disks. Hard disk partitioning is an annoying but accepted part of the process of getting an operating system up and running.
<console>
Command: ##i##o ↵
This option deletes all partitions and creates a new protective MBR.
Proceed? (Y/N): ##i##y ↵
</console>


Hard drive partitioning can be annoying because to do a good job you really need to accurately estimate how much space you'll need for each partition. If you make a poor estimation, your Linux system could possibly be crippled -- to fix the problem, it's possible that you might even need to perform a full system backup, wipe your hard drives clean, and then restore all your data to a new (and presumably better) partition layout. Ick! These are exactly the kinds of situations that sysadmins try their best to avoid in the first place.
'''Create Partition 1''' (boot):


While partitions were once static storage regions, thankfully, we now have a proliferation of PC repartitioning tools (PowerQuest's Partition Magic product is one of the most popular). These tools allow you to boot your system with a special disk and dynamically resize your partitions and filesystems. Once you reboot, you have newly resized partitions, hopefully getting you out of your storage crunch. These partition resizing tools are great and solve the problem storage management for some. But are they perfect? Not exactly.
<console>
Command: ##i##n ↵
Partition Number: ##i##1 ↵
First sector: ##i##↵
Last sector: ##i##+500M ↵
Hex Code: ##i##↵
</console>


Tools like Partition Magic are great for workstations, but aren't really adequate for servers. First of all, they require you to reboot your system. This is something most sysadmins desperately try to avoid doing. What if you simply can't reboot your machine every time your storage needs change, such as if your storage needs change dramatically on a weekly basis? What happens if you need to expand a filesystem so that it spans more than one hard drive, or what do you do if you need to dynamically expand or shrink a volume's storage capacity while allowing Apache to continue to serve Web pages? In a highly available, dynamic environment, a basic partition resizer just won't work. For these and other situations, Logical Volume Management is an excellent (if not perfect) solution.
'''Create Partition 2''' (swap):


== Enter LVM ==
<console>
Command: ##i##n ↵
Partition Number: ##i##2 ↵
First sector: ##i##↵
Last sector: ##i##+4G ↵
Hex Code: ##i##8200 ↵
</console>


Now, let's take a look at how LVM solves these problems. To create an LVM logical volume, we follow a three-step process. First, we need to select the physical storage resources that are going to be used for LVM. Typically, these are standard partitions but can also be Linux software RAID volumes that we've created. In LVM terminology, these storage resources are called "physical volumes". Our first step in setting up LVM involves properly initializing these partitions so that they can be recognized by the LVM system. This involves setting the correct partition type if we're adding a physical partition, and running the pvcreate command.
'''Create Partition 3''' (root):


Once we have one or more physical volumes initialized for use by LVM, we can move on to step two -- creating a volume group. You can think of a volume group as a pool of storage that consists of one or more physical volumes. While LVM is running, we can add physical volumes to the volume group or even remove them. However, we can't mount or create filesystems on a volume group directly. Instead, we can tell LVM to create one or more "logical volumes" using our volume group storage pool:
<console>
Command: ##i##n ↵
Partition Number: ##i##3 ↵
First sector: ##i##↵
Last sector: ##i##↵##!i## (for rest of disk)
Hex Code: ##i##↵
</console>


[[File:l-lvm-1.gif|frame|A volume group is created out of physical volumes]]
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:


Creating an LVM logical volume is really easy, and once it's created we can go ahead and put a filesystem on it, mount it, and start using the volume to store our files. To create a logical volume, we use the lvcreate command, specifying the name of our new volume, the size we'd like the volume to be, and the volume group that we'd like this particluar logical volume to be part of. The LVM system will then allocate storage from the volume group we specify and create our new volume, which is now ready for use. Once created, we can put an ext2 or ReiserFS filesystem on it, mount it, and use it as we like.
'''Write Partition Table To Disk''':


[[File:l-lvm-2.gif|frame|Creating two logical volumes from our existing volume group]]
<console>
Command: ##i##w ↵
Do you want to proceed? (Y/N): ##i##Y ↵
</console>


== Extents ==
The partition table will now be written to disk and <tt>gdisk</tt> will close.


Behind the scenes, the LVM system allocates storage in equal-sized "chunks", called extents. We can specify the particular extent size to use at volume group creation time. The size of an extent defaults to 4Mb, which is perfect for most uses. One of the beauties of LVM is that the physical storage locations of the extents used for one of our logical volumes (in other words, what disk they're stored on) can be dynamically changed while our logical volume is mounted and in use! The LVM system ensures that our logical volumes continue to operate perfectly while allowing the administrator to physically change where everything is stored.
Now, your GPT/GUID partitions have been created, and will show up as the following ''block devices'' under Linux:


Of course, since everything is created out of equally-sized extents, it's really easy to allocate some additional extents for an already-existing logical volume -- in other words, dynamically "grow" the volume:
* <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.


[[File:l-lvm-3.gif|frame|Adding additional extents from our volume group, expanding the size of our logical volume.]]
==== Creating filesystems ====


Once the logical volume has been expanded, you can then expand your ext2 or ReiserFS filesystem to take advantage of this new space. If you use a program such as resize_reiserfs, this filesystem expansion can also happen while the volume is mounted and being used! Truly amazing -- with LVM and online filesystem expansion utilties, it's no longer necessary to reboot your system or even drop to runlevel 1 to change your storage configuration.
{{Note|This section covers both BIOS ''and'' UEFI installs. Don't skip it!}}


The only time you need to shut down your system is when you need to add new physical disks. Once new disks have been added, you then can add these new physical volumes to your volume group(s) to create a fresh supply of extents.
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.


== Setting up LVM ==
Let's keep this simple. Are you using old-school MBR partitions? If so, let's create an ext2 filesystem on /dev/sda1:


OK, let's get LVM installed. LVM consists of two parts: a kernel part and a suite of user-space tools. You may already have LVM support available on your system, and if not, it's a simple matter to install the appropriate tools using your distribution's package manager. On Gentoo or Funtoo Linux, this is done as follows:
<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>
<console>
# ##i##emerge sys-fs/lvm2
# ##i##mkfs.ext4 /dev/sda3
</console>
</console>


If you compiled your kernel manually, you'll want to reconfigure and compile your kernel so that LVM support is enabled.
...and here's how to create an XFS root filesystem, if you choose to use XFS:


<console>
<console>
# ##i##cd /usr/src/linux
# ##i##mkfs.xfs /dev/sda3
# ##i##make menuconfig
</console>
</console>


You'll find the LVM options under the "Multiple devices driver support (RAID and LVM)" section, under "Device Drivers":
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.


{{kernelop|title=Device Drivers,Multiple devices driver support (RAID and LVM)|desc=
{{fancywarning|1=
--- Multiple devices driver support (RAID and LVM)                   
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.
{M}  RAID support                                                   
<M>     Linear (append) mode                                         
<M>    RAID-0 (striping) mode                                       
-M-    RAID-1 (mirroring) mode                                       
-M-    RAID-10 (mirrored striping) mode                             
-M-    RAID-4/RAID-5/RAID-6 mode                                     
<M>    Multipath I/O support                                         
<M>     Faulty test module for MD                                     
<M>  Block device as cache                                           
[ ]    Bcache debugging                                             
[ ]    Debug closures                                               
<M>  Device mapper support                                           
[ ]    Device mapper debugging support                               
[ ]    Keep stack trace of persistent data block lock holders       
<M>    Crypt target support                                         
<M>    Snapshot target                                               
<M>    Thin provisioning target                                     
<M>    Cache target (EXPERIMENTAL)                                   
<M>      MQ Cache Policy (EXPERIMENTAL)                             
<M>      Cleaner Cache Policy (EXPERIMENTAL)                         
<M>    Era target (EXPERIMENTAL)                                     
<M>    Mirror target                                                 
<M>      Mirror userspace logging                                   
<M>    RAID 1/4/5/6/10 target                                       
<M>    Zero target                                                   
<M>    Multipath target                                             
<M>      I/O Path Selector based on the number of in-flight I/Os     
<M>      I/O Path Selector based on the service time                 
<M>    I/O delaying target                                           
[*]    DM uevents                                                   
<M>    Flakey target                                                 
<M>    Verity target support                                         
<M>    Switch target support (EXPERIMENTAL)                         
}}
}}


I recommend enabling all features. Also ensure that LVM is enabled for your initramfs. Remember that if you are putting any main filesystems on LVM, you will need LVM compiled into your kernel, rather than a module, or you'll need an LVM-aware initramfs.
==== Mounting filesystems ====


Also be sure to enable any necessary startup scripts to initialize LVM. On many distributions, including Funtoo Linux, this is done for you, provided that sufficient kernel support is available. The basic commands that these scripts will run are the following, at boot:
Mount the newly-created filesystems as follows, creating <code>/mnt/funtoo</code> as the installation mount point:


<console>
<console>
/sbin/vgscan
# ##i##mkdir /mnt/funtoo
/sbin/vgchange -a y
# ##i##mount /dev/sda3 /mnt/funtoo
# ##i##mkdir /mnt/funtoo/boot
# ##i##mount /dev/sda1 /mnt/funtoo/boot
</console>
</console>


These lines will scan for all available volume groups and activate them. At shutdown, something like this will run:
Optionally, if you have a separate filesystem for <code>/home</code> or anything else:


<console>
<console>
/sbin/vgchange -a n
# ##i##mkdir /mnt/funtoo/home
# ##i##mount /dev/sda4 /mnt/funtoo/home
</console>
</console>


While this stuff is handled for you automatically, if you ever boot from a rescue CD or USB stick, you may need to type {{c|vgscan}} and {{c|vgchange -a y}} as root before your logical volumes are available for use.
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:


That's it for this article. Next article, I'll show you how to create your own logical volumes and unleash the power of LVM. I'll see you then!
<console>
{{ArticleFooter}}
# ##i##chmod 1777 /mnt/funtoo/tmp
</console>

Revision as of 08:16, January 8, 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Б. Неожиданно, нам стали доступны различные способы установки и загрузки Линукс систем . То, что было единым методом, стало чем-то более сложным.

Воспользуемся моментом и рассмотрим доступные способы конфигурации жесткого диска для загрузки Funtoo Linux. Данное Руководство рекомендует способ "по-старинке" , загрузка BIOS и использование MBR. Данный способ работает (за исключением редких случаев) и всесторонне поддерживается. И в этом нет ничего плохого. Если Ваш жесткий диск 2TБ или меньшего размера это не является препятствием для использования всего дискового пространства.

Но, бывают ситуации когда метод "по-старинке" не является оптимальным. Если Ваш жесткий диск размером более 2TБ , MBR разбивка не сможет обеспечить доступ ко всему дисковому пространству. Это одна из причин. Вторая причина: существуют "PC" системы, которые более не поддерживают BIOS загрузку и форсируют UEFI загрузку. Из чувства сострадания к тем, кто попал в затруднение перед выбором, это Руководство также описывает установку и загрузку UEFI систем.

Мы всё же рекомендуем разбивку "по-старинке". Загрузчик, который мы используем для загрузки Линукс в этом руководстве называется GRUB, таки образом мы называем метод как BIOS + GRUB (MBR) . Это традиционный способ установки на PC-совместимые компьютеры.

Если Вам необходимо использование UEFI для загрузки, мы советуем не использовать MBR вообще, ввиду того, что некоторые системы поддерживают MBR, а некоторые нет. Вместо, мы советуем использование UEFI для загрузки GRUB, который, затем в свою очередь загрузит Линукс. Мы называем этот метод как UEFI + GRUB (GPT).

И да, есть еще несколько способов, некоторые из них задокументированы в Boot Methods . Обычно мы рекомендуем BIOS + GRUB (GPT) метод, но он ограничивается не столь широкой поддержкой со стороны комплектующих.

Вопрос -- какой из методов использовать? Вот какой.

Принцип 1 - "По-старинке"
Если Вы можете успешно загрузить System Rescue CD и видите синее меню, то Вы используете BIOS, и скорее всего Вы можете загрузить Funtoo Linux используя BIOS. Итак, следуйте этому способу и используйте BIOS загрузку, кроме случаев Вам по-какой либо причине необходим UEFI, например если размер жесткого диска >2.2TБ. В этом случае следуйте Принцип 2.
Принцип 2 - "Модерн"
Если Вы можете успешно загрузить System Rescue CD и видите черно-белое меню -- поздравления, Ваша система поддерживает UEFI загрузку. Это значит, что Вы готовы установить Funtoo Linux к загрузке с помощью UEFI. Ваша система также может поддерживать загрузку BIOS, но попрбуйте UEFI для начала. Вы можете "покопаться" в настройках BIOS.
Какая разница между "По-старинке" и "Модерн"?
Если Вы следуете MBR разбивке, Ваш /boot раздел будет отформатирован файловой системой ext2 , и Вы будете использовать fdisk для создания MBR разделов. Если Вы следуете "модерн", GPT разделам и UEFI загрузке, Ваш /boot раздел будет отформатирован в файловую систему vfat, поскольку это единственная файловая система поддерживаемая UEFI, и Вы будете использовать gdisk для создания GPT разделов. И Вы установите GRUB несколько иначе. Вот к чему сводится различие между методами.
Имейте в виду
Для установки Funtoo Linux используя метод "модерн", Вы должны загрузить System Rescue CD в UEFI режиме -- и увидеть начальное черно-белое меню. В противном случае, UEFI не активно и Вы не сможете продолжить!
   Note

Некоторые материнские платы якобы поддерживают UEFI, но на самом деле нет. Исследуйте . К примеру, Award BIOS в моей Gigabyte GA-990FXA-UD7 rev 1.1 имеет возможность включить UEFI загрузку для CD/DVD. Этого не достаточно для обеспечения UEFI загрузки для жестких дисков и установки Funtoo Linux. UEFI должно поддерживать и сьемные носители (таким образом Вы сможете загрузить System Rescue CD используя UEFI) и жесткие диски (Вы можете загрузить Funtoo Linux.) Оказывается, что более поздние ревизии этой платы (rev 3.0) имеют новую версию BIOS который полностью поддерживает UEFI. Это приводит к третьему принципу -- знайте Ваши комплектующие.

Метод (BIOS/MBR) "По-старинке"

   Note

Используйте данный метод при загрузке с помощью BIOS, и если System Rescue CD имеет начальное меню загрузки светло-голубое. Если Вы собираетесь использовать "модерн", кликните здесь в меню UEFI/GPT.

Подготовка

Прежде чем начать , неплохо бы удостовериться, что Вы используете нужный диск для разбивки. Попробуйте эту комманду и проверьте, что /dev/sda тот самый диск, который Вы желаете разбить:

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

Теперь, рекомендуем стереть существующие таблицы разделов MBR или GPT, которые могут помешать BIOS во время загрузки. Мы используем комманду sgdisk:

   Warning

Это необратимый процесс, который уничтожит все разделы! Вы предупреждены! Советуем сохранить критические данние перед этим.

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.

Не стоит беспокоится об этом сообщении, так как комманда успешно выполнена:

***************************************************************
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