Copyright © 2003 by The FreeBSD Documentation Project
This Mini-FAQ contains tips and information regarding the newly ported UFS2 filesystem. This is intended to be a rapidly evolving document. The latest version of this document is always available from the UFS2 Mini-FAQ.
Suggestions and contributions should be sent to <email@example.com>.
Alex Wilkinson <Alex.Wilkinson@dsto.defence.gov.au> Alexander Pohoyda <firstname.lastname@example.org> Anthony CARTER <email@example.com> Bernd Walter <firstname.lastname@example.org> Bruce Evans <email@example.com> Daniel C. Sobral <firstname.lastname@example.org> David Schultz <das@FreeBSD.ORG> Frank van der Linden <email@example.com> Lucky Green <firstname.lastname@example.org> Manfred Antar <email@example.com> Marcin Dalecki <firstname.lastname@example.org> Narvi <email@example.com> Peter Schultz <firstname.lastname@example.org> Poul-Henning Kamp <email@example.com> Robert Watson <firstname.lastname@example.org> Takahashi Yoshihiro <nyan@jp.FreeBSD.org> Terry Lambert <email@example.com> The Anarcat <firstname.lastname@example.org> Tomi Vainio <Tomi.Vainio@Sun.COM>
UFS2 -introduced in FreeBSD 5-CURRENT- is an extension to the well-known UFS. It adds 64 bit block pointers (breaking the 1T barrier), support for extended file storage, and a few other things.
Short summary of changes:
64-bit pointers up the wazoo (implies that inodes have doubled in size, and now are 256 bytes)
Layout and functional changes to help support variable-size blocks (extent-like allocation)
Extension of various flag fields
Addition of per-inode extended attribute extent
Lazy inode initialization (watch newfs(8) fly)
Apart from these modifications all UFS1 code is being used in UFS2 unchanged.
UFS (and UFS2) define on-disk data layout. FFS sits on top of UFS (1 or 2) and provides directory structure information, and a variety of disk access optimizations. FFS is described in A Fast File System for Unix. This FAQ is about a revision of UFS named UFS2.
The motivating factor in the layout change was the need for better Extended Attribute (EA) support, and while the developers were at it they figured they would do a bunch of other useful things too. UFS2 uses the same basic technologies as modern UFS1 (inodes, linear directory layout, soft updates, snapshotting, background file system checking, etc) so it was a relatively low-risk change.
UFS2 was developed by Kirk McKusick and Poul-Henning Kamp, but is based in large part on the existing UFS1 file system, which had a host of contributors. UFS2 development was sponsored by DARPA and Network Associates Laboratories, and motivated by the requirements of the TrustedBSD Project. UFS2 was ported to NetBSD by Frank van der Linden, sponsored by Wasabi Systems.
It would most likely require significant changes whereas the developers wanted to restrict themselves to low-risk modifications only. See previous question.
UFS2 has the potential to be faster for really large files by using jumbo blocks, but the code to do that has yet to be written. Additionally, because inodes are lazily initialized in UFS2, newfs(8) runs much faster. Other than that, UFS2 performance should not significantly differ from UFS1.
As of FreeBSD-CURRENT 2003/04/20, newfs(8) and sysinstall(8) will create UFS2 file systems by default. Users wanting to create UFS1 file systems for whatever reason (interoperability with earlier versions, etc.) should be sure to employ the -O1 flag to newfs(8), or hit 1 in the label editor in sysinstall(8) to select UFS1.
Note: PC98 machines are exempt and still default to UFS1. See "On which platforms can UFS2 be used for the root filesystem?"
As of 2003/04/02 UFS2 is not (yet) the default type for FFS filesystems. newfs(8) will create a normal FFS filesystem by default. If you want a UFS2 fileystem, specify -O 2 as an option.
No additional kernel options are needed for UFS2 support; it's contained within the FFS code.
Please note that older fsck(8) binaries will complain a bit about UFS2 filesystems, because of some superblock changes. This is harmless. However, if you have 1.6 fsck(8) binaries, they will signal a fatal superblock mismatch with the first alternate, because they compare too many fields (even ones that aren't useful). This is annoying, and pepole should upgrade their fsck_ffs(8) binaries before using UFS2. fsck_ffs(8) 1.6.1 will be fully UFS2 compatible.
The answer to this is defined by /boot/loader. FreeBSD Alpha, IA64, and SPARC have no problems.
On FreeBSD i386, the answer is yes, modulo the restriction that the root filesystem cannot be larger than 1.5TB. David Schultz, et al., have proposed a patch to remove this limitation. FreeBSD PC98 does not support UFS2 root partitions and it is unknown if work is underway to address this.
NetBSD support is unknown to the author of this document as of this writing.
The following sequence has been reported to work. Substitute the correct device name on your system.
newfs -U -O 2 /dev/da1s1a mount /dev/da1s1a /mnt cd /mnt dump 0buf 126 - / | restore xbf 126 -Other suggestions for a dump - restore pipeline include:
dump 0abf 64 - / | restore rbf 64 -Use of the dump -C option (-C 32) has also been suggested.
No it does not. Inodes are preallocated, but UFS2 lazily initializes them. This mainly means that newfs(8) runs much faster.
You need a loader and bootblocks that support UFS2. Try using disklabel -B
You need a new boot block. What I'd recommend is booting an install floppy or cd, going to custom installation, checking the partitioning (ensuring everything is correct), writing, and then selecting the boot loader. I *think* this should work. What I *don't* recommend is getting a fixit disk and running boot0cfg. Last time I did that I spent three days recovering my partitions.
|--From Daniel Sobral|
This, and other documents, can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/.
For questions about FreeBSD, read the
before contacting <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.