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