1.\" $OpenBSD: tunefs.8,v 1.27 2019/04/23 18:13:11 schwarze Exp $ 2.\" $NetBSD: tunefs.8,v 1.36 2004/12/20 10:28:47 hubertf Exp $ 3.\" 4.\" Copyright (c) 1983, 1991, 1993 5.\" The Regents of the University of California. All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 1. Redistributions of source code must retain the above copyright 11.\" notice, this list of conditions and the following disclaimer. 12.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" notice, this list of conditions and the following disclaimer in the 14.\" documentation and/or other materials provided with the distribution. 15.\" 3. Neither the name of the University nor the names of its contributors 16.\" may be used to endorse or promote products derived from this software 17.\" without specific prior written permission. 18.\" 19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" SUCH DAMAGE. 30.\" 31.\" @(#)tunefs.8 8.3 (Berkeley) 5/3/95 32.\" 33.Dd $Mdocdate: April 23 2019 $ 34.Dt TUNEFS 8 35.Os 36.Sh NAME 37.Nm tunefs 38.Nd tune up an existing file system 39.Sh SYNOPSIS 40.Nm 41.Bk -words 42.Op Fl AFN 43.Op Fl e Ar maxbpg 44.Op Fl g Ar avgfilesize 45.Op Fl h Ar avgfpdir 46.Op Fl m Ar minfree 47.\" .Op Fl n Ar soft_dependency_enabling 48.Op Fl o Ar optimize_preference 49.Ar special | filesys 50.Ek 51.Sh DESCRIPTION 52.Nm 53is designed to change the dynamic parameters of a file system 54which affect the layout policies. 55.Pp 56The options are as follows: 57.Bl -tag -width Ds 58.It Fl A 59Cause the values to be updated in all the alternate 60superblocks instead of just the standard superblock. 61If this option is not used, 62then use of a backup superblock by 63.Xr fsck 8 64will lose anything changed by 65.Nm . 66.Fl A 67is ignored when 68.Fl N 69is specified. 70.It Fl e Ar maxbpg 71This indicates the maximum number of blocks any single file can 72allocate out of a cylinder group before it is forced to begin 73allocating blocks from another cylinder group. 74Typically this value is set to about one quarter of the total blocks 75in a cylinder group. 76The intent is to prevent any single file from using up all the 77blocks in a single cylinder group, 78thus degrading access times for all files subsequently allocated 79in that cylinder group. 80The effect of this limit is to cause big files to do long seeks 81more frequently than if they were allowed to allocate all the blocks 82in a cylinder group before seeking elsewhere. 83For file systems with exclusively large files, 84this parameter should be set higher. 85.It Fl F 86Indicates that 87.Ar special 88is a file system image, rather than a device name or file system mount point. 89.Ar special 90will be accessed 91.Sq as-is . 92.It Fl g Ar avgfilesize 93This specifies the expected average file size. 94.It Fl h Ar avgfpdir 95This specifies the expected number of files per directory. 96.It Fl m Ar minfree 97This value specifies the percentage of space held back 98from normal users; the minimum free space threshold. 99The default value is set during creation of the filesystem; see 100.Xr newfs 8 . 101This value can be set to zero, however up to a factor of three 102in throughput will be lost over the performance obtained at a 5% 103threshold. 104Note that if the value is raised above the current usage level, 105users will be unable to allocate files until enough files have 106been deleted to get under the higher threshold. 107.It Fl N 108Display all the settable options 109(after any changes from the tuning options) 110but do not cause any of them to be changed. 111.It Fl o Ar optimize_preference 112The file system can either try to minimize the time spent 113allocating blocks, or it can attempt to minimize the space 114fragmentation on the disk. 115If the value of 116.Ar minfree 117(see above) is less than 5%, 118then the file system should optimize for space to avoid 119running out of full sized blocks. 120For values of 121.Ar minfree 122greater than or equal to 5%, 123fragmentation is unlikely to be problematical, and 124the file system can be optimized for time. 125.Pp 126.Ar optimize_preference 127can be specified as either 128.Li space 129or 130.Li time . 131.El 132.Sh SEE ALSO 133.Xr fs 5 , 134.Xr dumpfs 8 , 135.Xr fsck_ffs 8 , 136.Xr growfs 8 , 137.Xr newfs 8 138.Rs 139.%A M. McKusick 140.%A W. Joy 141.%A S. Leffler 142.%A R. Fabry 143.%T "A Fast File System for UNIX" 144.%J "ACM Transactions on Computer Systems 2" 145.%N 3 146.%P pp. 181\(en197 147.%D August 1984 148.Re 149.Sh HISTORY 150The 151.Nm 152command appeared in 153.Bx 4.2 . 154.Sh BUGS 155This program should work on mounted and active file systems. 156Because the super-block is not kept in the buffer cache, 157the changes will only take effect if the program 158is run on unmounted file systems. 159To change the root file system, the system must be rebooted 160after the file system is tuned. 161.Pp 162.\" Take this out and a Unix Demon will dog your steps from now until 163.\" the time_t's wrap around. 164You can tune a file system, but you can't tune a fish. 165