Throw the switch--change to UFS2 as our default file system format for

FreeBSD 5.1-RELEASE and later:

- newfs(8) will now create UFS2 file systems unless UFS1 is specifically
  requested (-O1).  To do this, I just twiddled the Oflag default.

- sysinstall(8) will now select UFS2 as the default layout for new
  file systems unless specifically requested (use '1' and '2' to change
  the file system layout in the disk labeler).  To do this, I inverted
  the ufs2 flag into a ufs1 flag, since ufs2 is now the default and
  ufs1 is the edge case.  There's a slight semantic change in the
  key behavior: '2' no longer toggles, it changes the selection to UFS2.

This is very similar to a patch David O'Brien sent me at one point, and
that I couldn't find.

Approved by:	re (telecon)
Reviewed by:	mckusick, phk, bmah
This commit is contained in:
Robert Watson 2003-04-20 14:08:05 +00:00
parent e02fef7adc
commit b459937e0c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=113751
10 changed files with 76 additions and 40 deletions

View File

@ -89,7 +89,7 @@ without really creating the file system.
.It Fl O Ar filesystem-type
Use 1 to specify that a UFS1 format file system be built;
use 2 to specify that a UFS2 format file system be built.
The default is UFS1 format, but will eventually be changed to UFS2.
The default format is UFS2.
.It Fl T Ar disktype
For backward compatibility.
.It Fl U

View File

@ -116,7 +116,7 @@ static const char rcsid[] =
int Lflag; /* add a volume label */
int Nflag; /* run without writing file system */
int Oflag = 1; /* file system format (1 => UFS1, 2 => UFS2) */
int Oflag = 2; /* file system format (1 => UFS1, 2 => UFS2) */
int Rflag; /* regression test */
int Uflag; /* enable soft updates for file system */
quad_t fssize; /* file system size */

View File

@ -126,16 +126,20 @@ with significant activity can temporarily overflow if the soft updates
policy results in free'd blocks not being "garbage collected" as fast
as they're being requested.
To make use of UFS2, press '2' on a UFS file system to toggle the
on-disk format revision. UFS2 provides native support for extended
attributes, larger disk sizes, and forward compatibility with new
on-disk high performance directory layout and storage extents.
However, UFS2 is unsupported on versions of FreeBSD prior to 5.0,
so it is not recommended for environments requiring backward
compatibility. Also, UFS2 is not currently recommended as a root
file system format for non-64-bit platforms due to increased size
of the boot loader; special local configuration is required to boot
UFS2 as a root file system on i386 and PC98.
The UNIX File System (UFS) on FreeBSD supports two different on-disk
layouts: UFS1 and UFS2. UFS1 was the default file system in use
through FreeBSD 5.0-RELEASE; as of FreeBSD 5.1-RELEASE, the default
is now UFS2. UFS2 provides sparse inode allocation (faster
fsck), 64-bit storage pointers (larger maximum size), and native
extended attributes (required for ACLs, MAC, and other advanced
security and file system services). The selection of UFS1 or
UFS2 must be made when the file system is created--later conversion
is not currently possible. UFS2 is the recommended file system, but
if disks are to be used on older FreeBSD systems, UFS1 improves
portability. When dual-booting between FreeBSD 4.x or earlier and
FreeBSD 5.x, UFS1 file systems will be accessible from both.
To toggle a file system to UFS1, press '1'. To restore it to UFS2,
press '2'.
To add additional flags to the newfs command line for UFS file
systems, press 'N'. These options will be specified before the

View File

@ -879,7 +879,7 @@ performNewfs(PartInfo *pi, char *dname, int queue)
snprintf(buffer, LINE_MAX, "%s %s %s %s %s",
NEWFS_UFS_CMD,
pi->newfs_data.newfs_ufs.softupdates ? "-U" : "",
pi->newfs_data.newfs_ufs.ufs2 ? "-O2" : "-O1",
pi->newfs_data.newfs_ufs.ufs1 ? "-O1" : "-O2",
pi->newfs_data.newfs_ufs.user_options,
dname);
break;

View File

