1.\" $NetBSD: newfs_lfs.8,v 1.24 2015/10/15 06:24:33 dholland Exp $ 2.\" 3.\" Copyright (c) 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.\" @(#)newlfs.8 8.1 (Berkeley) 6/19/93 31.\" 32.Dd October 13, 2015 33.Dt NEWFS_LFS 8 34.Os 35.Sh NAME 36.Nm newfs_lfs 37.Nd construct a new LFS file system 38.Sh SYNOPSIS 39.Nm 40.Op Ar newfs_lfs-options 41.Ar special 42.Sh DESCRIPTION 43.Nm 44builds a log-structured file system on the specified special 45device basing its defaults on the information in the disk label. 46Before running 47.Nm 48the disk must be labeled using 49.Xr disklabel 8 , 50the proper fstype is 4.4LFS. 51Reasonable values for the 52.Li fsize , 53.Li bsize , 54and 55.Li sgs 56fields are 1024, 8192, and 7 respectively. 57.Pp 58The following options define the general layout policies. 59.Bl -tag -width Fl 60.It Fl A 61Attempt to compute the appropriate segment size using the formula 62.Em 4 * bandwidth * access time . 63The disk is tested for twenty seconds 64to discover its bandwidth and seek time. 65.It Fl B Ar logical-segment-size 66The logical segment size of the file system in bytes. 67If not specified, the segment size is computed by left-shifting 68the partition label's block size by the amount indicated in the 69partition table's segshift. 70If the disklabel indicates a zero block size or segment shift, 71a compile-time default segment size of 1M is used. 72.It Fl b Ar block-size 73The block size of the file system in bytes. 74If not specified, the block size is taken from the partition label, 75or if the partition label indicates 0, 76a compile-time default of 8K is used. 77.It Fl F 78Force creation of an LFS even on a partition labeled as another type. 79.Nm 80will use compile-time default values for block and fragment size, and segment 81shift, unless these are overridden by command-line flags. 82.It Fl f Ar fragment-size 83The fragment size of the file system in bytes. 84If not specified, the fragment size is taken from the partition label, 85or if the partition label indicates 0, 86a compile-time default of 1K is used. 87.It Fl I Ar interleave 88Specify the interleave between segments. 89The default is zero. 90.It Fl i 91The size of an inode block, in bytes. 92The default is to use the same size as a fragment, 93or in a v1 filesystem, the same size as a data block. 94.It Fl L 95Create a log-structured file system (LFS). 96This is the default, and this 97option is provided for compatibility only. 98.It Fl M Ar nsegs 99Specify 100.Em lfs_minfreeseg , 101the number of segments left out of the amount allocated to user data. 102A higher number increases cleaner performance, while a lower number 103gives more usable space. 104The default is based on the size of the filesystem, either 5% of the 105total number of segments or 20 segments, whichever is larger. 106.It Fl m Ar free space \&% 107The percentage of space reserved from normal users; the minimum 108free space threshold. 109The default value used is 10%. 110.It Fl N 111Do not actually create the filesystem. 112.It Fl O Ar offset 113Start the first segment this many sectors from the beginning of the 114partition. 115The default is zero. 116.It Fl R Ar nsegs 117Specify 118.Em lfs_resvseg , 119the number of segments set aside for the exclusive use of the cleaner. 120A larger figure reduces the likelihood of running out of clean segments, 121but if 122.Em lfs_resvseg 123is too close to 124.Em lfs_minfreeseg , 125the cleaner will run without ceasing when the filesystem becomes close to 126full. 127The default is the larger of 15 or the quantity 128.Em lfs_minfreeseg 129/ 2 + 1 . 130.It Fl r Ar ident 131For a v2 filesystem, specify the roll-forward identifier for the 132filesystem. 133This identifier, a 32-bit numeric quantity, 134should be different from that of any LFS that may previously 135have existed on the same disk. 136By default the identifier is chosen at random. 137.It Fl s Ar size 138The size of the file system in sectors. 139.It Fl v Ar version 140Make a filesystem with the specified disk layout version. 141Valid options are 1 or 2 (the default). 142.Em Note , 143however, that LFS version 1 is deprecated, and 64-bit volumes may not 144be version 1. 145.It Fl w Ar bitwidth 146Create a filesystem using the specified bit width: 32 or 64. 14732-bit LFS volumes are limited to 2TB in size; 64-bit LFS volumes are 148not, but incur additional overhead from having larger metadata 149structures. 150The default is 32-bit for volumes less than 1 TB, and 64-bit for 151larger volumes. 152.El 153.Sh SEE ALSO 154.Xr disktab 5 , 155.\" .Xr fs 5 , 156.Xr disklabel 8 , 157.Xr diskpart 8 , 158.Xr dumplfs 8 159.\" .Xr tunefs 8 160.Rs 161.%A M. Seltzer 162.%A K. Bostic 163.%A M. McKusick 164.%A C. Staelin 165.%T "An Implementation of a Log-Structured File System for UNIX" 166.%J "Proceedings of the Winter 1993 USENIX Conference" 167.%D January 25-29, 1993 168.%P pp. 315-331 169.Re 170.Rs 171.%A J. Matthews 172.%A D. Roselli 173.%A A. Costello 174.%A R. Wang 175.%A T. Anderson 176.%T "Improving the Performance of Log-Structured File Systems with Adaptive Methods" 177.%J "Proceedings of the Sixteenth ACM SOSP" 178.%D October 1997 179.Re 180.Sh HISTORY 181A 182.Ic newlfs 183command appeared in 184.Bx 4.4 , 185and was renamed to 186.Nm 187for 188.Nx 1.4 . 189