NEWFS(8)
π¦ newfs(8) β the glow-up your disk was waiting for π¦
ok so real talk: this is newfs, and you're reading it out of section 8, the System Manager's Manual. system manager energy π
she's the one who makes brand-new file systems out of thin air, and honestly? iconic.
β¨ NAME β¨
newfs β construct a new UFS1/UFS2 file system π
like... she builds them. a whole fresh file system. UFS1 or UFS2, your pick, no cap. bestie is out here laying down the entire foundation of your disk and looking gorgeous doing it π
π οΈ SYNOPSIS π οΈ
ok here's the summoning circle, copy it exactly, don't @ me:
newfs [-EJNUjlntu] [-L volname] [-O filesystem-type] [-S sector-size]
[-T disktype] [-a maxcontig] [-b block-size]
[-c blocks-per-cylinder-group] [-d max-extent-size] [-e maxbpg]
[-f frag-size] [-g avgfilesize] [-h avgfpdir] [-i bytes]
[-k held-for-metadata-blocks] [-m free-space] [-o optimization]
[-p partition] [-r reserved] [-s size] special
so yeah, that's a lot of little single-letter besties all bundled up at the front π«Ά β -E, -J, -N, -U, -j, -l, -n, -t, -u in the first lil cluster (yeah, -u shows up twice, she's just That Girl π), and then a whole parade of options that each want their own value.
and see that last word sitting there all by itself? that's special π β the main character of this whole command. she's the one thing that is not an option, and she gets the last word, periodt.
like, every single one of -L volname, -O filesystem-type, -S sector-size, -T disktype, -a maxcontig, -b block-size, -c blocks-per-cylinder-group, -d max-extent-size, -e maxbpg, -f frag-size, -g avgfilesize, -h avgfpdir, -i bytes, -k held-for-metadata-blocks, -m free-space, -o optimization, -p partition, -r reserved and -s size takes its own argument right after it. no guessing, no vibes-only parsing β the value goes with its flag, mmkay? πΈ
ngl, the flags do the actual work and they're explained further down, so hold that thought β don't go inventing what -J does, she'll tell you herself when we get there π
more to come bestie, don't go anywhere π
π DESCRIPTION π
okay so bestie, here's the whole vibe: newfs is the utility that initializes and clears file systems before first use. literally its whole job. it builds a file system on the special file you point it at. (and yes, we keep calling that "special file" the "disk" even though it does not have to be a physical disk β honestly it doesn't even need to be special at all, the bar is on the floor π.)
usually the defaults are, like, totally reasonable? but newfs has a ton of options so you can selectively override them if you're feeling picky. main character energy only. β¨
The following options define the general layout policies:
-Eβ erase the content of the disk before making the filesystem π§Ή. the reserved area in front of the superblock (that's the spot for bootcode) will NOT be erased, so don't come for it. erasing is only relevant to flash-memory or thinly provisioned devices. also heads up: erasing may take a long time π. and if the device doesn't supportBIO_DELETE, the command will fail. periodt.-Jβ enable journaling on the new file system viagjournalπ. seegjournal(8)for the deets. this is incompatible with soft updates (-U), so pick a lane bestie.-Lvolname β add a volume label to the new file system π·οΈ. legal characters are alphanumerics, dashes, and underscores. that's it, don't get creative.-Nβ cause the file system parameters to be printed out without really creating the file system π. it's giving window shopping. all the info, none of the commitment.-Ofilesystem-type β use1to specify that a UFS1 format file system be built; use2to specify that a UFS2 format file system be built. the default format is UFS2.-Tdisktype β for backward compatibility π«Ά. it's here, it's iconic, it's legacy.-Uβ enable soft updates on the new file system. this is incompatible with GEOM journaling (-J). and okay so if neither-Unor-uis specified, soft updates are enabled by default for UFS2 format file systems unless GEOM journaling was requested, and disabled otherwise. yes that sentence is a whole journey, read it twice π .-uβ do not enable soft updates on the new file system. same deal as above: if neither-Unor-uis specified, soft updates are enabled by default for UFS2 format file systems and disabled otherwise.-amaxcontig β specify the maximum number of contiguous blocks that will be laid out before forcing a rotational delay. the default value is16. seetunefs(8)for more details on how to set this option.-bblock-size β the block size of the file system, in bytes. it must be a power of 2 π’. the default size is32768bytes, and the smallest allowable size is4096bytes. the optimal block:fragment ratio is8:1. other ratios are possible, but are not recommended, and may produce poor results. so like... you can but should you? π-cblocks-per-cylinder-group β the number of blocks per cylinder group in a file system. the default is to compute the maximum allowed by the other parameters. this value is dependent on a number of other parameters, in particular the block size and the number of bytes per inode. very "everything is connected" of it tbh.-dmax-extent-size β the file system may choose to store large files using extents. this parameter specifies the largest extent size that may be used. the default value is the file system blocksize. it is presently limited to a maximum value of16times the file system blocksize and a minimum value of the file system blocksize. math girlies rise πΈ-emaxbpg β indicate the maximum number of blocks any single file can allocate out of a cylinder group before it is forced to begin allocating blocks from another cylinder group. the default is about one quarter of the total blocks in a cylinder group. seetunefs(8)for more details on how to set this option.-ffrag-size β the fragment size of the file system in bytes. it must be a power of two ranging in value betweenblocksize/8andblocksize. the default is4096bytes.-gavgfilesize β the expected average file size for the file system. manifesting your average file size, love that for you π¦.-havgfpdir β the expected average number of files per directory on the file system.-ibytes β specify the density of inodes in the file system. the default is to create an inode for every(2 * frag-size)bytes of data space. if fewer inodes are desired, a larger number should be used; to create more inodes a smaller number should be given. one inode is required for each distinct file, so this value effectively specifies the average file size on the file system. iykyk π-jβ enable soft updates journaling on the new file system. this implies soft updates (-U) and is incompatible with GEOM journaling (-J). this flag is implemented by running thetunefs(8)utility found in the user's$PATH. (so yes, it's out here borrowing your$PATH, respect the hustle.)
okay real talk, this one's a whole paragraph and a half, so buckle up bestie:
enabling journaling reduces the time spent by fsck_ffs(8) cleaning up a filesystem after a crash to a few seconds from minutes to hours π₯. without journaling, the time to recover after a crash is a function of the number of files in the filesystem and the size of the filesystem. with journaling, the time to recover after a crash is a function of the amount of activity in the filesystem in the minute before the crash. journaled recovery time is usually only a few seconds and never exceeds a minute. slay.
the drawback to using journaling is that the writes to its log adds an extra write load to the media containing the filesystem π. thus a write-intensive workload will have reduced throughput on a filesystem running with journaling. tradeoffs, we hate to see it.
like all journaling filesystems, the journal recovery will only fix issues known to the journal. specifically if a media error occurs, the journal will not know about it and hence will not fix it π. thus when using journaling, it is still necessary to run a full fsck every few months or after a filesystem panic to check for and fix any errors brought on by media failure. a full fsck can be done by running a background fsck on a live filesystem or by running with the -f flag on an unmounted filesystem. when running fsck_ffs(8) in background on a live filesystem the filesystem performance will be about half of normal during the time that the background fsck_ffs(8) is running. and for the ZFS girlies: running a full fsck on a UFS filesystem is the equivalent of running a scrub on a ZFS filesystem. π§
-kheld-for-metadata-blocks β set the amount of space to be held for metadata blocks in each cylinder group. when set, the file system preference routines will try to save the specified amount of space immediately following the inode blocks in each cylinder group for use by metadata blocks. clustering the metadata blocks speeds up random file access and decreases the running time offsck(8)β‘. by defaultnewfssets it to half of the space reserved tominfree.-lβ enable multilabel MAC on the new file system π.-mfree-space β the percentage of space reserved from normal users; the minimum free space threshold. the default value used is defined byMINFREEfrom<ufs/ffs/fs.h>, currently8%. seetunefs(8)for more details on how to set this option. (normal users catching strays, but okay.)-nβ do not create a.snapdirectory on the new file system. the resulting file system will not support snapshot generation, sodump(8)in live mode and backgroundfsck(8)will not function properly π¬. the traditionalfsck(8)and offlinedump(8)will work on the file system. this option is intended primarily for memory or vnode-backed file systems that do not requiredump(8)orfsck(8)support.-ooptimization β (spaceortime). the file system can either be instructed to try to minimize the time spent allocating blocks, or to try to minimize the space fragmentation on the disk. if the value ofminfree(see above) is less than8%, the default is to optimize for space; if the value ofminfreeis greater than or equal to8%, the default is to optimize for time. seetunefs(8)for more details on how to set this option. choose your fighter π-ppartition β the partition name (a..h) you want to use in case the underlying image is a file, so you do not have access to individual partitions through the filesystem. can also be used with a device, e.g.,newfs -p f /dev/da1s3is equivalent tonewfs /dev/da1s3f. cute shortcut, we love a one-liner π«Ά-rreserved β the size, in sectors, of reserved space at the end of the partition specified in special. this space will not be occupied by the file system; it can be used by other consumers such asgeom(4). defaults to0.-ssize β the size of the file system in sectors. this value defaults to the size of the raw partition specified in special less the reserved space at its end (see-r). a size of0can also be used to choose the default value. a valid size value cannot be larger than the default one, which means that the file system cannot extend into the reserved space π«. boundaries, bestie.-tβ turn on the TRIM enable flag. if enabled, and if the underlying device supports theBIO_DELETEcommand, the file system will send a delete request to the underlying device for each freed block. the trim enable flag is typically set for flash-memory devices to reduce write amplification which reduces wear on write-limited flash-memory and often improves long-term performance π. thinly provisioned storage also benefits by returning unused blocks to the global pool. environmentally conscious queen π±
The following options override the standard sizes for the disk geometry. Their default values are taken from the disk label. changing these defaults is useful only when using newfs to build a file system whose raw image will eventually be used on a different type of disk than the one on which it is initially created (for example on a write-once disk).
β οΈ warning bestie: note that changing any of these values from their defaults will make it impossible for fsck(8) to find the alternate superblocks if the standard superblock is lost. so like... know what you're doing, okay? π
-Ssector-size β the size of a sector in bytes (almost never anything but512). like, genuinely almost never. it's the "i'm not like other sectors" of numbers π.
π NOTES ON THE NAMING π
so "newfs" is a common name prefix for utilities creating filesystems, with the suffix indicating the type of the filesystem β for instance newfs_msdos(8) π. the newfs utility is a special case which predates that convention. it was doing the whole name thing before it was cool, okurrr. β
β¨ EXAMPLES β¨
okay bestie, let's actually do one so it's not all theory π
newfs /dev/ada3s1a
That right there creates a brand-new ufs file system on ada3s1a. Slay. π
And here's what it's giving under the hood: a block size of 32768 bytes, a fragment size of 4096 bytes, and the largest possible number of blocks per cylinder group. ngl these values lowkey tend to produce better performance for most applications than the historical defaults β which were, for the record, an 8192 byte block size and a 1024 byte fragment size. β¨
π«Ά real talk though: that big fragment size may lead to much wasted space on file systems that contain looooads of small files. it's giving "expensive taste, small apartment" π so keep it in mind, bestie.
π SEE ALSO π
go read these, iykyk π β they're the whole friend group:
ffs(4)geom(4)disktab(5)fs(5)camcontrol(8)dump(8)dumpfs(8)fdformat(8)fsck(8)gjournal(8)gpart(8)growfs(8)makefs(8)mount(8)newfs_msdos(8)tunefs(8)
And ooooh, the academic icon era π β this absolute classic:
M. McKusick, W. Joy, S. Leffler, and R. Fabry, βA Fast File System for UNIXβ, ACM Transactions on Computer Systems 2, 3, pp 181-197, August 1984, (reprinted in the BSD System Manager's Manual).
periodt. the founding fathers of fast file systems fr fr ππ₯
π¦ HISTORY π¦
The newfs utility appeared in 4.2BSD. like, it's been that girl since forever π
and that's the whole page, bestie!! π you made it to the end, iconic behavior honestly πΈ
this lil' page comes to you courtesy of Debian, dated March 20, 2026, and it lives at NEWFS(8) β go forth and format responsibly π«Άπβ¨
π¦ where this page comes from
- freebsd 15.1: base 15.1
- Copyright (c) 1983, 1987, 1991, 1993, 1994 The Regents of the University of California. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms