XFS

From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page XFS and the translation is 54% complete.
Outdated translations are marked like this.
Other languages:

XFS 文件系统是一个高性能日志文件系统。它兼容ACL (POSIX),可与Linux一起使用。

安装

内核

内核 启用 XFS 支持 (CONFIG_XFS_FS:)
File systems  --->
   <*> XFS filesystem support

可选:

内核 启用可选的 XFS 特性
File systems  --->
   [*]   XFS Quota support
   [*]   XFS POSIX ACL support
   [*]   XFS Realtime subvolume support
   [ ]   XFS Verbose Warnings
   [ ]   XFS Debugging support

Emerge

XFS用户空间实用程序 需要 sys-fs/xfsprogs 软件包:

root #emerge --ask sys-fs/xfsprogs

使用

使用 mount 命令安装 XFS 文件系统。

Make an XFS filesystem with mkfs.xfs from xfsprogs:

root #mkfs.xfs -L 'label'

The label is optional. Further tuning on creation might be interesting for use as a RAID, multi-terabyte drives, and doing the journaling for an HDD on a separate SSD.

XFS supports SSD discards in fstab.

支持 2038 年时间戳(bigtime)

The bigtime code support was enabled by default in xfsprogs 5.15, so manual setting is not required in newer versions.

Beginning with kernel 5.10, XFS gained bigtime support to extend the maximum recorded date stamps from 2038 to 2486 for the V5 on-disk format.[1]

Initially, this was marked as experimental until kernel 5.15 removed that verbiage after a year of testing.

bigtime option can be enabled at creation time or upgraded after the fact. Once enabled and written to, it should not be removed.

To enable at format time, add the -m bigtime=1 option to mkfs.xfs

To check the status:

root #xfs_info / |grep bigtime
         =                       reflink=1    bigtime=1 inobtcount=0

To upgrade to bigtime, first cleanly unmount the file system. The upgrade will refuse to run if the unmount was not completely clean.

然后运行:

root #xfs_admin -O bigtime=1 /dev/sda1

使用设备路径替换 /dev/sda1

附注
XFS on the root mount will require an initramfs or other live environment with the necessary tools to perform an upgrade to the metadata.

Using Dracut initramfs to perform the upgrade

First, Dracut needs additional files included in the initramfs in order to perform the upgrade. This can be accomplished with either the --install option or inside a configuration file using the install_items option.

root #dracut --install "/usr/sbin/xfs_admin /usr/bin/expr" ...

Then, the kernel command line option can be modified to include rd.break=pre-mount to stop the initramfs just before it would mount the root filesystem. Ensure this is done temporarily and removed on subsequent reboots after upgrade.

移除

To schedule removal at the next run:

root #emerge --ask --depclean --verbose sys-fs/xfsprogs

另请参阅

  • FAT — 最初创建为了在MS-DOS(和之后的NT 内核的微软Windows)使用
  • Ext4 — 一个开源的磁盘文件系统并且是扩展系列文件系统的最新版本。
  • Btrfs — 一个写入时复制(CoW) 的 Linux 文件系统 ,旨在实现高级功能的同时专注于容错、修复和易于管理。

参考