Handbook:Parts/Installation/Disks/zh-cn

块设备
让我们来好好看看Gentoo Linux以及普通Linux中有关磁盘方面的知识，包括Linux文件系统，分区和块设备. 一旦磁盘和文件的来龙去脉都了解，我们将设置分区和文件系统的安装Gentoo Linux.

首先，让我们来看看块设备. 最著名的块设备可能是代表Linux系统第一块磁盘的. SCSI和SATA磁盘全标为；甚至IDE磁盘在新的libata内核框架下也标为. 当使用老设备框架时，第一个IDE磁盘是.

上面的块设备代表的抽象接口的磁盘. 用户程序可以使用这些块设备来与你的磁盘进行交互，而无需担心驱动器到底是IDE，SCSI还是其他什么东西. 该程序可以把磁盘当作一系列连续的，可随机访问的512字节块的存储.

介绍
现在分区已经创建，该在上面设置文件系统了. 下一章节中描述了Linux所支持的众多文件系统. 知道使用哪一个文件系统的读者可以继续阅读为分区应用文件系统. 剩下的人应该学习可用的文件系统……

文件系统
有一些可以使用的文件系统. 有些在架构上稳定——建议在选择为一个重要分区实验性的选择文件系统前继续阅读.


 * 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 Windows systems (note the emphasis on only).

当在一个小的分区（少于8GB）上使用ext2、ext3或ext4，则创建文件系统时必须带适当的选项以保留足够的inode. 应用程序使用“字节每inode”设置来计算一个文件系统应该用多少个inode. 在小分区，建议增加计算出的inode数量.

对于ext2，可以使用下面的命令来完成：

对于ext3或ext4，添加 选项来启用日志：

这一般将是对于给定的文件系统inode数量的四倍，它的“字节每inode”从16kB每个减少到4kB每个. 这个可以在将来通过提供比例进行调整：

为分区应用文件系统
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:

比如，在示例分区结构中，有使用ext4的根分区（），下面的命令将会用到：

现在在新创建的分区（或逻辑卷）上创建文件系统.

激活swap分区
是用来初始化swap分区的命令：

要激活swap分区，使用：

使用上面提到的命令创建和激活swap.

挂载
现在分区都已初始化并有文件系统，接下来该挂载那些分区了. 使用命令，但是不要忘记为每一个创建的分区创建需要的挂载目录. 比如示例中我们挂载根分区：

后面的介绍中将挂载proc文件系统（一个内核的虚拟接口）和其它内核伪文件系统. 不过我们首先安装Gentoo安装文件.