aboutsummaryrefslogtreecommitdiff
path: root/sbin/newfs
diff options
context:
space:
mode:
authorKirk McKusick <mckusick@FreeBSD.org>2011-02-16 06:00:27 +0000
committerKirk McKusick <mckusick@FreeBSD.org>2011-02-16 06:00:27 +0000
commitd92f0739abeda759fa5952a267d898d553bab5dc (patch)
treedcddbe783d92a6e2a870905692891e4c4ff323ba /sbin/newfs
parent38d82872c695f20df064577744bccec3a764b54e (diff)
downloadsrc-d92f0739abeda759fa5952a267d898d553bab5dc.tar.gz
src-d92f0739abeda759fa5952a267d898d553bab5dc.zip
Add the -j option to enable soft updates journaling when creating
a new file system. Reviewed by: Kostik Belousov <kostikbel@gmail.com>
Notes
Notes: svn path=/head/; revision=218726
Diffstat (limited to 'sbin/newfs')
-rw-r--r--sbin/newfs/newfs.88
-rw-r--r--sbin/newfs/newfs.c13
2 files changed, 18 insertions, 3 deletions
diff --git a/sbin/newfs/newfs.8 b/sbin/newfs/newfs.8
index b542739a1990..9f2c4cbfabdd 100644
--- a/sbin/newfs/newfs.8
+++ b/sbin/newfs/newfs.8
@@ -36,7 +36,7 @@
.Nd construct a new UFS1/UFS2 file system
.Sh SYNOPSIS
.Nm
-.Op Fl EJNUlnt
+.Op Fl EJNUjlnt
.Op Fl L Ar volname
.Op Fl O Ar filesystem-type
.Op Fl S Ar sector-size
@@ -157,6 +157,12 @@ 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.
+.It Fl j
+Enable soft updates journaling on the new file system.
+This flag is implemented by running the
+.Xr tunefs 8
+utility found in the user's
+.Dv $PATH .
.It Fl l
Enable multilabel MAC on the new file system.
.It Fl m Ar free-space
diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c
index 0e5b7daa72f0..61637749c212 100644
--- a/sbin/newfs/newfs.c
+++ b/sbin/newfs/newfs.c
@@ -87,6 +87,7 @@ int Nflag; /* run without writing file system */
int Oflag = 2; /* file system format (1 => UFS1, 2 => UFS2) */
int Rflag; /* regression test */
int Uflag; /* enable soft updates for file system */
+int jflag; /* enable soft updates journaling for filesys */
int Xflag = 0; /* exit in middle of newfs for testing */
int Jflag; /* enable gjournal for file system */
int lflag; /* enable multilabel for file system */
@@ -140,7 +141,7 @@ main(int argc, char *argv[])
part_name = 'c';
reserved = 0;
while ((ch = getopt(argc, argv,
- "EJL:NO:RS:T:UXa:b:c:d:e:f:g:h:i:lm:no:p:r:s:t")) != -1)
+ "EJL:NO:RS:T:UXa:b:c:d:e:f:g:h:i:jlm:no:p:r:s:t")) != -1)
switch (ch) {
case 'E':
Eflag = 1;
@@ -180,6 +181,9 @@ main(int argc, char *argv[])
case 'T':
disktype = optarg;
break;
+ case 'j':
+ jflag = 1;
+ /* fall through to enable soft updates */
case 'U':
Uflag = 1;
break;
@@ -397,7 +401,11 @@ main(int argc, char *argv[])
rewritelabel(special, lp);
}
ufs_disk_close(&disk);
- exit(0);
+ if (!jflag)
+ exit(0);
+ if (execlp("tunefs", "newfs", "-j", "enable", special, NULL) < 0)
+ err(1, "Cannot enable soft updates journaling, tunefs");
+ /* NOT REACHED */
}
void
@@ -492,6 +500,7 @@ usage()
fprintf(stderr, "\t-g average file size\n");
fprintf(stderr, "\t-h average files per directory\n");
fprintf(stderr, "\t-i number of bytes per inode\n");
+ fprintf(stderr, "\t-j enable soft updates journaling\n");
fprintf(stderr, "\t-l enable multilabel MAC\n");
fprintf(stderr, "\t-n do not create .snap directory\n");
fprintf(stderr, "\t-m minimum free space %%\n");