I need to resize2fs
the root partition of an embedded device. Since it doesn't have an alternate boot option, I used an tmpfs
, moved and restated everything until I finally was able to umount /dev/mmcblk0p1
. But bad luck:
$ umount /dev/mmcblk0p1
umount: /dev/mmcblk0p1: not mounted
$ resize2fs /dev/mmcblk0p1
resize2fs 1.42.12 (29-Aug-2014)
resize2fs: Device or resource busy while trying to open /dev/mmcblk0p1
Couldn't find valid filesystem superblock.
$ fsck /dev/mmcblk0p1
fsck from util-linux 2.25.2
e2fsck 1.42.12 (29-Aug-2014)
/dev/mmcblk0p1 is in use.
e2fsck: Cannot continue, aborting.
Strange! A busy unmounted file system. It seems to me, that the journal still has it's hands on the device:
root 112 0.0 0.0 0 0 ? S 14:13 0:00 [jbd2/mmcblk0p1-]
Turn journaling off, you say? Here comes the hen-and-egg-game:
$ tune2fs -O ^has_journal /dev/mmcblk0p1
tune2fs 1.42.12 (29-Aug-2014)
The needs_recovery flag is set. Please run e2fsck before clearing
the has_journal flag.
So how to stop that? It's still running in rescue mode, can't be kill -9
ed. How to get rid of it?
(I'm on Debian Jessie)
umount /dev/foo
is not how the underlying system call works. Myself I would useumount /path/to/mount
. I would find your question somewhat clearer if you did so instead. For example it would prove that you had usedpivot_root
to pivot your rootfs where it can be unmounted, as opposed tochroot
ing into the tmpfs, which would still leave the rootfs underneath and unable to be unmounted./path/to/mount
to unmount it, thisumount /dev/mmcblk0p1
was just to clarify that this file system is not mounted somewhere else./proc/self/mountinfo
show? I wonder if you can pinky-swear you're not using mount namespaces... see here for suggestions on how to find and inspect other mount namespaces. It assumes you are in the initial PID namespace, i.e. you're not running inside a sandbox where you can't see all the processes on the system.