summaryrefslogtreecommitdiffstats
path: root/sbin/newfs/newfs.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2007-12-16 19:41:31 +0000
committerphk <phk@FreeBSD.org>2007-12-16 19:41:31 +0000
commit8869357e615c78e3fd49cef030938ecad98ad0fb (patch)
tree50cd9188ad39d14622684bb1674d4d82c2da2a3d /sbin/newfs/newfs.c
parentf0debf860a7293c754e26563a772bdac6d9aa62f (diff)
downloadFreeBSD-src-8869357e615c78e3fd49cef030938ecad98ad0fb.zip
FreeBSD-src-8869357e615c78e3fd49cef030938ecad98ad0fb.tar.gz
Rename the undocumented -E option to -X.
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.
Diffstat (limited to 'sbin/newfs/newfs.c')
-rw-r--r--sbin/newfs/newfs.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c
index f69411c..d5fb66d 100644
--- a/sbin/newfs/newfs.c
+++ b/sbin/newfs/newfs.c
@@ -111,12 +111,13 @@ __FBSDID("$FreeBSD$");
*/
#define NFPI 4
+int Eflag; /* Erase previous disk contents */
int Lflag; /* add a volume label */
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 Eflag = 0; /* exit in middle of newfs for testing */
+int Xflag = 0; /* exit in middle of newfs for testing */
int Jflag; /* enable gjournal for file system */
int lflag; /* enable multilabel for file system */
int nflag; /* do not create .snap directory */
@@ -160,10 +161,10 @@ main(int argc, char *argv[])
reserved = 0;
while ((ch = getopt(argc, argv,
- "EJL:NO:RS:T:Ua:b:c:d:e:f:g:h:i:lm:no:r:s:")) != -1)
+ "EJL:NO:RS:T:UXa:b:c:d:e:f:g:h:i:lm:no:r:s:")) != -1)
switch (ch) {
case 'E':
- Eflag++;
+ Eflag = 1;
break;
case 'J':
Jflag = 1;
@@ -202,6 +203,9 @@ main(int argc, char *argv[])
case 'U':
Uflag = 1;
break;
+ case 'X':
+ Xflag++;
+ break;
case 'a':
if ((maxcontig = atoi(optarg)) <= 0)
errx(1, "%s: bad maximum contiguous blocks",
@@ -440,6 +444,7 @@ usage()
getprogname(),
" [device-type]");
fprintf(stderr, "where fsoptions are:\n");
+ fprintf(stderr, "\t-E Erase previuos disk content\n");
fprintf(stderr, "\t-J Enable journaling via gjournal\n");
fprintf(stderr, "\t-L volume label to add to superblock\n");
fprintf(stderr,
OpenPOWER on IntegriCloud