18fae3551SRodney W. Grimes.\" Copyright (c) 1983, 1991, 1993 28fae3551SRodney W. Grimes.\" The Regents of the University of California. All rights reserved. 38fae3551SRodney W. Grimes.\" 48fae3551SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without 58fae3551SRodney W. Grimes.\" modification, are permitted provided that the following conditions 68fae3551SRodney W. Grimes.\" are met: 78fae3551SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright 88fae3551SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer. 98fae3551SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright 108fae3551SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer in the 118fae3551SRodney W. Grimes.\" documentation and/or other materials provided with the distribution. 12fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors 138fae3551SRodney W. Grimes.\" may be used to endorse or promote products derived from this software 148fae3551SRodney W. Grimes.\" without specific prior written permission. 158fae3551SRodney W. Grimes.\" 168fae3551SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 178fae3551SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 188fae3551SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 198fae3551SRodney W. Grimes.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 208fae3551SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 218fae3551SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 228fae3551SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 238fae3551SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 248fae3551SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 258fae3551SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 268fae3551SRodney W. Grimes.\" SUCH DAMAGE. 278fae3551SRodney W. Grimes.\" 28115459beSGordon Bergling.Dd November 17, 2023 298fae3551SRodney W. Grimes.Dt TUNEFS 8 309fe48c6eSRuslan Ermilov.Os 318fae3551SRodney W. Grimes.Sh NAME 328fae3551SRodney W. Grimes.Nm tunefs 33275e1cf7SGavin Atkinson.Nd tune up an existing UFS file system 348fae3551SRodney W. Grimes.Sh SYNOPSIS 357c7fb079SRuslan Ermilov.Nm 3616a7269eSJoerg Wunsch.Op Fl A 37a2325efeSRobert Watson.Op Fl a Cm enable | disable 388fae3551SRodney W. Grimes.Op Fl e Ar maxbpg 39044479f5SNik Clayton.Op Fl f Ar avgfilesize 40113db2ddSJeff Roberson.Op Fl j Cm enable | disable 41868c68edSPawel Jakub Dawidek.Op Fl J Cm enable | disable 42baa12a84SKirk McKusick.Op Fl k Ar held-for-metadata-blocks 431f6a4631SRuslan Ermilov.Op Fl L Ar volname 44a2325efeSRobert Watson.Op Fl l Cm enable | disable 458fae3551SRodney W. Grimes.Op Fl m Ar minfree 469340fc72SEdward Tomasz Napierala.Op Fl N Cm enable | disable 473c5bd3e3SRuslan Ermilov.Op Fl n Cm enable | disable 483c5bd3e3SRuslan Ermilov.Op Fl o Cm space | time 4990b2fe74SDag-Erling Smørgrav.Op Fl p 50044479f5SNik Clayton.Op Fl s Ar avgfpdir 51113db2ddSJeff Roberson.Op Fl S Ar size 52a738d4cfSKonstantin Belousov.Op Fl t Cm enable | disable 533c5bd3e3SRuslan Ermilov.Ar special | filesystem 548fae3551SRodney W. Grimes.Sh DESCRIPTION 55629e80efSPhilippe CharnierThe 56629e80efSPhilippe Charnier.Nm 57275e1cf7SGavin Atkinsonutility is designed to change the dynamic parameters of a UFS file system 588fae3551SRodney W. Grimeswhich affect the layout policies. 591c85e6a3SKirk McKusickThe 601c85e6a3SKirk McKusick.Nm 613c5bd3e3SRuslan Ermilovutility cannot be run on an active file system. 621c85e6a3SKirk McKusickTo change an active file system, 633c5bd3e3SRuslan Ermilovit must be downgraded to read-only or unmounted. 641c85e6a3SKirk McKusick.Pp 658fae3551SRodney W. GrimesThe parameters which are to be changed are indicated by the flags 668fae3551SRodney W. Grimesgiven below: 678679b1b4SPhilippe Charnier.Bl -tag -width indent 6816a7269eSJoerg Wunsch.It Fl A 693c5bd3e3SRuslan ErmilovThe file system has several backups of the super-block. 703c5bd3e3SRuslan ErmilovSpecifying 7116a7269eSJoerg Wunschthis option will cause all backups to be modified as well as the 723c5bd3e3SRuslan Ermilovprimary super-block. 733c5bd3e3SRuslan ErmilovThis is potentially dangerous - use with caution. 74a2325efeSRobert Watson.It Fl a Cm enable | disable 759340fc72SEdward Tomasz NapieralaTurn on/off the administrative POSIX.1e ACL enable flag. 768fae3551SRodney W. Grimes.It Fl e Ar maxbpg 778679b1b4SPhilippe CharnierIndicate the maximum number of blocks any single file can 788fae3551SRodney W. Grimesallocate out of a cylinder group before it is forced to begin 798fae3551SRodney W. Grimesallocating blocks from another cylinder group. 808fae3551SRodney W. GrimesTypically this value is set to about one quarter of the total blocks 818fae3551SRodney W. Grimesin a cylinder group. 828fae3551SRodney W. GrimesThe intent is to prevent any single file from using up all the 838fae3551SRodney W. Grimesblocks in a single cylinder group, 848fae3551SRodney W. Grimesthus degrading access times for all files subsequently allocated 858fae3551SRodney W. Grimesin that cylinder group. 868fae3551SRodney W. GrimesThe effect of this limit is to cause big files to do long seeks 878fae3551SRodney W. Grimesmore frequently than if they were allowed to allocate all the blocks 888fae3551SRodney W. Grimesin a cylinder group before seeking elsewhere. 898fae3551SRodney W. GrimesFor file systems with exclusively large files, 908fae3551SRodney W. Grimesthis parameter should be set higher. 913c5bd3e3SRuslan Ermilov.It Fl f Ar avgfilesize 92044479f5SNik ClaytonSpecify the expected average file size. 93113db2ddSJeff Roberson.It Fl j Cm enable | disable 94113db2ddSJeff RobersonTurn on/off soft updates journaling. 9582493ff7SKirk McKusick.Pp 9682493ff7SKirk McKusickEnabling journaling reduces the time spent by 9782493ff7SKirk McKusick.Xr fsck_ffs 8 9882493ff7SKirk McKusickcleaning up a filesystem after a crash to a few seconds from minutes to hours. 9982493ff7SKirk McKusickWithout journaling, the time to recover after a crash is a function 10082493ff7SKirk McKusickof the number of files in the filesystem and the size of the filesystem. 10182493ff7SKirk McKusickWith journaling, the time to recover after a crash is a function of the 10282493ff7SKirk McKusickamount of activity in the filesystem in the minute before the crash. 10382493ff7SKirk McKusickJournaled recovery time is usually only a few seconds and never 10482493ff7SKirk McKusickexceeds a minute. 10582493ff7SKirk McKusick.Pp 10682493ff7SKirk McKusickThe drawback to using journaling is that the writes to its log adds 10782493ff7SKirk McKusickan extra write load to the media containing the filesystem. 10882493ff7SKirk McKusickThus a write-intensive workload will have reduced throughput on a 10982493ff7SKirk McKusickfilesystem running with journaling. 11082493ff7SKirk McKusick.Pp 11182493ff7SKirk McKusickLike all journaling filesystems, the journal recovery will only fix 11282493ff7SKirk McKusickissues known to the journal. 11382493ff7SKirk McKusickSpecifically if a media error occurs, 11482493ff7SKirk McKusickthe journal will not know about it and hence will not fix it. 11582493ff7SKirk McKusickThus when using journaling, it is still necessary to run a full fsck 11682493ff7SKirk McKusickevery few months or after a filesystem panic to check for and fix 11782493ff7SKirk McKusickany errors brought on by media failure. 11882493ff7SKirk McKusickA full fsck can be done by running a background fsck on a live 11982493ff7SKirk McKusickfilesystem or by running with the 12082493ff7SKirk McKusick.Fl f 12182493ff7SKirk McKusickflag on an unmounted filesystem. 12282493ff7SKirk McKusickWhen running 12382493ff7SKirk McKusick.Xr fsck_ffs 8 12482493ff7SKirk McKusickin background on a live filesystem the filesystem performance 12582493ff7SKirk McKusickwill be about half of normal during the time that the background 12682493ff7SKirk McKusick.Xr fsck_ffs 8 12782493ff7SKirk McKusickis running. 12882493ff7SKirk McKusickRunning a full fsck on a UFS filesystem is the equivalent of 12982493ff7SKirk McKusickrunning a scrub on a ZFS filesystem. 130868c68edSPawel Jakub Dawidek.It Fl J Cm enable | disable 1314e6430a6SEdward Tomasz NapieralaTurn on/off gjournal flag. 132baa12a84SKirk McKusick.It Fl k Ar held-for-metadata-blocks 133baa12a84SKirk McKusickSet the amount of space to be held for metadata blocks. 134baa12a84SKirk McKusickWhen set, the file system preference routines will try to save 135baa12a84SKirk McKusickthe specified amount of space immediately following the inode blocks 136baa12a84SKirk McKusickin each cylinder group for use by metadata blocks. 137baa12a84SKirk McKusickClustering the metadata blocks speeds up random file access 138baa12a84SKirk McKusickand decreases the running time of 139baa12a84SKirk McKusick.Xr fsck 8 . 140baa12a84SKirk McKusickWhile this option can be set at any time, 141baa12a84SKirk McKusickit is most effective if set before any data is loaded into the file system. 142baa12a84SKirk McKusickBy default 143baa12a84SKirk McKusick.Xr newfs 8 144baa12a84SKirk McKusicksets it to half of the space reserved to minfree. 1451f6a4631SRuslan Ermilov.It Fl L Ar volname 1461f6a4631SRuslan ErmilovAdd/modify an optional file system volume label. 1471165591eSDmitry MorozovskyLegal characters are alphanumerics, dashes, and underscores. 148289e09eeSRobert Watson.It Fl l Cm enable | disable 149289e09eeSRobert WatsonTurn on/off MAC multilabel flag. 1508fae3551SRodney W. Grimes.It Fl m Ar minfree 1518679b1b4SPhilippe CharnierSpecify the percentage of space held back 1528fae3551SRodney W. Grimesfrom normal users; the minimum free space threshold. 1533669a021SDavid GreenmanThe default value used is 8%. 1546002cc3eSGiorgos KeramidasNote that lowering the threshold can adversely affect performance: 1556002cc3eSGiorgos Keramidas.Bl -bullet 1566002cc3eSGiorgos Keramidas.It 157ef8f7ac9SSheldon HearnSettings of 5% and less force space optimization to 1583669a021SDavid Greenmanalways be used which will greatly increase the overhead for file 1593669a021SDavid Greenmanwrites. 1606002cc3eSGiorgos Keramidas.It 1616002cc3eSGiorgos KeramidasThe file system's ability to avoid fragmentation will be reduced 1626002cc3eSGiorgos Keramidaswhen the total free space, including the reserve, drops below 15%. 1636002cc3eSGiorgos KeramidasAs free space approaches zero, throughput can degrade by up to a 1646002cc3eSGiorgos Keramidasfactor of three over the performance obtained at a 10% threshold. 1656002cc3eSGiorgos Keramidas.El 1666002cc3eSGiorgos Keramidas.Pp 1676002cc3eSGiorgos KeramidasIf the value is raised above the current usage level, 1688fae3551SRodney W. Grimesusers will be unable to allocate files until enough files have 1698fae3551SRodney W. Grimesbeen deleted to get under the higher threshold. 1709340fc72SEdward Tomasz Napierala.It Fl N Cm enable | disable 1719340fc72SEdward Tomasz NapieralaTurn on/off the administrative NFSv4 ACL enable flag. 1723c5bd3e3SRuslan Ermilov.It Fl n Cm enable | disable 173ef8f7ac9SSheldon HearnTurn on/off soft updates. 1743c5bd3e3SRuslan Ermilov.It Fl o Cm space | time 1758fae3551SRodney W. GrimesThe file system can either try to minimize the time spent 1768fae3551SRodney W. Grimesallocating blocks, or it can attempt to minimize the space 177ef8f7ac9SSheldon Hearnfragmentation on the disk. 178ef8f7ac9SSheldon HearnOptimization for space has much 1793669a021SDavid Greenmanhigher overhead for file writes. 1803669a021SDavid GreenmanThe kernel normally changes the preference automatically as 1813669a021SDavid Greenmanthe percent fragmentation changes on the file system. 18216a7269eSJoerg Wunsch.It Fl p 1838679b1b4SPhilippe CharnierShow a summary of what the current tunable settings 1843c5bd3e3SRuslan Ermilovare on the selected file system. 1853c5bd3e3SRuslan ErmilovMore detailed information can be 1861c85e6a3SKirk McKusickobtained from the 18716a7269eSJoerg Wunsch.Xr dumpfs 8 188121095fdSChristian Bruefferutility. 189044479f5SNik Clayton.It Fl s Ar avgfpdir 190044479f5SNik ClaytonSpecify the expected number of files per directory. 191113db2ddSJeff Roberson.It Fl S Ar size 192113db2ddSJeff RobersonSpecify the softdep journal size in bytes. 193113db2ddSJeff RobersonThe minimum is 4M. 194a738d4cfSKonstantin Belousov.It Fl t Cm enable | disable 195a738d4cfSKonstantin BelousovTurn on/off the TRIM enable flag. 196a738d4cfSKonstantin BelousovIf enabled, and if the underlying device supports the BIO_DELETE 197a738d4cfSKonstantin Belousovcommand, the file system will send a delete request to the underlying 198a738d4cfSKonstantin Belousovdevice for each freed block. 199a738d4cfSKonstantin BelousovThe trim enable flag is typically set when the underlying device 200a738d4cfSKonstantin Belousovuses flash-memory as the device can use the delete command to 201a738d4cfSKonstantin Belousovpre-zero or at least avoid copying blocks that have been deleted. 202e848a50cSEdward Tomasz Napierala.Pp 203e848a50cSEdward Tomasz NapieralaNote that this does not trim blocks that are already free. 204e848a50cSEdward Tomasz NapieralaSee the 205e848a50cSEdward Tomasz Napierala.Xr fsck_ffs 8 206e848a50cSEdward Tomasz Napierala.Fl E 207e848a50cSEdward Tomasz Napieralaflag. 2088fae3551SRodney W. Grimes.El 2092af14b60SPhilippe Charnier.Pp 210e848a50cSEdward Tomasz NapieralaAt least one of these flags is required. 21132d46539STom Rhodes.Sh FILES 212e07c0f68SRuslan Ermilov.Bl -tag -width ".Pa /etc/fstab" 21332d46539STom Rhodes.It Pa /etc/fstab 21432d46539STom Rhodesread this to determine the device file for a 21532d46539STom Rhodesspecified mount point. 21632d46539STom Rhodes.El 2178fae3551SRodney W. Grimes.Sh SEE ALSO 218*1a720cbeSAlexander Ziaee.Xr ffs 4 , 2198fae3551SRodney W. Grimes.Xr fs 5 , 220115459beSGordon Bergling.Xr tuning 7 , 2218fae3551SRodney W. Grimes.Xr dumpfs 8 , 2224e6430a6SEdward Tomasz Napierala.Xr gjournal 8 , 22389d8548cSEdward Tomasz Napierala.Xr growfs 8 , 224097d42f4SMike Pritchard.Xr newfs 8 2258fae3551SRodney W. Grimes.Rs 2268fae3551SRodney W. Grimes.%A M. McKusick 2278fae3551SRodney W. Grimes.%A W. Joy 2288fae3551SRodney W. Grimes.%A S. Leffler 2298fae3551SRodney W. Grimes.%A R. Fabry 2308fae3551SRodney W. Grimes.%T "A Fast File System for UNIX" 2318fae3551SRodney W. Grimes.%J "ACM Transactions on Computer Systems 2" 2328fae3551SRodney W. Grimes.%N 3 2338fae3551SRodney W. Grimes.%P pp 181-197 2348fae3551SRodney W. Grimes.%D August 1984 2358fae3551SRodney W. Grimes.%O "(reprinted in the BSD System Manager's Manual, SMM:5)" 2368fae3551SRodney W. Grimes.Re 2376087df9eSRuslan Ermilov.Sh HISTORY 2386087df9eSRuslan ErmilovThe 2396087df9eSRuslan Ermilov.Nm 2406087df9eSRuslan Ermilovutility appeared in 2416087df9eSRuslan Ermilov.Bx 4.2 . 2428fae3551SRodney W. Grimes.Sh BUGS 24332ae24b7SRemko LodderThis utility does not work on active file systems. 244e863318eSMaxim KonovalovTo change the root file system, the system must be rebooted 245e863318eSMaxim Konovalovafter the file system is tuned. 2461c85e6a3SKirk McKusick.\" Take this out and a Unix Daemon will dog your steps from now until 247f8e782eeSPeter Wemm.\" the time_t's wrap around. 2488fae3551SRodney W. Grimes.Pp 2490227791bSRuslan ErmilovYou can tune a file system, but you cannot tune a fish. 250