此内容没有您所选择的语言版本。

4.3. Creating an ext4 File System


After installation, it is sometimes necessary to create a new ext4 file system. For example, if you add a new disk drive to the system, you may want to partition the drive and use the ext4 file system.
The default options are optimal for most usage scenarios but if you need to set your ext4 file system in a specific way, see manual pages for the mke4fs and mkfs.ext4 commands for available options. Also, you may want to examine and modify the configuration file of mke4fs, /etc/mke4fs.conf, if you plan to create ext4 file systems more often.
The steps for creating an ext4 file system are as follows:
  1. Format the partition with the ext4 file system using the mkfs.ext4 or mke4fs command:
    ~]# mkfs.ext4 block_device
    ~]# mke4fs -t ext4 block_device
    where block_device is a partition which will contain the ext4 filesystem you wish to create.
  2. Label the partition using the e4label command.
    ~]# e4label <block_device> new-label
  3. Create a mount point and mount the new file system to that mount point:
    ~]# mkdir /mount/point
    ~]# mount block_device /mount/point
A valid block device could be one of two types of entries:
  • A mapped device — A logical volume in a volume group, for example, /dev/mapper/VolGroup00-LogVol02.
  • A static device — A traditional storage volume, for example, /dev/hdbX, where hdb is a storage device name and X is the partition number.
For striped block devices (for example RAID5 arrays), the stripe geometry can be specified at the time of file system creation. Using proper stripe geometry greatly enhances performance of an ext4 file system.
When creating file systems on lvm or md volumes, mkfs.ext4 chooses an optimal geometry. This may also be true on some hardware RAIDs which export geometry information to the operating system.
To specify stripe geometry, use the -E option of mkfs.ext4 (that is, extended file system options) with the following sub-options:
stride=value
Specifies the RAID chunk size.
stripe-width=value
Specifies the number of data disks in a RAID device, or the number of stripe units in the stripe.
For both sub-options, value must be specified in file system block units. For example, to create a file system with a 64k stride (that is, 16 x 4096) on a 4k-block file system, use the following command:
~]# mkfs.ext4 -E stride=16,stripe-width=64 block_device
For more information about creating file systems, refer to man mkfs.ext4.
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.