Re: [PATCH] 11/13 e2fsprogs-inuse_force - mke2fs -F safety
Theodore Tso <[email protected]> Sat, 5 Aug 2006 19:06:41 -0400
| Newsgroups | gmane.comp.file-systems.ext2.devel |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Aug 02, 2006 at 11:00:58AM -0600, Andreas Dilger wrote: > Disambiguate the use of "-F" (force) flag for mke2fs to avoid dangerous > situations. The use of -F is needed for regular backing files and > for filesystems on whole block devices. It should NOT be confused > with mke2fs on an apparently-mounted or in-use filesystem. Applied after I added a man page update to document this change. - Ted # HG changeset patch # User [email protected] # Date 1154819153 14400 # Node ID 6f76ca8e929f5698d94b7b7bfd4768442b29433c # Parent 1a8cf199f21a5191c98ad6ce9cdd7df0edd738e0 Require mke2fs -F -F for really dangerous operations Disambiguate the use of "-F" (force) flag for mke2fs to avoid dangerous situations. The use of -F is needed for regular backing files and for filesystems on whole block devices. It should NOT be confused with mke2fs on an apparently-mounted or in-use filesystem. Signed-off-by: Andreas Dilger <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]> diff -r 1a8cf199f21a -r 6f76ca8e929f misc/ChangeLog --- a/misc/ChangeLog Sat Aug 05 18:50:22 2006 -0400 +++ b/misc/ChangeLog Sat Aug 05 19:05:53 2006 -0400 @@ -1,4 +1,8 @@ 2006-08-05 Theodore Tso <[email protected] 2006-08-05 Theodore Tso <[email protected]> + + * mke2fs.c (PRS), util.c (check_mount): In order to force mke2fs + to create a filesystem even though it appears to be in use + or mounted, the -F (force) flag must be specified twice. * filefrag.c: Change EXT3_EXTENTS_FL to EXT4_EXTENTS_FL diff -r 1a8cf199f21a -r 6f76ca8e929f misc/mke2fs.8.in --- a/misc/mke2fs.8.in Sat Aug 05 18:50:22 2006 -0400 +++ b/misc/mke2fs.8.in Sat Aug 05 19:05:53 2006 -0400 @@ -195,8 +195,13 @@ Specify the size of fragments in bytes. .B \-F Force .B mke2fs -to run, even if the specified device is not a -block special device, or appears to be mounted. +to create a filesystem, even if the specified device is not a partition +on a block special device, or if other parameters do not make sense. +In order to force +.B mke2fs +to create a filesystem even if the filesystem appears to be in use +or is mounted (a truly dangerous thing to do), this option must be +specified twice. .TP .BI \-g " blocks-per-group" Specify the number of blocks in a block group. There is generally no diff -r 1a8cf199f21a -r 6f76ca8e929f misc/mke2fs.c --- a/misc/mke2fs.c Sat Aug 05 18:50:22 2006 -0400 +++ b/misc/mke2fs.c Sat Aug 05 19:05:53 2006 -0400 @@ -1089,7 +1089,7 @@ static void PRS(int argc, char *argv[]) verbose = 1; break; case 'F': - force = 1; + force++; break; case 'L': volume_label = optarg; diff -r 1a8cf199f21a -r 6f76ca8e929f misc/util.c --- a/misc/util.c Sat Aug 05 18:50:22 2006 -0400 +++ b/misc/util.c Sat Aug 05 19:05:53 2006 -0400 @@ -154,7 +154,7 @@ void check_mount(const char *device, int } if (mount_flags & EXT2_MF_MOUNTED) { fprintf(stderr, _("%s is mounted; "), device); - if (force) { + if (force > 2) { fputs(_("mke2fs forced anyway. Hope /etc/mtab is " "incorrect.\n"), stderr); return; @@ -166,7 +166,7 @@ void check_mount(const char *device, int if (mount_flags & EXT2_MF_BUSY) { fprintf(stderr, _("%s is apparently in use by the system; "), device); - if (force) { + if (force > 2) { fputs(_("mke2fs forced anyway.\n"), stderr); return; } ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV