summaryrefslogtreecommitdiffstats
path: root/sbin/newfs
Commit message (Collapse)AuthorAgeFilesLines
* The purpose of this change to the FFS layout policy is to reduce themckusick2013-03-224-1/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | running time for a full fsck. It also reduces the random access time for large files and speeds the traversal time for directory tree walks. The key idea is to reserve a small area in each cylinder group immediately following the inode blocks for the use of metadata, specifically indirect blocks and directory contents. The new policy is to preferentially place metadata in the metadata area and everything else in the blocks that follow the metadata area. The size of this area can be set when creating a filesystem using newfs(8) or changed in an existing filesystem using tunefs(8). Both utilities use the `-k held-for-metadata-blocks' option to specify the amount of space to be held for metadata blocks in each cylinder group. By default, newfs(8) sets this area to half of minfree (typically 4% of the data area). This work was inspired by a paper presented at Usenix's FAST '13: www.usenix.org/conference/fast13/ffsck-fast-file-system-checker Details of this implementation appears in the April 2013 of ;login: www.usenix.org/publications/login/april-2013-volume-38-number-2. A copy of the April 2013 ;login: paper can also be downloaded from: www.mckusick.com/publications/faster_fsck.pdf. Reviewed by: kib Tested by: Peter Holm MFC after: 4 weeks
* Fix problem with geom_label(4) not recognizing UFS labels on filesystemstrasz2012-10-303-1/+3
| | | | | | | | | | | | | | | | | | extended using growfs(8). The problem here is that geom_label checks if the filesystem size recorded in UFS superblock is equal to the provider (i.e. device) size. This check cannot be removed due to backward compatibility. On the other hand, in most cases growfs(8) cannot set fs_size in the superblock to match the provider size, because, differently from newfs(8), it cannot recompute cylinder group sizes. To fix this problem, add another superblock field, fs_providersize, used only for this purpose. The geom_label(4) will attach if either fs_size (filesystem created with newfs(8)) or fs_providersize (filesystem expanded using growfs(8)) matches the device size. PR: kern/165962 Reviewed by: mckusick Sponsored by: FreeBSD Foundation
* Fix sbin/ build with a 64-bit ino_t.mdf2012-09-271-1/+2
| | | | Original code by: Gleb Kurtsou
* Fix warning when compiling with gcc46:eadler2012-01-101-2/+0
| | | | | | | error: variable 'c' set but not used Approved by: dim MFC after: 3 days
* Reduce NFPI by half to keep the default number of inodes the same withmckusick2011-12-211-1/+1
| | | | | | | | | the now default 32K/4K filesystem the same as the number of inodes in the previously default 16K/2K filesystem. PR: bin/16265 Reported by: Olivier Cochard-Labbe <olivier@cochard.me> MFC: 4 weeks (9 is the only affected branch)
* Add missing static keywords for global variables to tools in sbin/.ed2011-11-042-2/+3
| | | | | | These tools declare global variables without using the static keyword, even though their use is limited to a single C-file, or without placing an extern declaration of them in the proper header file.
* Advertise growfs(8) a little better.trasz2011-06-221-1/+2
|
* Update the manual page to reflect the new 32K/4K defaults.mckusick2011-05-281-4/+4
| | | | Reminded by: Ivan Voras
* Raise the default blocksize for UFS/FFS filesystems frommckusick2011-05-261-2/+2
| | | | | | | | | | | | | | | | | | | 16K to 32K and the default fragment size from 2K to 4K. The rational is that most disks are now running with 4K sectors. While they can (slowly) simulate 512-byte sectors by doing a read-modify-write, it is desirable to avoid this functionality. By raising the minimum filesystem allocation to 4K, the filesystem will never trigger the small sector emulation. Also, the growth of disk sizes has lead us to double the default block size about every ten years. The rise from 8K to 16K blocks was done in 2001. So, by the 10-year metric, the time has come for 32K blocks. Discussed at: May 2011 BSDCan Developer Summit Reference: http://wiki.freebsd.org/201105DevSummit/FileSystems
* Stop trying to zero UFS1 superblocks if we fall off the end of the disk.cperciva2011-04-261-1/+4
| | | | | | | | | | This avoids a potentially many-hours-long loop of failed writes if newfs finds a partially-overwritten superblock (or, for that matter, random garbage which happens to have superblock magic bytes); on one occasion I found newfs trying to zero 800 million superblocks on a 50 MB disk. Reviewed by: mckusick MFC after: 1 week
* Xref makefs(8).jh2011-02-221-1/+2
| | | | | PR: 154708 Submitted by: jhs
* Add the -j option to enable soft updates journaling when creatingmckusick2011-02-162-3/+18
| | | | | | a new file system. Reviewed by: Kostik Belousov <kostikbel@gmail.com>
* The dump, fsck_ffs, fsdb, fsirand, newfs, makefs, and quot utilitiesmckusick2011-01-241-10/+9
| | | | | | | | | | | | | | include sys/time.h instead of time.h. This include is incorrect as per the manpages for the APIs and the POSIX definitions. This commit replaces sys/time.h where necessary with time.h. The commit also includes some minor style(9) header fixup in newfs. This commit is part of a larger effort by Garrett Cooper started in //depot/user/gcooper/posix-conformance-work/ -- to make FreeBSD more POSIX compliant. Submitted by: Garrett Cooper yanegomi at gmail dot com
* Add support for FS_TRIM to user-mode UFS utilities.kib2010-12-294-3/+19
| | | | | | Reviewed by: mckusick, pjd, pho Tested by: pho MFC after: 1 month
* Add the missed 'p' flag to getopt() optstring argument.kib2010-12-151-1/+1
| | | | MFC after: 1 week
* Reported problem:mckusick2010-09-241-7/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Large (60GB) filesystems created using "newfs -U -O 1 -b 65536 -f 8192" show incorrect results from "df" for free and used space when mounted immediately after creation. fsck on the new filesystem (before ever mounting it once) gives a "SUMMARY INFORMATION BAD" error in phase 5. This error hasn't occurred in any runs of fsck immediately after "newfs -U -b 65536 -f 8192" (leaving out the "-O 1" option). Solution: The default UFS1 superblock is located at offset 8K in the filesystem partition; the default UFS2 superblock is located at offset 64K in the filesystem partition. For UFS1 filesystems with a blocksize of 64K, the first alternate superblock resides at 64K which is the the location used for the default UFS2 superblock. By default, the system first checks for a valid superblock at the default location for a UFS2 filoesystem. For a UFS1 filesystem with a blocksize of 64K, there is a valid UFS1 superblock at this location. Thus, even though it is expected to be a backup superblock, the system will use it as its default superblock. So, we have to ensure that all the statistcs on usage are correct in this first alternate superblock as it is the superblock that will actually be used. While tracking down this problem, another limitation of UFS1 became evident. For UFS1, the number of inodes per cylinder group is stored in an int16_t. Thus the maximum number of inodes per cylinder group is limited to 2^15 - 1. This limit can easily be exceeded for block sizes of 32K and above. Thus when building UFS1 filesystems, newfs must limit the number of inodes per cylinder group to 2^15 - 1. Reported by: Guy Helmer<ghelmer@palisadesys.com> Followup by: Bruce Cran <brucec@freebsd.org> PR: 107692 MFC after: 4 weeks
* Synchronize newfs(8) manual with code.gjb2010-09-141-3/+4
| | | | | | | | PR: 61716 Submitted by: Radim Kolar <hsn at netmag cz> Patch by: arundel Approved by: keramida (mentor) MFC after: 1 week
* Rewording and typo fixes in newfs(8).gjb2010-09-121-3/+3
| | | | | | | | PR: 150490 Submitted by: Eitan Adler <foreignuser at eitanadler com> Additional fixes by: Warren Block <wblock at wonkity com>, keramida Approved by: keramida (mentor) MFC after: 1 week
* Fix "Empty input line" mdoc warning.sobomax2010-03-101-2/+2
| | | | Submitted by: Alexander Best
* o bdeficize expand_number_int() function;sobomax2010-03-093-38/+36
| | | | | o revert most of the recent changes (int -> int64_t conversion) by using this functon for parsing all options.
* Change secrorsize back to int, since that's the data type expected by thesobomax2010-03-092-3/+21
| | | | | | | ioctl(DIOCGSECTORSIZE). It creates issues on some architectures. MFC after: 1 week Reported by: Jayachandran C.
* Cast these to intmax_t before printing to fix build bustage. Betterimp2010-03-031-7/+9
| | | | solutions welcome.
* Use expand_number(3) from libutil instead of home-grown function to parsesobomax2010-03-033-92/+34
| | | | | | | human-friendly power-of-two numbers (i.e. 2k, 5M etc). Suggested by: many MFC after: 1 week
* Teach newfs(8) to understand size modifiers for all options takingsobomax2010-03-031-11/+84
| | | | | | | | | size or size-like argument. I.e. "-s 32k" instead of "-s 32768". Size parsing function has been shamelessly stolen from the truncate(1). I'm sure many sysadmins out there will appreciate this small improvement. MFC after: 1 week
* One last pass to get all the unsigned comparisons correct.mckusick2010-02-111-10/+13
|
* Ensure that newfs will never create a filesystem with more than 2^32mckusick2010-02-103-47/+67
| | | | | | | | | | | | | | | | inodes by cutting back on the number of inodes per cylinder group if necessary to stay under the limit. For a default (16K block) file system, this limit begins to take effect for file systems above 32Tb. This fix is in addition to -r203763 which corrected a problem in the kernel that treated large inode numbers as negative rather than unsigned. For a default (16K block) file system, this bug began to show up at a file system size above about 16Tb. Reported by: Scott Burns, John Kilburg, Bruce Evans Followup by: Jeff Roberson PR: 133980 MFC after: 2 weeks
* Correct two typos.delphij2010-02-061-2/+2
| | | | | Reported by: Brandon Falk <falkman gamozo org> MFC after: 1 week
* Raise WARNS for various tools where possible.ed2010-01-171-1/+1
| | | | Submitted by: Marius NĂ¼nnerich <marius@nuenneri.ch>
* Fix typo: s/partion/partition/mbr2010-01-021-1/+1
| | | | | Submitted by: Marc Balmer <marc@msys.ch> MFC after: 3 days
* Slightly improve gjournal documentation.trasz2009-04-291-0/+4
| | | | Reviewed by: pjd
* Don't add a bwrite() symbol, it breaks the build when building newfscognet2009-02-122-16/+16
| | | | | | statically. Instead, bring in a stripped down version of sbwrite(), and add the offset to every bwrite() calls.
* Move the check for the ending char in the partition name whereluigi2008-12-121-5/+6
| | | | | | | | | it was before -- the check is only made when getdisklabel() returns valid info. On passing, use MAXPARTITIONS to identify the max partition number, instead of the hardwired 'h' MFC after: 4 weeks
* Enable operation of newfs on plain files, which is useful when youluigi2008-12-035-16/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | want to prepare disk images for emulators (though 'makefs' in port can do something similar). This relies on: + minor changes to pass the consistency checks even when working on a file; + an additional option, '-p partition' , to specify the disk partition to initialize; + some changes on the I/O routines to deal with partition offsets. The latter was a bit tricky to implement, see the details in newfs.h: in newfs, I/O is done through libufs which assumes that the file descriptor refers to the whole partition. Introducing support for the offset in libufs would require a non-backward compatible change in the library, to be dealt with a version bump or with symbol versioning. I felt both approaches to be overkill for this specific application, especially because there might be other changes to libufs that might become necessary in the near future. So I used the following trick: - read access is always done by calling bread() directly, so we just add the offset in the (few) places that call bread(); - write access is done through bwrite() and sbwrite(), which in turn calls bwrite(). To avoid rewriting sbwrite(), we supply our own version of bwrite() here, which takes precedence over the version in libufs. MFC after: 4 weeks
* Replace reference from vinum.8 to gvinum.8, it was advised in the PR toremko2008-03-211-2/+2
| | | | | | | | | | replace this with vinum.4, but that's the kernel interface manual, which is not appropriate in my understanding. I think that gvinum is a suitable replacement for this. PR: docs/121938 Submitted by: "Federico" <federicogalvezdurand at yahoo dot com> MFC after: 3 days
* Use calloc().delphij2008-03-051-2/+1
|
* Report erase interval (correctly) in sectors.phk2007-12-161-2/+2
|
* Rename the undocumented -E option to -X.phk2007-12-164-15/+32
| | | | | | | | | | Implement -E option which will erase the filesystem sectors before making the new filesystem. Reserved space in front of the superblock (bootcode) is not erased. NB: Erasing can take as long time as writing every sector sequentially. This is relevant for all flash based disks which use wearlevelling.
* - Pay attention to the fact that ioctl(2) is only known toyar2007-11-281-4/+5
| | | | | | | | | return -1 on error while any other return value from it can indicate success. (See RETURN VALUE in our ioctl(2) manpage and the POSIX spec.) - Avoid assumptions about the state of the data buffer after ioctl(2) failure.
* MFp4:yar2007-11-283-22/+59
| | | | | | | | | | | | | | | | | | | | | | Add a new option to newfs(8), -r, to specify reserved space at the end of the device. It can be useful, e.g., when the device is to become a member of a gmirror array later w/o losing the file system on it. Document the new option in the manpage. While I'm here, improve error handling for -s option, which is syntactically similar to -r; and document the fact that -s0 selects the default fs size explicitly, which can be useful, e.g., in a menu-based wrapper around newfs(8) requiring some value be entered for the fs size. Also fix a small typo in the help line for -s (missing space). Idea and initial implementation by: marck Discussed on: -fs Critical review by: bde Tested with: cmp(1)
* Document -J in usage.pjd2007-03-021-0/+1
| | | | Submitted by: Eric Anderson <anderson@freebsd.org>
* Add -J flag to both newfs(8) and tunefs(8) which allows to enable gjournalpjd2006-10-314-2/+11
| | | | | | | | support. I left -j flag for UFS journal implementation which we may gain at some point. Sponsored by: home.pl
* Explicitly say which gid do we use as a fallback, when operatordelphij2006-09-271-1/+1
| | | | | | is not found. Suggested by: kensmith
* Don't treat failure to find the operator GID as a fatal error; thisiedowse2005-08-141-4/+9
| | | | | made it impossible to use newfs (and mdmfs) when /etc/group is missing and /etc is read-only.
* When creating a new FFS file system, the block size will indirectlydelphij2005-02-201-0/+10
| | | | | | | | | | | | | affect the largest file size that is allowed by the file system. On the other hand, when creating a snapshot, the snapshot file will appear as it is as big as the file system itself. Hence we will not be able to create a file system on large file systems with small block sizes. Add a warning about this, and gives some hints to correct the issue. Reviewed by: mckusick MFC After: 1 week
* Document -l and -n options in usage().ru2005-01-221-0/+2
|
* Polish previous revision:ru2005-01-221-6/+12
| | | | | | - Bump document date. - Spell "file system" properly. - Add missing markup bits.
* Add an option to suppress the creation of the .snap directory inwes2005-01-214-32/+60
| | | | | | | | the new filesystem. This is intended for memory and vnode filesystems that will never be fsck'ed or dumped. Obtained from: St. Bernard Software RAPID MFC after: 2 weeks
* Cast to intmax_t when using %jd format.pjd2005-01-081-1/+1
| | | | MFC after: 3 days
* Fix '-s' option for large disks and fix printing maximum file system size.pjd2004-09-191-4/+7
|
* Generalize the UFS bad magic value used to determine when a filesystemjhb2004-08-191-4/+9
| | | | | | | | has only been partly initialized via newfs(8) so that it applies to both UFS1 and UFS2. Submitted by: "Xin LI" delphij at frontfree dot net MFC: maybe?
OpenPOWER on IntegriCloud