]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
Require mke2fs -F -F for really dangerous operations
authorAndreas Dilger <adilger@clusterfs.com>
Sat, 5 Aug 2006 23:05:53 +0000 (19:05 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 5 Aug 2006 23:05:53 +0000 (19:05 -0400)
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 <adilger@clusterfs.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
misc/ChangeLog
misc/mke2fs.8.in
misc/mke2fs.c
misc/util.c

index d489bf1935ac781492eaea290bc02cf9ed1d72b3..9b3ccd1a10f023e11f3dfedf003f47f5774ce7ea 100644 (file)
@@ -1,5 +1,9 @@
 2006-08-05  Theodore Tso  <tytso@mit.edu>
 
+       * 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
 
 2006-07-15  Theodore Tso  <tytso@mit.edu>
index 390bb8885c3bd728b37edeefcb8075d6f22a164e..a3dc4a1cb5c9261cf2725f48967ca86cb9d479a5 100644 (file)
@@ -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
index 2686d72930f2fa524c03e6b038566626cf50cc31..677c5140a20aff3e8c3d411237c51edd5568e088 100644 (file)
@@ -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;
index d496c3e51f8a2f393ffc89650daab3c4a067d2cf..7cb952f89cefc1a79df158310239f845d3b5c278 100644 (file)
@@ -154,7 +154,7 @@ void check_mount(const char *device, int force, const char *type)
        }
        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 force, const char *type)
        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;
                }