brintos

brintos / linux-shallow public Read only

0
0
Text · 21.3 KiB · b67772c Raw
545 lines · plain
1.. SPDX-License-Identifier: GPL-2.02 3======================4The SGI XFS Filesystem5======================6 7XFS is a high performance journaling filesystem which originated8on the SGI IRIX platform.  It is completely multi-threaded, can9support large files and large filesystems, extended attributes,10variable block sizes, is extent based, and makes extensive use of11Btrees (directories, extents, free space) to aid both performance12and scalability.13 14Refer to the documentation at https://xfs.wiki.kernel.org/15for further details.  This implementation is on-disk compatible16with the IRIX version of XFS.17 18 19Mount Options20=============21 22When mounting an XFS filesystem, the following options are accepted.23 24  allocsize=size25	Sets the buffered I/O end-of-file preallocation size when26	doing delayed allocation writeout (default size is 64KiB).27	Valid values for this option are page size (typically 4KiB)28	through to 1GiB, inclusive, in power-of-2 increments.29 30	The default behaviour is for dynamic end-of-file31	preallocation size, which uses a set of heuristics to32	optimise the preallocation size based on the current33	allocation patterns within the file and the access patterns34	to the file. Specifying a fixed ``allocsize`` value turns off35	the dynamic behaviour.36 37  attr2 or noattr238	The options enable/disable an "opportunistic" improvement to39	be made in the way inline extended attributes are stored40	on-disk.  When the new form is used for the first time when41	``attr2`` is selected (either when setting or removing extended42	attributes) the on-disk superblock feature bit field will be43	updated to reflect this format being in use.44 45	The default behaviour is determined by the on-disk feature46	bit indicating that ``attr2`` behaviour is active. If either47	mount option is set, then that becomes the new default used48	by the filesystem.49 50	CRC enabled filesystems always use the ``attr2`` format, and so51	will reject the ``noattr2`` mount option if it is set.52 53  discard or nodiscard (default)54	Enable/disable the issuing of commands to let the block55	device reclaim space freed by the filesystem.  This is56	useful for SSD devices, thinly provisioned LUNs and virtual57	machine images, but may have a performance impact.58 59	Note: It is currently recommended that you use the ``fstrim``60	application to ``discard`` unused blocks rather than the ``discard``61	mount option because the performance impact of this option62	is quite severe.63 64  grpid/bsdgroups or nogrpid/sysvgroups (default)65	These options define what group ID a newly created file66	gets.  When ``grpid`` is set, it takes the group ID of the67	directory in which it is created; otherwise it takes the68	``fsgid`` of the current process, unless the directory has the69	``setgid`` bit set, in which case it takes the ``gid`` from the70	parent directory, and also gets the ``setgid`` bit set if it is71	a directory itself.72 73  filestreams74	Make the data allocator use the filestreams allocation mode75	across the entire filesystem rather than just on directories76	configured to use it.77 78  ikeep or noikeep (default)79	When ``ikeep`` is specified, XFS does not delete empty inode80	clusters and keeps them around on disk.  When ``noikeep`` is81	specified, empty inode clusters are returned to the free82	space pool.83 84  inode32 or inode64 (default)85	When ``inode32`` is specified, it indicates that XFS limits86	inode creation to locations which will not result in inode87	numbers with more than 32 bits of significance.88 89	When ``inode64`` is specified, it indicates that XFS is allowed90	to create inodes at any location in the filesystem,91	including those which will result in inode numbers occupying92	more than 32 bits of significance.93 94	``inode32`` is provided for backwards compatibility with older95	systems and applications, since 64 bits inode numbers might96	cause problems for some applications that cannot handle97	large inode numbers.  If applications are in use which do98	not handle inode numbers bigger than 32 bits, the ``inode32``99	option should be specified.100 101  largeio or nolargeio (default)102	If ``nolargeio`` is specified, the optimal I/O reported in103	``st_blksize`` by **stat(2)** will be as small as possible to allow104	user applications to avoid inefficient read/modify/write105	I/O.  This is typically the page size of the machine, as106	this is the granularity of the page cache.107 108	If ``largeio`` is specified, a filesystem that was created with a109	``swidth`` specified will return the ``swidth`` value (in bytes)110	in ``st_blksize``. If the filesystem does not have a ``swidth``111	specified but does specify an ``allocsize`` then ``allocsize``112	(in bytes) will be returned instead. Otherwise the behaviour113	is the same as if ``nolargeio`` was specified.114 115  logbufs=value116	Set the number of in-memory log buffers.  Valid numbers117	range from 2-8 inclusive.118 119	The default value is 8 buffers.120 121	If the memory cost of 8 log buffers is too high on small122	systems, then it may be reduced at some cost to performance123	on metadata intensive workloads. The ``logbsize`` option below124	controls the size of each buffer and so is also relevant to125	this case.126 127  logbsize=value128	Set the size of each in-memory log buffer.  The size may be129	specified in bytes, or in kilobytes with a "k" suffix.130	Valid sizes for version 1 and version 2 logs are 16384 (16k)131	and 32768 (32k).  Valid sizes for version 2 logs also132	include 65536 (64k), 131072 (128k) and 262144 (256k). The133	logbsize must be an integer multiple of the log134	stripe unit configured at **mkfs(8)** time.135 136	The default value for version 1 logs is 32768, while the137	default value for version 2 logs is MAX(32768, log_sunit).138 139  logdev=device and rtdev=device140	Use an external log (metadata journal) and/or real-time device.141	An XFS filesystem has up to three parts: a data section, a log142	section, and a real-time section.  The real-time section is143	optional, and the log section can be separate from the data144	section or contained within it.145 146  noalign147	Data allocations will not be aligned at stripe unit148	boundaries. This is only relevant to filesystems created149	with non-zero data alignment parameters (``sunit``, ``swidth``) by150	**mkfs(8)**.151 152  norecovery153	The filesystem will be mounted without running log recovery.154	If the filesystem was not cleanly unmounted, it is likely to155	be inconsistent when mounted in ``norecovery`` mode.156	Some files or directories may not be accessible because of this.157	Filesystems mounted ``norecovery`` must be mounted read-only or158	the mount will fail.159 160  nouuid161	Don't check for double mounted file systems using the file162	system ``uuid``.  This is useful to mount LVM snapshot volumes,163	and often used in combination with ``norecovery`` for mounting164	read-only snapshots.165 166  noquota167	Forcibly turns off all quota accounting and enforcement168	within the filesystem.169 170  uquota/usrquota/uqnoenforce/quota171	User disk quota accounting enabled, and limits (optionally)172	enforced.  Refer to **xfs_quota(8)** for further details.173 174  gquota/grpquota/gqnoenforce175	Group disk quota accounting enabled and limits (optionally)176	enforced.  Refer to **xfs_quota(8)** for further details.177 178  pquota/prjquota/pqnoenforce179	Project disk quota accounting enabled and limits (optionally)180	enforced.  Refer to **xfs_quota(8)** for further details.181 182  sunit=value and swidth=value183	Used to specify the stripe unit and width for a RAID device184	or a stripe volume.  "value" must be specified in 512-byte185	block units. These options are only relevant to filesystems186	that were created with non-zero data alignment parameters.187 188	The ``sunit`` and ``swidth`` parameters specified must be compatible189	with the existing filesystem alignment characteristics.  In190	general, that means the only valid changes to ``sunit`` are191	increasing it by a power-of-2 multiple. Valid ``swidth`` values192	are any integer multiple of a valid ``sunit`` value.193 194	Typically the only time these mount options are necessary if195	after an underlying RAID device has had its geometry196	modified, such as adding a new disk to a RAID5 lun and197	reshaping it.198 199  swalloc200	Data allocations will be rounded up to stripe width boundaries201	when the current end of file is being extended and the file202	size is larger than the stripe width size.203 204  wsync205	When specified, all filesystem namespace operations are206	executed synchronously. This ensures that when the namespace207	operation (create, unlink, etc) completes, the change to the208	namespace is on stable storage. This is useful in HA setups209	where failover must not result in clients seeing210	inconsistent namespace presentation during or after a211	failover event.212 213Deprecation of V4 Format214========================215 216The V4 filesystem format lacks certain features that are supported by217the V5 format, such as metadata checksumming, strengthened metadata218verification, and the ability to store timestamps past the year 2038.219Because of this, the V4 format is deprecated.  All users should upgrade220by backing up their files, reformatting, and restoring from the backup.221 222Administrators and users can detect a V4 filesystem by running xfs_info223against a filesystem mountpoint and checking for a string containing224"crc=".  If no such string is found, please upgrade xfsprogs to the225latest version and try again.226 227The deprecation will take place in two parts.  Support for mounting V4228filesystems can now be disabled at kernel build time via Kconfig option.229The option will default to yes until September 2025, at which time it230will be changed to default to no.  In September 2030, support will be231removed from the codebase entirely.232 233Note: Distributors may choose to withdraw V4 format support earlier than234the dates listed above.235 236Deprecated Mount Options237========================238 239============================    ================240  Name				Removal Schedule241============================    ================242Mounting with V4 filesystem     September 2030243Mounting ascii-ci filesystem    September 2030244ikeep/noikeep			September 2025245attr2/noattr2			September 2025246============================    ================247 248 249Removed Mount Options250=====================251 252===========================     =======253  Name				Removed254===========================	=======255  delaylog/nodelaylog		v4.0256  ihashsize			v4.0257  irixsgid			v4.0258  osyncisdsync/osyncisosync	v4.0259  barrier			v4.19260  nobarrier			v4.19261===========================     =======262 263sysctls264=======265 266The following sysctls are available for the XFS filesystem:267 268  fs.xfs.stats_clear		(Min: 0  Default: 0  Max: 1)269	Setting this to "1" clears accumulated XFS statistics270	in /proc/fs/xfs/stat.  It then immediately resets to "0".271 272  fs.xfs.xfssyncd_centisecs	(Min: 100  Default: 3000  Max: 720000)273	The interval at which the filesystem flushes metadata274	out to disk and runs internal cache cleanup routines.275 276  fs.xfs.filestream_centisecs	(Min: 1  Default: 3000  Max: 360000)277	The interval at which the filesystem ages filestreams cache278	references and returns timed-out AGs back to the free stream279	pool.280 281  fs.xfs.speculative_prealloc_lifetime282	(Units: seconds   Min: 1  Default: 300  Max: 86400)283	The interval at which the background scanning for inodes284	with unused speculative preallocation runs. The scan285	removes unused preallocation from clean inodes and releases286	the unused space back to the free pool.287 288  fs.xfs.speculative_cow_prealloc_lifetime289	This is an alias for speculative_prealloc_lifetime.290 291  fs.xfs.error_level		(Min: 0  Default: 3  Max: 11)292	A volume knob for error reporting when internal errors occur.293	This will generate detailed messages & backtraces for filesystem294	shutdowns, for example.  Current threshold values are:295 296		XFS_ERRLEVEL_OFF:       0297		XFS_ERRLEVEL_LOW:       1298		XFS_ERRLEVEL_HIGH:      5299 300  fs.xfs.panic_mask		(Min: 0  Default: 0  Max: 511)301	Causes certain error conditions to call BUG(). Value is a bitmask;302	OR together the tags which represent errors which should cause panics:303 304		XFS_NO_PTAG                     0305		XFS_PTAG_IFLUSH                 0x00000001306		XFS_PTAG_LOGRES                 0x00000002307		XFS_PTAG_AILDELETE              0x00000004308		XFS_PTAG_ERROR_REPORT           0x00000008309		XFS_PTAG_SHUTDOWN_CORRUPT       0x00000010310		XFS_PTAG_SHUTDOWN_IOERROR       0x00000020311		XFS_PTAG_SHUTDOWN_LOGERROR      0x00000040312		XFS_PTAG_FSBLOCK_ZERO           0x00000080313		XFS_PTAG_VERIFIER_ERROR         0x00000100314 315	This option is intended for debugging only.316 317  fs.xfs.irix_symlink_mode	(Min: 0  Default: 0  Max: 1)318	Controls whether symlinks are created with mode 0777 (default)319	or whether their mode is affected by the umask (irix mode).320 321  fs.xfs.irix_sgid_inherit	(Min: 0  Default: 0  Max: 1)322	Controls files created in SGID directories.323	If the group ID of the new file does not match the effective group324	ID or one of the supplementary group IDs of the parent dir, the325	ISGID bit is cleared if the irix_sgid_inherit compatibility sysctl326	is set.327 328  fs.xfs.inherit_sync		(Min: 0  Default: 1  Max: 1)329	Setting this to "1" will cause the "sync" flag set330	by the **xfs_io(8)** chattr command on a directory to be331	inherited by files in that directory.332 333  fs.xfs.inherit_nodump		(Min: 0  Default: 1  Max: 1)334	Setting this to "1" will cause the "nodump" flag set335	by the **xfs_io(8)** chattr command on a directory to be336	inherited by files in that directory.337 338  fs.xfs.inherit_noatime	(Min: 0  Default: 1  Max: 1)339	Setting this to "1" will cause the "noatime" flag set340	by the **xfs_io(8)** chattr command on a directory to be341	inherited by files in that directory.342 343  fs.xfs.inherit_nosymlinks	(Min: 0  Default: 1  Max: 1)344	Setting this to "1" will cause the "nosymlinks" flag set345	by the **xfs_io(8)** chattr command on a directory to be346	inherited by files in that directory.347 348  fs.xfs.inherit_nodefrag	(Min: 0  Default: 1  Max: 1)349	Setting this to "1" will cause the "nodefrag" flag set350	by the **xfs_io(8)** chattr command on a directory to be351	inherited by files in that directory.352 353  fs.xfs.rotorstep		(Min: 1  Default: 1  Max: 256)354	In "inode32" allocation mode, this option determines how many355	files the allocator attempts to allocate in the same allocation356	group before moving to the next allocation group.  The intent357	is to control the rate at which the allocator moves between358	allocation groups when allocating extents for new files.359 360Deprecated Sysctls361==================362 363===========================================     ================364  Name                                          Removal Schedule365===========================================     ================366fs.xfs.irix_sgid_inherit                        September 2025367fs.xfs.irix_symlink_mode                        September 2025368fs.xfs.speculative_cow_prealloc_lifetime        September 2025369===========================================     ================370 371 372Removed Sysctls373===============374 375=============================	=======376  Name				Removed377=============================	=======378  fs.xfs.xfsbufd_centisec	v4.0379  fs.xfs.age_buffer_centisecs	v4.0380=============================	=======381 382Error handling383==============384 385XFS can act differently according to the type of error found during its386operation. The implementation introduces the following concepts to the error387handler:388 389 -failure speed:390	Defines how fast XFS should propagate an error upwards when a specific391	error is found during the filesystem operation. It can propagate392	immediately, after a defined number of retries, after a set time period,393	or simply retry forever.394 395 -error classes:396	Specifies the subsystem the error configuration will apply to, such as397	metadata IO or memory allocation. Different subsystems will have398	different error handlers for which behaviour can be configured.399 400 -error handlers:401	Defines the behavior for a specific error.402 403The filesystem behavior during an error can be set via ``sysfs`` files. Each404error handler works independently - the first condition met by an error handler405for a specific class will cause the error to be propagated rather than reset and406retried.407 408The action taken by the filesystem when the error is propagated is context409dependent - it may cause a shut down in the case of an unrecoverable error,410it may be reported back to userspace, or it may even be ignored because411there's nothing useful we can with the error or anyone we can report it to (e.g.412during unmount).413 414The configuration files are organized into the following hierarchy for each415mounted filesystem:416 417  /sys/fs/xfs/<dev>/error/<class>/<error>/418 419Where:420  <dev>421	The short device name of the mounted filesystem. This is the same device422	name that shows up in XFS kernel error messages as "XFS(<dev>): ..."423 424  <class>425	The subsystem the error configuration belongs to. As of 4.9, the defined426	classes are:427 428		- "metadata": applies metadata buffer write IO429 430  <error>431	The individual error handler configurations.432 433 434Each filesystem has "global" error configuration options defined in their top435level directory:436 437  /sys/fs/xfs/<dev>/error/438 439  fail_at_unmount		(Min:  0  Default:  1  Max: 1)440	Defines the filesystem error behavior at unmount time.441 442	If set to a value of 1, XFS will override all other error configurations443	during unmount and replace them with "immediate fail" characteristics.444	i.e. no retries, no retry timeout. This will always allow unmount to445	succeed when there are persistent errors present.446 447	If set to 0, the configured retry behaviour will continue until all448	retries and/or timeouts have been exhausted. This will delay unmount449	completion when there are persistent errors, and it may prevent the450	filesystem from ever unmounting fully in the case of "retry forever"451	handler configurations.452 453	Note: there is no guarantee that fail_at_unmount can be set while an454	unmount is in progress. It is possible that the ``sysfs`` entries are455	removed by the unmounting filesystem before a "retry forever" error456	handler configuration causes unmount to hang, and hence the filesystem457	must be configured appropriately before unmount begins to prevent458	unmount hangs.459 460Each filesystem has specific error class handlers that define the error461propagation behaviour for specific errors. There is also a "default" error462handler defined, which defines the behaviour for all errors that don't have463specific handlers defined. Where multiple retry constraints are configured for464a single error, the first retry configuration that expires will cause the error465to be propagated. The handler configurations are found in the directory:466 467  /sys/fs/xfs/<dev>/error/<class>/<error>/468 469  max_retries			(Min: -1  Default: Varies  Max: INTMAX)470	Defines the allowed number of retries of a specific error before471	the filesystem will propagate the error. The retry count for a given472	error context (e.g. a specific metadata buffer) is reset every time473	there is a successful completion of the operation.474 475	Setting the value to "-1" will cause XFS to retry forever for this476	specific error.477 478	Setting the value to "0" will cause XFS to fail immediately when the479	specific error is reported.480 481	Setting the value to "N" (where 0 < N < Max) will make XFS retry the482	operation "N" times before propagating the error.483 484  retry_timeout_seconds		(Min:  -1  Default:  Varies  Max: 1 day)485	Define the amount of time (in seconds) that the filesystem is486	allowed to retry its operations when the specific error is487	found.488 489	Setting the value to "-1" will allow XFS to retry forever for this490	specific error.491 492	Setting the value to "0" will cause XFS to fail immediately when the493	specific error is reported.494 495	Setting the value to "N" (where 0 < N < Max) will allow XFS to retry the496	operation for up to "N" seconds before propagating the error.497 498**Note:** The default behaviour for a specific error handler is dependent on both499the class and error context. For example, the default values for500"metadata/ENODEV" are "0" rather than "-1" so that this error handler defaults501to "fail immediately" behaviour. This is done because ENODEV is a fatal,502unrecoverable error no matter how many times the metadata IO is retried.503 504Workqueue Concurrency505=====================506 507XFS uses kernel workqueues to parallelize metadata update processes.  This508enables it to take advantage of storage hardware that can service many IO509operations simultaneously.  This interface exposes internal implementation510details of XFS, and as such is explicitly not part of any userspace API/ABI511guarantee the kernel may give userspace.  These are undocumented features of512the generic workqueue implementation XFS uses for concurrency, and they are513provided here purely for diagnostic and tuning purposes and may change at any514time in the future.515 516The control knobs for a filesystem's workqueues are organized by task at hand517and the short name of the data device.  They all can be found in:518 519  /sys/bus/workqueue/devices/${task}!${device}520 521================  ===========522  Task            Description523================  ===========524  xfs_iwalk-$pid  Inode scans of the entire filesystem. Currently limited to525                  mount time quotacheck.526  xfs-gc          Background garbage collection of disk space that have been527                  speculatively allocated beyond EOF or for staging copy on528                  write operations.529================  ===========530 531For example, the knobs for the quotacheck workqueue for /dev/nvme0n1 would be532found in /sys/bus/workqueue/devices/xfs_iwalk-1111!nvme0n1/.533 534The interesting knobs for XFS workqueues are as follows:535 536============     ===========537  Knob           Description538============     ===========539  max_active     Maximum number of background threads that can be started to540                 run the work.541  cpumask        CPUs upon which the threads are allowed to run.542  nice           Relative priority of scheduling the threads.  These are the543                 same nice levels that can be applied to userspace processes.544============     ===========545