@ -337,7 +337,7 @@ new_part(char *mpoint, Boolean newfs)
pi->newfs_data.newfs_ufs.acls = FALSE;
pi->newfs_data.newfs_ufs.multilabel = FALSE;
pi->newfs_data.newfs_ufs.softupdates = strcmp(mpoint, "/");
pi->newfs_data.newfs_ufs.ufs2 = FALSE;
pi->newfs_data.newfs_ufs.ufs1 = FALSE;
return pi;
}
@ -461,7 +461,7 @@ getNewfsCmd(PartInfo *p)
case NEWFS_UFS:
snprintf(buffer, NEWFS_CMD_ARGS_MAX, "%s %s %s %s",
NEWFS_UFS_CMD, p->newfs_data.newfs_ufs.softupdates ? "-U" : "",
p->newfs_data.newfs_ufs.ufs2 ? "-O2" : "-O1",
p->newfs_data.newfs_ufs.ufs1 ? "-O1" : "-O2",
p->newfs_data.newfs_ufs.user_options);
break;
case NEWFS_MSDOS:
@ -686,10 +686,10 @@ print_label_chunks(void)
switch (pi->newfs_type) {
case NEWFS_UFS:
strcpy(newfs, NEWFS_UFS_STRING);
if (pi->newfs_data.newfs_ufs.ufs2)
strcat(newfs, "2");
else
if (pi->newfs_data.newfs_ufs.ufs1)
strcat(newfs, "1");
else
strcat(newfs, "2");
if (pi->newfs_data.newfs_ufs.softupdates)
strcat(newfs, "+S");
else
@ -872,6 +872,21 @@ diskLabel(Device *dev)
clear_wins();
break;
case '1':
if (label_chunk_info[here].type == PART_FILESYSTEM) {
PartInfo *pi =
((PartInfo *)label_chunk_info[here].c->private_data);
if ((pi != NULL) &&
(pi->newfs_type == NEWFS_UFS)) {
pi->newfs_data.newfs_ufs.ufs1 = true;
} else
msg = MSG_NOT_APPLICABLE;
} else
msg = MSG_NOT_APPLICABLE;
break;
break;
case '2':
if (label_chunk_info[here].type == PART_FILESYSTEM) {
PartInfo *pi =
@ -879,8 +894,7 @@ diskLabel(Device *dev)
if ((pi != NULL) &&
(pi->newfs_type == NEWFS_UFS)) {
pi->newfs_data.newfs_ufs.ufs2 =
!pi->newfs_data.newfs_ufs.ufs2;
pi->newfs_data.newfs_ufs.ufs1 = false;
} else
msg = MSG_NOT_APPLICABLE;
} else

View File

@ -334,7 +334,7 @@ typedef struct _part_info {
Boolean acls; /* unused */
Boolean multilabel; /* unused */
Boolean softupdates;
Boolean ufs2;
Boolean ufs1;
} newfs_ufs;
struct {
/* unused */

View File

@ -126,16 +126,20 @@ with significant activity can temporarily overflow if the soft updates
policy results in free'd blocks not being "garbage collected" as fast
as they're being requested.
To make use of UFS2, press '2' on a UFS file system to toggle the
on-disk format revision. UFS2 provides native support for extended
attributes, larger disk sizes, and forward compatibility with new
on-disk high performance directory layout and storage extents.
However, UFS2 is unsupported on versions of FreeBSD prior to 5.0,
so it is not recommended for environments requiring backward
compatibility. Also, UFS2 is not currently recommended as a root
file system format for non-64-bit platforms due to increased size
of the boot loader; special local configuration is required to boot
UFS2 as a root file system on i386 and PC98.
The UNIX File System (UFS) on FreeBSD supports two different on-disk
layouts: UFS1 and UFS2. UFS1 was the default file system in use
through FreeBSD 5.0-RELEASE; as of FreeBSD 5.1-RELEASE, the default
is now UFS2. UFS2 provides sparse inode allocation (faster
fsck), 64-bit storage pointers (larger maximum size), and native
extended attributes (required for ACLs, MAC, and other advanced
security and file system services). The selection of UFS1 or
UFS2 must be made when the file system is created--later conversion
is not currently possible. UFS2 is the recommended file system, but
if disks are to be used on older FreeBSD systems, UFS1 improves
portability. When dual-booting between FreeBSD 4.x or earlier and
FreeBSD 5.x, UFS1 file systems will be accessible from both.
To toggle a file system to UFS1, press '1'. To restore it to UFS2,
press '2'.
To add additional flags to the newfs command line for UFS file
systems, press 'N'. These options will be specified before the

View File

@ -879,7 +879,7 @@ performNewfs(PartInfo *pi, char *dname, int queue)
snprintf(buffer, LINE_MAX, "%s %s %s %s %s",
NEWFS_UFS_CMD,
pi->newfs_data.newfs_ufs.softupdates ? "-U" : "",
pi->newfs_data.newfs_ufs.ufs2 ? "-O2" : "-O1",
pi->newfs_data.newfs_ufs.ufs1 ? "-O1" : "-O2",
pi->newfs_data.newfs_ufs.user_options,
dname);
break;

View File

@ -337,7 +337,7 @@ new_part(char *mpoint, Boolean newfs)
pi->newfs_data.newfs_ufs.acls = FALSE;
pi->newfs_data.newfs_ufs.multilabel = FALSE;
pi->newfs_data.newfs_ufs.softupdates = strcmp(mpoint, "/");
pi->newfs_data.newfs_ufs.ufs2 = FALSE;
pi->newfs_data.newfs_ufs.ufs1 = FALSE;
return pi;
}
@ -461,7 +461,7 @@ getNewfsCmd(PartInfo *p)
case NEWFS_UFS:
snprintf(buffer, NEWFS_CMD_ARGS_MAX, "%s %s %s %s",
NEWFS_UFS_CMD, p->newfs_data.newfs_ufs.softupdates ? "-U" : "",
p->newfs_data.newfs_ufs.ufs2 ? "-O2" : "-O1",
p->newfs_data.newfs_ufs.ufs1 ? "-O1" : "-O2",
p->newfs_data.newfs_ufs.user_options);
break;
case NEWFS_MSDOS:
@ -686,10 +686,10 @@ print_label_chunks(void)
switch (pi->newfs_type) {
case NEWFS_UFS:
strcpy(newfs, NEWFS_UFS_STRING);
if (pi->newfs_data.newfs_ufs.ufs2)
strcat(newfs, "2");
else
if (pi->newfs_data.newfs_ufs.ufs1)
strcat(newfs, "1");
else
strcat(newfs, "2");
if (pi->newfs_data.newfs_ufs.softupdates)
strcat(newfs, "+S");
else
@ -872,6 +872,21 @@ diskLabel(Device *dev)
clear_wins();
break;
case '1':
if (label_chunk_info[here].type == PART_FILESYSTEM) {
PartInfo *pi =
((PartInfo *)label_chunk_info[here].c->private_data);
if ((pi != NULL) &&
(pi->newfs_type == NEWFS_UFS)) {
pi->newfs_data.newfs_ufs.ufs1 = true;
} else
msg = MSG_NOT_APPLICABLE;
} else
msg = MSG_NOT_APPLICABLE;
break;
break;
case '2':
if (label_chunk_info[here].type == PART_FILESYSTEM) {
PartInfo *pi =
@ -879,8 +894,7 @@ diskLabel(Device *dev)
if ((pi != NULL) &&
(pi->newfs_type == NEWFS_UFS)) {
pi->newfs_data.newfs_ufs.ufs2 =
!pi->newfs_data.newfs_ufs.ufs2;
pi->newfs_data.newfs_ufs.ufs1 = false;
} else
msg = MSG_NOT_APPLICABLE;
} else

View File

@ -334,7 +334,7 @@ typedef struct _part_info {
Boolean acls; /* unused */
Boolean multilabel; /* unused */
Boolean softupdates;
Boolean ufs2;
Boolean ufs1;
} newfs_ufs;
struct {
/* unused */