Handbook:Parts/Installation/Disks/zh-cn

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

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. SCSI and Serial ATA drives are both labeled ; even IDE drives are labeled with the new libata framework in the kernel. When using the old device framework, then the first IDE drive is.

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

介绍
Now that the partitions are created, it is time to place a filesystem on them. In the next section the various file systems that Linux supports are described. Readers that already know which filesystem to use can continue with Applying a filesystem to a partition. The others should read on to learn about the available filesystems...

文件系统
Several filesystems are available. Some of them are found stable on the architecture - it is advised to read up on the filesystems and their support state before selecting a more experimental one for important partitions.


 * btrfs
 * 是下一代文件系统，提供了许多高级功能，如快照，通过校验和自我修复、 透明压缩、 子卷和集成 RAID. 几个发行版已经开始将它作为一个默认的选项,但它还未为生产工作做好准备. 文件系统报告崩溃是常见的. 其开发人员敦促人们运行最新的内核版本来解决安全问题,以及因老问题. 这种情况已经很多年了,现在还为时过早,如果事情发生了变化. 解决错误问题，很少往旧内核注入补丁. 请谨慎使用这个文件系统!


 * ext2
 * 是经考验证明可靠的Linux文件系统，但是没有元数据日志，这意味这在启动系统时的ext2文件系统的日常检查相当耗时. 现在相当一部分的新一代的日志文件系统都可以非常迅速检查一致性，因此比那些非日志文件系统更受欢迎. 当你启动系统碰巧遇到文件系统状态不一致时，日志文件系统不会在那里耽搁很长时间.


 * ext3
 * 是ext2文件系统的带日志版本，提供了元数据日志模式以快速恢复数据. 此外还提供了其他增强的日志模式，如完整数据日志模式和有序数据日志模式. 它使用了HTree索引，在几乎所有的情况下都能保持高性能. 简而言之，ext3是非常好及可靠的文件系统.


 * ext4
 * 最初创建为ext3的一个分支，EXT4带来了新的功能，性能改进和去除中度更改磁盘格式大小限制. 它可以跨越体积高达1的EB并用16 TB最大文件大小. 取而代之的是经典的ext2/3位块分配的ext4的使用范围，这对提高大文件的性能，并减少碎片. 的Ext4还提供了更为复杂的块分配算法（延迟分配和多嵌段分配）给文件系统驱动更多的方式来优化数据的布局在磁盘上. EXT4是推荐的通用所有平台的文件系统.


 * JFS
 * 是IBM的高性能日志文件系统. JFS是一个轻量级的、快速的和稳定的基于B+树的文件系统，在很多情况下都有很好的表现.


 * ReiserFS
 * 是基于B+树的文件系统，它有着非常全面的性能，特别时在处理很多小文件的时候，虽然会占用多一点CPU. ReiserFS相比其他文件系统显得受维护的不够.


 * XFS
 * 是一种带元数据日志的文件系统，它有一个健壮的特性集，并且对可伸缩性进行了优化. XFS似乎对各种各样的硬件问题显得不够宽容.


 * vfat
 * 也称为FAT32，被支持Linux，但不支持任何权限设置. 它主要用于互操作性与其他操作系统（主要是微软的Windows），但也是很有必要的一些系统固件（如UEFI）的支持.

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

On ext2, this can be done using the following command:

On ext3 and ext4, add the  option to enable journaling:

This will generally quadruple the number of inodes for a given file system as its "bytes-per-inode" reduces from one every 16kB to one every 4kB. This can be tuned even further by providing the ratio:

Applying a filesystem to a partition
To create a filesystem on a partition or volume, there are tools available for each possible filesystem:

For instance, to have the root partition  in ext4 as used in the example partition structure, the following commands would be used:

Now create the filesystems on the newly created partitions (or logical volumes).

Activating the swap partition
is the command that is used to initialize swap partitions:

To activate the swap partition, use :

Create and activate the swap with the commands mentioned above.

Mounting
Now that the partitions are initialized and are housing a filesystem, it is time to mount those partitions. Use the command, but don't forget to create the necessary mount directories for every partition created. As an example we mount the root partition:

Later in the instructions the proc filesystem (a virtual interface with the kernel) as well as other kernel psuedo-filesystems will be mounted. But first we install the Gentoo installation files.