This is Gentoo's testing wiki. It is a non-operational environment and its textual content is outdated.
Please visit our production wiki at https://wiki.gentoo.org
Handbook:X86/Installation/Disks/tr
Blok aygıtlarına giriş
Blok aygıtları
Let's take a good look at disk-oriented aspects of Gentoo Linux and Linux in general, including Linux filesystems, partitions, and block devices. Once the ins and outs of disks and filesystems are understood, partitions and filesystems can be established for the Gentoo Linux installation.
To begin, let's look at block devices. The most famous block device is probably the one that represents the first drive in a Linux system, namely /dev/sda. SCSI and Serial ATA drives are both labeled /dev/sd*; even IDE drives are labeled /dev/sd* with the libata framework in the kernel. When using the old device framework, then the first IDE drive is /dev/hda.
The block devices above represent an abstract interface to the disk. User programs can use these block devices to interact with the disk without worrying about whether the drives are IDE, SCSI, or something else. The program can simply address the storage on the disk as a bunch of contiguous, randomly-accessible 512-byte blocks.
Partition tables
Although it is theoretically possible to use a raw, unpartitioned disk to house a Linux system (when creating a btrfs RAID for example), this is almost never done in practice. Instead, disk block devices are split up into smaller, more manageable block devices. On x86 systems, these are called partitions. There are currently two standard partitioning technologies in use: MBR and GPT.
MBR
The MBR (Master Boot Record) setup uses 32-bit identifiers for the start sector and length of the partitions, and supports three partition types: primary, extended, and logical. Primary partitions have their information stored in the master boot record itself - a very small (usually 512 bytes) location at the very beginning of a disk. Due to this small space, only four primary partitions are supported (for instance, /dev/sda1 to /dev/sda4).
To support more partitions, one of the primary partitions can be marked as an extended partition. This partition can then contain logical partitions (partitions within a partition).
Although still supported by most motherboard manufacturers partition tables are considered legacy. Unless working with hardware that is pre-2010, it best to partition a disk using a GUID Partition Table. Readers who must proceed with MBR should acknowledge the following information:
- Most post-2010 motherboards consider MBR a legacy (supported, but not ideal) boot mode.
- Due to using 32-bit identifiers, master boot record partitioning tables cannot handle disks that are greater than 2 TiBs in size.
- Unless a extended partition is created, MBR supports a maximum of four partitions.
- The MBR setup does not provide any backup-MBR, so if an application or user overwrites the MBR, all partition information is lost.
The Handbook authors suggest using GPT whenever possible for Gentoo installations.
GPT
The GPT (GUID Partition Table) setup uses 64-bit identifiers for the partitions. The location in which it stores the partition information is much bigger than the 512 bytes of an MBR, which means there is practically no limit on the amount of partitions for a GPT disk. Also the size of a partition is bounded by a much greater limit (almost 8 ZiB - yes, zettabytes).
When a system's software interface between the operating system and firmware is UEFI (instead of BIOS), GPT is almost mandatory as compatibility issues will arise with MBR.
GPT also takes advantage of checksumming and redundancy. It carries CRC32 checksums to detect errors in the header and partition tables and has a backup GPT at the end of the disk. This backup table can be used to recover damage of the primary GPT near the beginning of the disk.
GPT or MBR
From the description above, one might think that using GPT should always be the recommended approach, however there are a few caveats.
Using GPT on a BIOS-based computer works, but then one cannot dual-boot with a Microsoft Windows operating system. The reason is that Microsoft Windows will boot in UEFI mode if it detects a GPT partition label.
Some buggy motherboard firmware configured to boot in BIOS/CSM/legacy mode might also have problems with booting from GPT labeled disks. If that is the case, it might be possible to work around the problem by adding the boot/active flag on the protective MBR partition which has to be done through fdisk with the -t dos
option to force it to read the partition table using the MBR format.
In this case, launch fdisk and toggle the flag using the a key. Press 1 to select the first partition, then press the w key to write the changes to the disk and exit the fdisk application:
user $
fdisk -t dos /dev/sda
Welcome to fdisk (util-linux 2.24.1). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): a Partition number (1-4): 1 Command (m for help): w
Using UEFI
When installing Gentoo on a system that uses UEFI to boot the operating system (instead of BIOS), then it is important that an EFI System Partition (ESP) is created. The instructions for parted below contain the necessary pointers to correctly handle this operation.
The ESP must be a FAT variant (sometimes shown as vfat on Linux systems). The official UEFI specification denotes FAT12, 16, or 32 filesystems will be recognized by the UEFI firmware, although FAT32 is recommended for the ESP. Proceed in formatting the ESP as FAT32:
root #
mkfs.fat -F 32 /dev/sda2
If a FAT variant is not used for the ESP, the system's UEFI firmware is not guaranteed to find the bootloader (or Linux kernel) and most likely be unable to boot the system!
Advanced storage
Btrfs RAID
As noted above, btrfs has the ability to create filesystems across multiple devices. Btrfs filesystems generated in this way can act in the following modes: raid0, raid1, raid10, raid5, and raid6. RAID modes 5 and 6 have improved considerably, but are still considered unstable. After a multiple device filesystem has been created, new devices can be added and old devices removed in a few commands. Btrfs takes more involvement than other filesystems making it not as friendly to beginners.
ext4 filesytems can be converted into btrfs filesystems, which may be useful for those who'd like to install Gentoo with a stable, well tested filesystem and gradually increase their knowledge about newer filesystems such as btrfs by experimentation.
LVM
The x86 Installation CDs provide support for Logical Volume Manager (LVM). LVM increases the flexibility offered by the partitioning setup. The installation instructions below will focus on "regular" partitions, but it is good to know LVM is supported if that route is desired. Visit the LVM article for more details. Newcomers beware: although fully supported LVM is outside the scope of this guide.
Default partitioning scheme
Throughout the remainder of the handbook, the following partitioning scheme will be used as a simple example layout:
Partition | Filesystem | Size | Description |
---|---|---|---|
/dev/sda1 | (bootloader) | 2M | BIOS boot partition |
/dev/sda2 | ext2 (or fat32 if UEFI is being used) | 128M | Boot/EFI system partition |
/dev/sda3 | (swap) | 512M or higher | Swap partition |
/dev/sda4 | ext4 | Rest of the disk | Root partition |
If this suffices and the reader going the GPT route they can immediately jump to Default: Using parted to partition the disk. Those who are still interested in MBR (hey - it happens!) and using the example layout can jump to Alternative: Using fdisk to partition the disk.
Both fdisk and parted are partitioning utilities. fdisk is well known, stable, and recommended for the MBR partition layout while parted was one of the first Linux block device management utilities to support GPT partitions. Those who like the user interface of fdisk can use gdisk (GPT fdisk) as an alternative to parted.
Before going to the creation instructions, the first set of sections will describe in more detail how partitioning schemes can be created and mention some common pitfalls.
Designing a partition scheme
How many partitions and how big?
The number of partitions is highly dependent on the environment. For instance, if there are lots of users, then it is advised to have /home/ separate as it increases security and makes backups easier. If Gentoo is being installed to perform as a mail server, then /var/ should be separate as all mails are stored inside /var/. A good choice of filesystem will then maximize the performance. Game servers will have a separate /opt/ as most gaming servers are installed there. The reason is similar for the /home/ directory: security and backups. In most situations, /usr/ is to be kept big: not only will it contain the majority of applications, it typically also hosts the Gentoo ebuild repository (by default located at /usr/portage) which already takes around 650 MiB. This disk space estimate excludes the packages/ and distfiles/ directories that are generally stored within this ebuild repository.
It very much depends on what the administrator wants to achieve. Separate partitions or volumes have the following advantages:
- Choose the best performing filesystem for each partition or volume.
- The entire system cannot run out of free space if one defunct tool is continuously writing files to a partition or volume.
- If necessary, file system checks are reduced in time, as multiple checks can be done in parallel (although this advantage is more with multiple disks than it is with multiple partitions).
- Security can be enhanced by mounting some partitions or volumes read-only,
nosuid
(setuid bits are ignored),noexec
(executable bits are ignored) etc.
However, multiple partitions have disadvantages as well. If not configured properly, the system might have lots of free space on one partition and none on another. Another nuisance is that separate partitions - especially for important mount points like /usr/ or /var/ - often require the administrator to boot with an initramfs to mount the partition before other boot scripts start. This isn't always the case though, so results may vary.
There is also a 15-partition limit for SCSI and SATA unless the disk uses GPT labels.
What about swap space?
There is no perfect value for the swap partition. The purpose of swap space is to provide disk storage to the kernel when internal memory (RAM) is under pressure. A swap space allows for the kernel to move memory pages that are not likely to be accessed soon to disk (swap or page-out), freeing memory. Of course, if that memory is suddenly needed, these pages need to be put back in memory (page-in) which will take a while (as disks are very slow compared to internal memory).
When the system is not going to run memory intensive applications or the system has lots of memory available, then it probably does not need much swap space. However, swap space is also used to store the entire memory in case of hibernation. If the system is going to need hibernation, then a bigger swap space is necessary, often at least the amount of memory installed in the system.
What is the BIOS boot partition?
A BIOS boot partition is a very small (1 to 2 MB) partition in which boot loaders like GRUB2 can put additional data that doesn't fit in the allocated storage (a few hundred bytes in case of MBR) and cannot be placed elsewhere.
Such partitions are not always necessary, but considering the low space consumption and the difficulties we have with documenting the plethora of partitioning differences otherwise, it is recommended to create it in either case.
For completeness, the BIOS boot partition is needed when a GPT partition layout is used with GRUB2 in PC/BIOS mode. It is not required when booting in EFI/UEFI mode.
Default: Using parted to partition the disk
In this chapter, the example partition layout mentioned earlier in the instructions will be used:
Partition | Description |
---|---|
/dev/sda1 | BIOS boot partition |
/dev/sda2 | Boot partition |
/dev/sda3 | Swap partition |
/dev/sda4 | Root partition |
Change the partition layout according to personal preference.
Viewing the current partition layout with parted
The parted application offers a simple interface for partitioning the disks and supports very large partitions (more than 2 TB). Fire up parted against the disk (in our example, we use /dev/sda). It is recommended to ask parted to use optimal partition alignment:
root #
parted -a optimal /dev/sda
GNU Parted 2.3 Using /dev/sda Welcome to GNU Parted! Type 'help' to view a list of commands.
Alignment means that partitions are started on well-known boundaries within the disk, ensuring that operations on the disk from the operating system level (retrieve pages from the disk) use the least amount of internal disk operations. Misaligned partitions might require the disk to fetch two pages instead of one even if the operating system asked for a single page.
To find out about all options supported by parted, type help and press return.
Setting the GPT label
Most disks on the x86 or amd64 architectures are prepared using an msdos label. Using parted, the command to put a GPT label on the disk is mklabel gpt:
Changing the partition type will remove all partitions from the disk. All data on the disk will be lost.
(parted)
mklabel gpt
To have the disk with MBR layout, use mklabel msdos.
Removing all partitions with parted
If this isn't done yet (for instance through the mklabel operation earlier, or because the disk is a freshly formatted one), first remove all existing partitions from the disk. Type print to view the current partitions, and rm <N> where <N>
is the number of the partition to remove.
(parted)
rm 2
Do the same for all other partitions that aren't needed. However, make sure to not make any mistakes here - parted executes the changes immediately (unlike fdisk which stages them, allowing a user to "undo" his changes before saving or exiting fdisk).
Creating the partitions
Now parted will be used to create the partitions with the following settings:
- The partition type to use. This usually is primary. If the msdos partition label is used, keep in mind that there can be no more than 4 primary partitions. If more than 4 partitions are needed, make one of the first four partitions extended and create logical partitions inside it.
- The start location of a partition (which can be expressed in MB, GB, ...)
- The end location of the partition (which can be expressed in MB, GB, ...)
First, tell parted that the size unit we work with is megabytes (actually mebibytes, abbreviated as MiB which is the "standard" notation, but we will use MB in the text throughout as it is much more common):
(parted)
unit mib
Now create a 2 MB partition that will be used by the GRUB2 boot loader later. Use the mkpart command for this, and inform parted to start from 1 MB and end at 3 MB (creating a partition of 2 MB in size).
(parted)
mkpart primary 1 3
(parted)
name 1 grub
(parted)
set 1 bios_grub on
(parted)
print
Model: Virtio Block Device (virtblk) Disk /dev/sda: 20480MiB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name Flags 1 1.00MiB 3.00MiB 2.00MiB grub bios_grub
Do the same for the boot partition (128 MB), swap partition (in the example, 512 MB) and the root partition that spans the remaining disk (for which the end location is marked as -1, meaning the end of the disk minus one MB, which is the farthest a partition can go).
(parted)
mkpart primary 3 131
(parted)
name 2 boot
(parted)
mkpart primary 131 643
(parted)
name 3 swap
(parted)
mkpart primary 643 -1
(parted)
name 4 rootfs
When using the UEFI interface to boot the system (instead of BIOS), mark the boot partition as the EFI System Partition. Parted does this automatically when the boot option is set on the partition:
(parted)
set 2 boot on
The end result looks like so:
(parted)
print
Model: Virtio Block Device (virtblk) Disk /dev/sda: 20480MiB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name Flags 1 1.00MiB 3.00MiB 2.00MiB grub bios_grub 2 3.00MiB 131MiB 128MiB boot boot 3 131MiB 643MiB 512MiB swap 4 643MiB 20479MiB 19836MiB rootfs
On an UEFI installation, the boot and esp flags will show up on the boot partition.
Use the quit command to exit parted.
Alternative: Using fdisk to partition the disk
Although recent fdisk should support GPT, it has still shown to have some issues with it. The instructions given below assume that the partition layout being used is MBR.
The following parts explain how to create the example partition layout using fdisk. The example partition layout was mentioned earlier:
Partition | Description |
---|---|
/dev/sda1 | BIOS boot partition |
/dev/sda2 | Boot partition |
/dev/sda3 | Swap partition |
/dev/sda4 | Root partition |
Change the partition layout according to personal preference.
Viewing the current partition layout
fdisk is a popular and powerful tool to split a disk into partitions. Fire up fdisk against the disk (in our example, we use /dev/sda):
root #
fdisk /dev/sda
To use GPT support, add
-t gpt
. It is recommended to closely investigate the fdisk output in case more recent developments in fdisk change its default behavior of defaulting to MBR. The remainder of the instructions assume an MBR layout.Use the p key to display the disk's current partition configuration:
Command (m for help):
p
Disk /dev/sda: 240 heads, 63 sectors, 2184 cylinders Units = cylinders of 15120 * 512 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 14 105808+ 83 Linux /dev/sda2 15 49 264600 82 Linux swap /dev/sda3 50 70 158760 83 Linux /dev/sda4 71 2184 15981840 5 Extended /dev/sda5 71 209 1050808+ 83 Linux /dev/sda6 210 348 1050808+ 83 Linux /dev/sda7 349 626 2101648+ 83 Linux /dev/sda8 627 904 2101648+ 83 Linux /dev/sda9 905 2184 9676768+ 83 Linux
This particular disk was configured to house seven Linux filesystems (each with a corresponding partition listed as "Linux") as well as a swap partition (listed as "Linux swap").
Removing all partitions with fdisk
First remove all existing partitions from the disk. Type d to delete a partition. For instance, to delete an existing /dev/sda1:
Command (m for help):
d
Partition number (1-4): 1
The partition has now been scheduled for deletion. It will no longer show up when printing the list of partitions (p, but it will not be erased until the changes have been saved. This allows users to abort the operation if a mistake was made - in that case, type q immediately and hit Enter and the partition will not be deleted.
Repeatedly type p to print out a partition listing and then type d and the number of the partition to delete it. Eventually, the partition table will be empty:
Command (m for help):
p
Disk /dev/sda: 30.0 GB, 30005821440 bytes 240 heads, 63 sectors/track, 3876 cylinders Units = cylinders of 15120 * 512 = 7741440 bytes Device Boot Start End Blocks Id System
Now that the in-memory partition table is empty, we're ready to create the partitions.
Creating the BIOS boot partition
First create a very small BIOS boot partition. Type n to create a new partition, then p to select a primary partition, followed by 1 to select the first primary partition. When prompted for the first sector, make sure it starts from 2048 (which is needed for the boot loader) and hit Enter. When prompted for the last sector, type +2M to create a partition 2 Mbyte in size:
The start from sector 2048 is a fail-safe in case the boot loader does not detect this partition as being available for its use.
Command (m for help):
n
Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First sector (64-10486533532, default 64): 2048 Last sector, +sectors +size{M,K,G} (4096-10486533532, default 10486533532): +2M
Mark the partition for UEFI purposes:
Command (m for help):
t
Selected partition 1 Hex code (type L to list codes): 4 Changed system type of partition 1 to 4 (BIOS boot)
Using UEFI with MBR partition layout is discouraged. If an UEFI capable system is used, please use GPT layout.
Creating the boot partition
Now create a small boot partition. Type n to create a new partition, then p to select a primary partition, followed by 2 to select the second primary partition. When prompted for the first sector, accept the default by hitting Enter. When prompted for the last sector, type +128M to create a partition 128 Mbyte in size:
Command (m for help):
n
Command action e extended p primary partition (1-4) p Partition number (1-4): 2 First sector (5198-10486533532, default 5198): (Hit enter) Last sector, +sectors +size{M,K,G} (4096-10486533532, default 10486533532): +128M
Now, when pressing p, the following partition printout is displayed:
Command (m for help):
p
Disk /dev/sda: 30.0 GB, 30005821440 bytes 240 heads, 63 sectors/track, 3876 cylinders Units = cylinders of 15120 * 512 = 7741440 bytes Device Boot Start End Blocks Id System /dev/sda1 1 3 5198+ ef EFI (FAT-12/16/32) /dev/sda2 3 14 105808+ 83 Linux
Type a to toggle the bootable flag on a partition and select 2. After pressing p again, notice that an * is placed in the "Boot" column.
Creating the swap partition
To create the swap partition, type n to create a new partition, then p to tell fdisk to create a primary partition. Then type 3 to create the third primary partition, /dev/sda3. When prompted for the first sector, hit Enter. When prompted for the last sector, type +512M (or any other size needed for the swap space) to create a partition 512MB in size.
After all this is done, type t to set the partition type, 3 to select the partition just created and then type in 82 to set the partition type to "Linux Swap".
Creating the root partition
Finally, to create the root partition, type n to create a new partition, then p to tell fdisk to create a primary partition. Then type 4 to create the fourth primary partition, /dev/sda4. When prompted for the first sector, hit Enter. When prompted for the last sector, hit Enter to create a partition that takes up the rest of the remaining space on the disk. After completing these steps, typing p should display a partition table that looks similar to this:
Command (m for help):
p
Disk /dev/sda: 30.0 GB, 30005821440 bytes 240 heads, 63 sectors/track, 3876 cylinders Units = cylinders of 15120 * 512 = 7741440 bytes Device Boot Start End Blocks Id System /dev/sda1 1 3 5198+ ef EFI (FAT-12/16/32) /dev/sda2 * 3 14 105808+ 83 Linux /dev/sda3 15 81 506520 82 Linux swap /dev/sda4 82 3876 28690200 83 Linux
Saving the partition layout
To save the partition layout and exit fdisk, type w.
Command (m for help):
w
With the partitions created, it is now time to put filesystems on them.
Dosya sistemlerini oluşturmak
Giriş
Disk bölümlerimizi oluşturduğumuza göre, şimdi üzerlerinde bir dosya sistemi yaratma zamanı. Gelecek bölümde Linux'un desteklediği bazı dosya sistemlerini açıklayacağız. Zaten bildiğiniz bir konu ie disk bölümünü biçimlendirme kısmından devam edebilirsiniz.
Dosya sistemleri
Several filesystems are available. Some of them are found stable on the x86 architecture - it is advised to read up on the filesystems and their support state before selecting a more experimental one for important partitions.
- btrfs
- A next generation filesystem that provides many advanced features such as snapshotting, self-healing through checksums, transparent compression, subvolumes and integrated RAID. A few distributions have begun to ship it as an out-of-the-box option, but it is not production ready. Reports of filesystem corruption are common. Its developers urge people to run the latest kernel version for safety because the older ones have known problems. This has been the case for years and it is too early to tell if things have changed. Fixes for corruption issues are rarely backported to older kernels. Proceed with caution when using this filesystem!
- ext2
- This is the tried and true Linux filesystem but doesn't have metadata journaling, which means that routine ext2 filesystem checks at startup time can be quite time-consuming. There is now quite a selection of newer-generation journaled filesystems that can be checked for consistency very quickly and are thus generally preferred over their non-journaled counterparts. Journaled filesystems prevent long delays when the system is booted and the filesystem happens to be in an inconsistent state.
- ext3
- The journaled version of the ext2 filesystem, providing metadata journaling for fast recovery in addition to other enhanced journaling modes like full data and ordered data journaling. It uses an HTree index that enables high performance in almost all situations. In short, ext3 is a very good and reliable filesystem.
- ext4
- Initially created as a fork of ext3, ext4 brings new features, performance improvements, and removal of size limits with moderate changes to the on-disk format. It can span volumes up to 1 EB and with maximum file size of 16TB. Instead of the classic ext2/3 bitmap block allocation ext4 uses extents, which improve large file performance and reduce fragmentation. Ext4 also provides more sophisticated block allocation algorithms (delayed allocation and multiblock allocation) giving the filesystem driver more ways to optimize the layout of data on the disk. Ext4 is the recommended all-purpose all-platform filesystem.
- f2fs
- The Flash-Friendly File System was originally created by Samsung for the use with NAND flash memory. As of Q2, 2016, this filesystem is still considered immature, but it is a decent choice when installing Gentoo to microSD cards, USB drives, or other flash-based storage devices.
- JFS
- IBM's high-performance journaling filesystem. JFS is a light, fast and reliable B+tree-based filesystem with good performance in various conditions.
- ReiserFS
- A B+tree-based journaled filesystem that has good overall performance, especially when dealing with many tiny files at the cost of more CPU cycles. ReiserFS appears to be less maintained than other filesystems.
- XFS
- A filesystem with metadata journaling which comes with a robust feature-set and is optimized for scalability. XFS seems to be less forgiving to various hardware problems.
- vfat
- Also known as FAT32, is supported by Linux but does not support any permission settings. It is mostly used for interoperability with other operating systems (mainly Microsoft Windows) but is also a necessity for some system firmware (like UEFI).
- NTFS
- This "New Technology" filesystem is the flagship filesystem of Microsoft Windows. Similar to vfat above it does not store permission settings or extended attributes necessary for BSD or Linux to function properly, therefore it cannot be used as a root filesystem. It should only be used for interoperability with Microsoft Windows systems (note the emphasis on only).
When using ext2, ext3, or ext4 on a small partition (less than 8GB), then the file system must be created with the proper options to reserve enough inodes. The mke2fs (mkfs.ext2) application uses the "bytes-per-inode" setting to calculate how many inodes a file system should have. On smaller partitions, it is advised to increase the calculated number of inodes.
ext2'de bu işlem şöyle yapılabilir:
root #
mkfs.ext2 -T small /dev/<device>
ext3 ve ext4'de günlük tutmayı açmak için -j
ekleyin:
root #
mkfs.ext2 -j -T small /dev/<device>
Bu sayede inode sayısı her 16kB'dan her 4kB'a inerek dörde katlanacaktır. Oran değiştirilerek bu daha da fazla yapılabilir:
root #
mkfs.ext2 -i <ratio> /dev/<device>
Disk bölümünü biçimlendirme
To create a filesystem on a partition or volume, there are user space utilities available for each possible filesystem. Click the filesystem's name in the table below for additional information on each filesystem:
Filesystem | Creation command | On minimal CD? | Package |
---|---|---|---|
btrfs | mkfs.btrfs | Yes | sys-fs/btrfs-progs |
ext2 | mkfs.ext2 | Yes | sys-fs/e2fsprogs |
ext3 | mkfs.ext3 | Yes | sys-fs/e2fsprogs |
ext4 | mkfs.ext4 | Yes | sys-fs/e2fsprogs |
f2fs | mkfs.f2fs | Yes | sys-fs/f2fs-tools |
jfs | mkfs.jfs | Yes | sys-fs/jfsutils |
reiserfs | mkfs.reiserfs | Yes | sys-fs/reiserfsprogs |
xfs | mkfs.xfs | Yes | sys-fs/xfsprogs |
vfat | mkfs.vfat | Yes | sys-fs/dosfstools |
NTFS | mkfs.ntfs | Yes | sys-fs/ntfs3g |
For instance, to have the boot partition (/dev/sda2) in ext2 and the root partition (/dev/sda4) in ext4 as used in the example partition structure, the following commands would be used:
root #
mkfs.ext2 /dev/sda2
root #
mkfs.ext4 /dev/sda4
Şimdi mantıksal veya fiziksel bölümlerinizi biçimlendirebilirsiniz.
Activating the swap partition
mkswap is the command that is used to initialize swap partitions:
root #
mkswap /dev/sda3
To activate the swap partition, use swapon:
root #
swapon /dev/sda3
Yukardaki adımları kullanarak swap bölümlerini oluşturabilir ve kullanabilirsiniz.
Bağlamak
Now that the partitions are initialized and are housing a filesystem, it is time to mount those partitions. Use the mount command, but don't forget to create the necessary mount directories for every partition created. As an example we mount the root partition:
root #
mount /dev/sda4 /mnt/gentoo
Eğer /tmp/ dizini farklı bir disk bölümündeyse, bağladıktan sonra izinlerini değiştirmeniz gerekmekte:
root #
chmod 1777 /mnt/gentoo/tmp
İleri adımlarda proc (çekirdeğin kullandığı sanal arayüz) ve diğer özel dosya sistemlerini de bağlayacağız. Ancak önce Gentoo kurulum dosyalarını yükleyeceğiz.