diff options
author | phk <phk@FreeBSD.org> | 2007-12-16 19:41:31 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2007-12-16 19:41:31 +0000 |
commit | 8869357e615c78e3fd49cef030938ecad98ad0fb (patch) | |
tree | 50cd9188ad39d14622684bb1674d4d82c2da2a3d /sbin/newfs/mkfs.c | |
parent | f0debf860a7293c754e26563a772bdac6d9aa62f (diff) | |
download | FreeBSD-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/mkfs.c')
-rw-r--r-- | sbin/newfs/mkfs.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c index fe862b5..c4ddef3 100644 --- a/sbin/newfs/mkfs.c +++ b/sbin/newfs/mkfs.c @@ -448,6 +448,13 @@ mkfs(struct partition *pp, char *fsys) printf("\twith soft updates\n"); # undef B2MBFACTOR + if (Eflag && !Nflag) { + printf("Erasing blocks [%jd...%jd[\n", + sblock.fs_sblockloc / disk.d_bsize, + sblock.fs_size * sblock.fs_fsize / disk.d_bsize); + berase(&disk, sblock.fs_sblockloc / disk.d_bsize, + sblock.fs_size * sblock.fs_fsize - sblock.fs_sblockloc); + } /* * Wipe out old UFS1 superblock(s) if necessary. */ @@ -466,12 +473,12 @@ mkfs(struct partition *pp, char *fsys) } if (!Nflag) sbwrite(&disk, 0); - if (Eflag == 1) { - printf("** Exiting on Eflag 1\n"); + if (Xflag == 1) { + printf("** Exiting on Xflag 1\n"); exit(0); } - if (Eflag == 2) - printf("** Leaving BAD MAGIC on Eflag 2\n"); + if (Xflag == 2) + printf("** Leaving BAD MAGIC on Xflag 2\n"); else sblock.fs_magic = (Oflag != 1) ? FS_UFS2_MAGIC : FS_UFS1_MAGIC; @@ -529,8 +536,8 @@ mkfs(struct partition *pp, char *fsys) sblock.fs_old_cstotal.cs_nifree = sblock.fs_cstotal.cs_nifree; sblock.fs_old_cstotal.cs_nffree = sblock.fs_cstotal.cs_nffree; } - if (Eflag == 3) { - printf("** Exiting on Eflag 3\n"); + if (Xflag == 3) { + printf("** Exiting on Xflag 3\n"); exit(0); } if (!Nflag) |