summaryrefslogtreecommitdiffstats
path: root/sbin/newfs/newfs.h
Commit message (Collapse)AuthorAgeFilesLines
* The purpose of this change to the FFS layout policy is to reduce themckusick2013-03-221-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-301-0/+1
| | | | | | | | | | | | | | | | | | 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
* 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-041-0/+1
| | | | | | 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.
* 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
* Add support for FS_TRIM to user-mode UFS utilities.kib2010-12-291-0/+1
| | | | | | Reviewed by: mckusick, pjd, pho Tested by: pho MFC after: 1 month
* o bdeficize expand_number_int() function;sobomax2010-03-091-9/+9
| | | | | 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-091-1/+1
| | | | | | | ioctl(DIOCGSECTORSIZE). It creates issues on some architectures. MFC after: 1 week Reported by: Jayachandran C.
* Use expand_number(3) from libutil instead of home-grown function to parsesobomax2010-03-031-10/+10
| | | | | | | human-friendly power-of-two numbers (i.e. 2k, 5M etc). Suggested by: many MFC after: 1 week
* Ensure that newfs will never create a filesystem with more than 2^32mckusick2010-02-101-0/+32
| | | | | | | | | | | | | | | | 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
* Enable operation of newfs on plain files, which is useful when youluigi2008-12-031-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Rename the undocumented -E option to -X.phk2007-12-161-1/+2
| | | | | | | | | | 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.
* MFp4:yar2007-11-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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)
* Add -J flag to both newfs(8) and tunefs(8) which allows to enable gjournalpjd2006-10-311-0/+1
| | | | | | | | support. I left -j flag for UFS journal implementation which we may gain at some point. Sponsored by: home.pl
* Add an option to suppress the creation of the .snap directory inwes2005-01-211-0/+1
| | | | | | | | 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
* Remove advertising clause from University of California Regent's license,markm2004-04-091-4/+0
| | | | | | per letter dated July 22, 1999. Approved by: core, imp
* Add a "-l" flag to newfs, which sets the FS_MULTILABEL flag. Thisrwatson2004-02-261-0/+1
| | | | | | | | permits users of newfs to set the multilabel flag on UFS1 and UFS2 file systems from inception without using tunefs. Obtained from: TrustedBSD Project Sponsored by: DARPA, McAfee Research
* Add the -E command line option to force error conditions for testing.wes2003-11-161-0/+1
| | | | Sponsord by: St. Bernard Software
* Correct lines incorrectly added to the copyright message. Add missing period.mckusick2003-02-141-4/+1
| | | | | Submitted by: Bruce Evans <bde@zeta.org.au> Sponsored by: DARPA & NAI Labs.
* Convert newfs to libufs (really). Solves one real issue with previousjmallett2003-02-111-1/+2
| | | | | | | version of such. Differences in filesystems generated were found to be from 1) sbwrite with the "all" parameter 2) removal of writecache. The sbwrite call was made to perform as the original version, and otherwise this was checked against a version of newfs with the write cache removed.
* Bring in support for volume labels to the filesystem utilities.gordon2003-02-011-0/+2
| | | | Reviewed by: mckusick
* Back out conversion to libufs, for now. It seems to cause problems.jmallett2003-01-291-7/+1
| | | | Reported by: phk
* Convert newfs to use libufs. I've tested this on md filesystems, as hasjmallett2003-01-271-1/+7
| | | | keramida, and all seems well.
* s/filesystem/file system/g as discussed on -developerstrhodes2002-08-211-3/+3
|
* This commit adds basic support for the UFS2 filesystem. The UFS2mckusick2002-06-211-5/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | filesystem expands the inode to 256 bytes to make space for 64-bit block pointers. It also adds a file-creation time field, an ability to use jumbo blocks per inode to allow extent like pointer density, and space for extended attributes (up to twice the filesystem block size worth of attributes, e.g., on a 16K filesystem, there is space for 32K of attributes). UFS2 fully supports and runs existing UFS1 filesystems. New filesystems built using newfs can be built in either UFS1 or UFS2 format using the -O option. In this commit UFS1 is the default format, so if you want to build UFS2 format filesystems, you must specify -O 2. This default will be changed to UFS2 when UFS2 proves itself to be stable. In this commit the boot code for reading UFS2 filesystems is not compiled (see /sys/boot/common/ufsread.c) as there is insufficient space in the boot block. Once the size of the boot block is increased, this code can be defined. Things to note: the definition of SBSIZE has changed to SBLOCKSIZE. The header file <ufs/ufs/dinode.h> must be included before <ufs/ffs/fs.h> so as to get the definitions of ufs2_daddr_t and ufs_lbn_t. Still TODO: Verify that the first level bootstraps work for all the architectures. Convert the utility ffsinfo to understand UFS2 and test growfs. Add support for the extended attribute storage. Update soft updates to ensure integrity of extended attribute storage. Switch the current extended attribute interfaces to use the extended attribute storage. Add the extent like functionality (framework is there, but is currently never used). Sponsored by: DARPA & NAI Labs. Reviewed by: Poul-Henning Kamp <phk@freebsd.org>
* more file system > filesystemtrhodes2002-05-161-3/+3
|
* Continue the cleanup preparations for UFS2 (& GEOM):phk2002-04-241-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Use only one filedescriptor. Open in R/O or R/W based in the '-N' option. Make the filedescriptor a global variable instead of passing it around as semi-global variable(s). Remove the undocumented ability to specify type without '-T' option. Replace fatal() with straight err(3)/errx(3). Save calls to strerror() where applicable. Loose the progname variable. Get the sense of the cpgflag test correct so we only issue warnings if people specify cpg and can't get that. It can be argued that this should be an error. Remove the check to see if the disk is mounted: Open for writing would fail if it were mounted. Attempt to get the sectorsize and mediasize with the generic disk ioctls, fall back to disklabel and /etc/disktab as we can. Notice that on-disk labels still take precedence over /etc/disktab, this is probably wrong, but not as wrong as the entire concept of /etc/disktab is. Sponsored by: DARPA & NAI Labs.
* bbsize and sbsize cannot ever be trusted from the disklabel, inphk2002-04-071-2/+0
| | | | | | | | | particular as there may not be one. Remove #if 0'ed code which might mislead people to think otherwise. unifdef -ULOSTDIR, fsck can make lost+found on the fly. Sponsored by: DARPA & NAI Labs
* Swing the axe and remove some archaic features from newfs which modernphk2002-03-201-12/+3
| | | | | | | | | | | | | | | | | | | diskdrives do neither need nor want: -O create a 4.3BSD format filesystem -d rotational delay between contiguous blocks -k sector 0 skew, per track -l hardware sector interleave -n number of distinguished rotational positions -p spare sectors per track -r revolutions/minute -t tracks/cylinder -x spare sectors per cylinder No change in the produced filesystem image unless one or more of these options were used. Approved by: mckusick
* Add the undocumented -R option to disable randomness for regression-testing.phk2002-03-191-0/+1
| | | | | | | | Add a couple of simple regression tests accessible with "make test", they depend on the md(4) driver. FYI I have also tried running the test against a week old newfs and it passed.
* Further cleanups.phk2002-03-191-0/+68
OpenPOWER on IntegriCloud