Package: e2fsprogs
Version: 1.41.3-1

If I attempt to shrink an ext3 filesystem while mounted (even if
read-only) via "resize2fs /dev/hda1 8G", it refuses with:

"Filesystem at /dev/hda1 is mounted on /; on-line resizing required
On-line shrinking from $foo to $bar not supported."

I don't know if this is a necessary restriction or not, but it's pretty
annoying.  If it is safe to do when the fs is mounted read-only, it
would be nice if '-f' allowed one to bypass the check.  


Furthermore, if one boots into an initramfs (booting with 'break=mount')
in order to resize the filesystem, mounts /dev/hda1, copies resize2fs
and associated libs into the initramfs root, unmounts /dev/hda1, and
then attempts to shrink the filesystem, one gets:

"ext2fs_check_mount_point: No such file or directory while determining
whether /dev/hda1 is mounted."

Even using '-f' doesn't allow it to continue.  This is amazingly
unhelpful.  The code in lib/ext2fs/ismounted.c checks /proc/mounts for
the filesystem, doesn't find anything interesting, attempts to
check /etc/mtab (which doesn't exist because we're in an initramfs),
and returns ENOENT.

Please consider the following patch to allow the administrator to
override the failed mount point check using the -f option.  It would be
even better if that check could be made to not happen at all w/ -f (or
some other argument).





Subject: [PATCH] resize2fs: allow -f to override the filesystem mount check 
when it fails

When the fs mount check fails (due to /etc/mtab not being available,
for example), resize2fs is unusable.  This patch allows it to be
usable (effectively ignoring results of the mount check if it failed)
when -f is supplied by the user.

Signed-off-by: Andres Salomon <dilin...@debian.org>
---
 resize/main.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/resize/main.c b/resize/main.c
index 6977d84..9171550 100644
--- a/resize/main.c
+++ b/resize/main.c
@@ -247,6 +247,13 @@ int main (int argc, char ** argv)
                        com_err("ext2fs_check_mount_point", retval,
                                _("while determining whether %s is mounted."),
                                device_name);
+                       if (force) {
+                               printf(_("Ignoring failed mount check and "
+                                        "continuing, as -f was supplied.\n"));
+                               mount_flags = 0;
+                               free(mtpt);
+                               break;
+                       }
                        exit(1);
                }
                if (!(mount_flags & EXT2_MF_MOUNTED) || (mtpt[len-1] == 0))
-- 
1.5.6.5










-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to