On Thu, Jan 29, 2015 at 04:51:31PM +0800, Minfei Huang wrote:
The crash dump is saved in the /sysroot/crash directory, not the
/sysroot/var/crash in the atomic system.
We will find the mount point by the command "df", if the directory is
mounted. But it is different between atomic system. "df /var/crash"
shows the "/var" is a mounted directory, but the "/var" is not a
mounted
directory, for "df" command.
So add the filter to satisfy the mounted directory, that the mount point
will appear both "df" and "df $dir".
Signed-off-by: Minfei Huang <mhuang(a)redhat.com>
---
dracut-module-setup.sh | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index ff7a088..b23de97 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -318,7 +318,10 @@ default_dump_target_install_conf()
_mntpoint=$(get_mntpoint_from_path $_save_path)
_target=$(get_target_from_path $_save_path)
- if [ "$_mntpoint" != "/" ]; then
+ # if the mount directory does not appear by the df command,
+ # the directory is not a mount directory,
+ # although the _mntpoint is "/", specified to the Atomic
+ if [ "$_mntpoint" != "/" ] && [ `df | grep
"$_mntpoint" -q` ]; then
_fstype=$(get_fs_type_from_target $_target)
Minfei,
How about moving this extra logic in get_mntpoint_from_path()?
Also there might be another way to figure out if it is bind mount or not.
Use "findmnt". On atomic "findmnt /var" returns following.
bash-4.2# findmnt -k -n -r -o SOURCE /var
/dev/mapper/atomicos-root[/ostree/deploy/rhel-atomic-host/var]
Looks like first part is device and path inside brackets [] is path which
is source of bind mount. You should be able to look for [] and if these
are present you know mount point is bind mounted.
And we should explain there in a comment.
# We are looking to see if a part of dump path is mounted on some disk.
# But we don't want to look for bind mounted directories. By default
# df $path will show entries even if some part of path is bind mounted.
# Also run findmnt to figure out if part of the $path is actuallly bind
# mounted or real mount on some device.
Thanks
Vivek