The kdump will dump the core in incorrect target directory /sysroot/crash, if the target is bind mounted.
The /var is bind mounted in Atomic, kdump will dump the core in /sysroot/crash, instead of /var/crash, if we specifies the value "path /var/crash" in the /etc/kdump.conf.
To correct dumping target, we can construct the real dumping path, which contains two part, one bind mounted path, the other specified dump target.
Following is an example:
-bash-4.2# cat /etc/kdump.conf | grep ^path path /var/crash
-bash-4.2# findmnt /var | tail -n 1 | awk '{print $2}' /dev/mapper/atomicos-root[/ostree/deploy/rhel-atomic-host/var]
-bash-4.2# findmnt -v /var | tail -n 1 | awk '{print $2}' /dev/mapper/atomicos-root
Then we can found it that the real path of dumping core is /ostree/deploy/rhel-atomic-host/var/crash.
Signed-off-by: Minfei Huang mhuang@redhat.com --- dracut-module-setup.sh | 29 +++++++++++++++++++---------- kdump-lib.sh | 32 ++++++++++++++++++++++++++++++++ mkdumprd | 4 +--- 3 files changed, 52 insertions(+), 13 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index ff7a088..b7ef56d 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -304,10 +304,19 @@ kdump_install_net() { fi }
+adjust_dump_target() +{ + local _fstype=$1 _target=$2 _path=$3 + echo "$_fstype $_target" >> /tmp/$$-kdump.conf + + #erase the old path line, then insert the parsed path + sed -i "/^path/d" /tmp/$$-kdump.conf + echo "path $_path" >> /tmp/$$-kdump.conf +} + default_dump_target_install_conf() { local _target _fstype - local _s _t local _mntpoint local _path _save_path
@@ -318,25 +327,25 @@ default_dump_target_install_conf()
_mntpoint=$(get_mntpoint_from_path $_save_path) _target=$(get_target_from_path $_save_path) - if [ "$_mntpoint" != "/" ]; then - _fstype=$(get_fs_type_from_target $_target) + _fstype=$(get_fs_type_from_target $_target)
+ if is_bind_mount $_mntpoint; then + _path=${_save_path##"$_mntpoint"} + # the real dump path in the 2nd kernel, if the mount point is bind mounted. + _path=$(get_bind_mount_directory $_mntpoint)/$_path + + adjust_dump_target $_fstype $_target $_path + elif [ "$_mntpoint" != "/" ]; then if $(is_fs_type_nfs $_fstype); then kdump_install_net "$_target" _fstype="nfs" else _target=$(kdump_to_udev_name $_target) fi - - echo "$_fstype $_target" >> /tmp/$$-kdump.conf - _path=${_save_path##"$_mntpoint"}
- #erase the old path line, then insert the parsed path - sed -i "/^path/d" /tmp/$$-kdump.conf - echo "path $_path" >> /tmp/$$-kdump.conf + adjust_dump_target $_fstype $_target $_path fi - }
#install kdump.conf and what user specifies in kdump.conf diff --git a/kdump-lib.sh b/kdump-lib.sh index f24f08d..d8a547a 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -86,6 +86,38 @@ get_root_fs_device() return }
+# findmnt uses the option "-v, --nofsroot" to exclusive the [/dir] +# in the SOURCE column for bind-mounts, then if $_mntpoint equals to +# $_mntpoint_nofsroot, the mountpoint is not bind mounted directory. +is_bind_mount() +{ + local _mntpoint=$(findmnt $1 | tail -n 1 | awk '{print $2}') + local _mntpoint_nofsroot=$(findmnt -v $1 | tail -n 1 | awk '{print $2}') + + if [[ $_mntpoint = $_mntpoint_nofsroot ]]; then + return 1 + else + return 0 + fi +} + +# the value of $_mntpoint will be +# /dev/mapper/atomicos-root[/ostree/deploy/rhel-atomic-host/var], if the +# directory is bind mounted. The former part represents the device path, rest +# part is the bind mounted directory which quotes by bracket "[]". +get_bind_mount_directory() +{ + local _mntpoint=$(findmnt $1 | tail -n 1 | awk '{print $2}') + local _mntpoint_nofsroot=$(findmnt -v $1 | tail -n 1 | awk '{print $2}') + + _mntpoint=${_mntpoint##$_mntpoint_nofsroot} + + _mntpoint=${_mntpoint#[} + _mntpoint=${_mntpoint%]} + + echo $_mntpoint +} + get_mntpoint_from_path() { echo $(df $1 | tail -1 | awk '{print $NF}') diff --git a/mkdumprd b/mkdumprd index 4d251ba..951eb6d 100644 --- a/mkdumprd +++ b/mkdumprd @@ -201,8 +201,7 @@ mkdir_save_path_ssh() #Function: get_fs_size #$1=dump target get_fs_size() { - local _mnt=$(to_mount_point $1) - echo -n $(df -P "${_mnt}/$SAVE_PATH"|tail -1|awk '{print $4}') + echo -n $(df -P "$SAVE_PATH"|tail -1|awk '{print $4}') }
#Function: get_raw_size @@ -364,7 +363,6 @@ handle_default_dump_target() _mntpoint=$(get_mntpoint_from_path $SAVE_PATH) _target=$(get_target_from_path $SAVE_PATH) if [ "$_mntpoint" != "/" ]; then - SAVE_PATH=${SAVE_PATH##"$_mntpoint"} _fstype=$(get_fs_type_from_target $_target)
if $(is_fs_type_nfs $_fstype); then
Minfei
The patch seems conflicts with Bao's patch for cleaning up /tmp/ files.
BTW, what's the difference between this version and the previous version?
On 02/16/15 at 06:03pm, Minfei Huang wrote:
The kdump will dump the core in incorrect target directory /sysroot/crash, if the target is bind mounted.
The /var is bind mounted in Atomic, kdump will dump the core in /sysroot/crash, instead of /var/crash, if we specifies the value "path /var/crash" in the /etc/kdump.conf.
To correct dumping target, we can construct the real dumping path, which contains two part, one bind mounted path, the other specified dump target.
Following is an example:
-bash-4.2# cat /etc/kdump.conf | grep ^path path /var/crash -bash-4.2# findmnt /var | tail -n 1 | awk '{print $2}' /dev/mapper/atomicos-root[/ostree/deploy/rhel-atomic-host/var] -bash-4.2# findmnt -v /var | tail -n 1 | awk '{print $2}' /dev/mapper/atomicos-root
There's no real dumping path for bind mount as we discussed in previous thread, right?
BTW btrfs subvolumes also use [] in findmnt output, how to differenciate them?
I'm thinking we can do nothing for bind mount, we probably can only fix things case by case..
Then we can found it that the real path of dumping core is /ostree/deploy/rhel-atomic-host/var/crash.
Signed-off-by: Minfei Huang mhuang@redhat.com
dracut-module-setup.sh | 29 +++++++++++++++++++---------- kdump-lib.sh | 32 ++++++++++++++++++++++++++++++++ mkdumprd | 4 +--- 3 files changed, 52 insertions(+), 13 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index ff7a088..b7ef56d 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -304,10 +304,19 @@ kdump_install_net() { fi }
+adjust_dump_target() +{
- local _fstype=$1 _target=$2 _path=$3
- echo "$_fstype $_target" >> /tmp/$$-kdump.conf
- #erase the old path line, then insert the parsed path
- sed -i "/^path/d" /tmp/$$-kdump.conf
- echo "path $_path" >> /tmp/$$-kdump.conf
+}
default_dump_target_install_conf() { local _target _fstype
- local _s _t local _mntpoint local _path _save_path
@@ -318,25 +327,25 @@ default_dump_target_install_conf()
_mntpoint=$(get_mntpoint_from_path $_save_path) _target=$(get_target_from_path $_save_path)
- if [ "$_mntpoint" != "/" ]; then
_fstype=$(get_fs_type_from_target $_target)
_fstype=$(get_fs_type_from_target $_target)
if is_bind_mount $_mntpoint; then
_path=${_save_path##"$_mntpoint"}
# the real dump path in the 2nd kernel, if the mount point is bind mounted.
_path=$(get_bind_mount_directory $_mntpoint)/$_path
adjust_dump_target $_fstype $_target $_path
elif [ "$_mntpoint" != "/" ]; then if $(is_fs_type_nfs $_fstype); then kdump_install_net "$_target" _fstype="nfs" else _target=$(kdump_to_udev_name $_target) fi
echo "$_fstype $_target" >> /tmp/$$-kdump.conf
_path=${_save_path##"$_mntpoint"}
#erase the old path line, then insert the parsed path
sed -i "/^path/d" /tmp/$$-kdump.conf
echo "path $_path" >> /tmp/$$-kdump.conf
fiadjust_dump_target $_fstype $_target $_path
}
#install kdump.conf and what user specifies in kdump.conf diff --git a/kdump-lib.sh b/kdump-lib.sh index f24f08d..d8a547a 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -86,6 +86,38 @@ get_root_fs_device() return }
+# findmnt uses the option "-v, --nofsroot" to exclusive the [/dir] +# in the SOURCE column for bind-mounts, then if $_mntpoint equals to +# $_mntpoint_nofsroot, the mountpoint is not bind mounted directory. +is_bind_mount() +{
- local _mntpoint=$(findmnt $1 | tail -n 1 | awk '{print $2}')
- local _mntpoint_nofsroot=$(findmnt -v $1 | tail -n 1 | awk '{print $2}')
- if [[ $_mntpoint = $_mntpoint_nofsroot ]]; then
return 1
- else
return 0
- fi
+}
+# the value of $_mntpoint will be +# /dev/mapper/atomicos-root[/ostree/deploy/rhel-atomic-host/var], if the +# directory is bind mounted. The former part represents the device path, rest +# part is the bind mounted directory which quotes by bracket "[]". +get_bind_mount_directory() +{
- local _mntpoint=$(findmnt $1 | tail -n 1 | awk '{print $2}')
- local _mntpoint_nofsroot=$(findmnt -v $1 | tail -n 1 | awk '{print $2}')
- _mntpoint=${_mntpoint##$_mntpoint_nofsroot}
- _mntpoint=${_mntpoint#[}
- _mntpoint=${_mntpoint%]}
- echo $_mntpoint
+}
get_mntpoint_from_path() { echo $(df $1 | tail -1 | awk '{print $NF}') diff --git a/mkdumprd b/mkdumprd index 4d251ba..951eb6d 100644 --- a/mkdumprd +++ b/mkdumprd @@ -201,8 +201,7 @@ mkdir_save_path_ssh() #Function: get_fs_size #$1=dump target get_fs_size() {
- local _mnt=$(to_mount_point $1)
- echo -n $(df -P "${_mnt}/$SAVE_PATH"|tail -1|awk '{print $4}')
- echo -n $(df -P "$SAVE_PATH"|tail -1|awk '{print $4}')
}
#Function: get_raw_size @@ -364,7 +363,6 @@ handle_default_dump_target() _mntpoint=$(get_mntpoint_from_path $SAVE_PATH) _target=$(get_target_from_path $SAVE_PATH) if [ "$_mntpoint" != "/" ]; then
SAVE_PATH=${SAVE_PATH##"$_mntpoint"} _fstype=$(get_fs_type_from_target $_target) if $(is_fs_type_nfs $_fstype); then
-- 2.2.2
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On 02/25/15 at 02:25pm, Dave Young wrote:
Minfei
The patch seems conflicts with Bao's patch for cleaning up /tmp/ files.
Hi, Dave!
yes. I will add the prefix "${initdir}" to the "/tmp/".
BTW, what's the difference between this version and the previous version?
On 02/16/15 at 06:03pm, Minfei Huang wrote:
The kdump will dump the core in incorrect target directory /sysroot/crash, if the target is bind mounted.
The /var is bind mounted in Atomic, kdump will dump the core in /sysroot/crash, instead of /var/crash, if we specifies the value "path /var/crash" in the /etc/kdump.conf.
To correct dumping target, we can construct the real dumping path, which contains two part, one bind mounted path, the other specified dump target.
Following is an example:
-bash-4.2# cat /etc/kdump.conf | grep ^path path /var/crash -bash-4.2# findmnt /var | tail -n 1 | awk '{print $2}' /dev/mapper/atomicos-root[/ostree/deploy/rhel-atomic-host/var] -bash-4.2# findmnt -v /var | tail -n 1 | awk '{print $2}' /dev/mapper/atomicos-root
There's no real dumping path for bind mount as we discussed in previous thread, right?
We can construct the real dump path for the bind mounted, using findmnt. As the above comment, we can identify the bind mount directory by using findmnt command.
BTW btrfs subvolumes also use [] in findmnt output, how to differenciate them?
For now, I don't test the btrfs.
Thanks Minfei
I'm thinking we can do nothing for bind mount, we probably can only fix things case by case..
Then we can found it that the real path of dumping core is /ostree/deploy/rhel-atomic-host/var/crash.
Signed-off-by: Minfei Huang mhuang@redhat.com
dracut-module-setup.sh | 29 +++++++++++++++++++---------- kdump-lib.sh | 32 ++++++++++++++++++++++++++++++++ mkdumprd | 4 +--- 3 files changed, 52 insertions(+), 13 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index ff7a088..b7ef56d 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -304,10 +304,19 @@ kdump_install_net() { fi }
+adjust_dump_target() +{
- local _fstype=$1 _target=$2 _path=$3
- echo "$_fstype $_target" >> /tmp/$$-kdump.conf
- #erase the old path line, then insert the parsed path
- sed -i "/^path/d" /tmp/$$-kdump.conf
- echo "path $_path" >> /tmp/$$-kdump.conf
+}
default_dump_target_install_conf() { local _target _fstype
- local _s _t local _mntpoint local _path _save_path
@@ -318,25 +327,25 @@ default_dump_target_install_conf()
_mntpoint=$(get_mntpoint_from_path $_save_path) _target=$(get_target_from_path $_save_path)
- if [ "$_mntpoint" != "/" ]; then
_fstype=$(get_fs_type_from_target $_target)
_fstype=$(get_fs_type_from_target $_target)
if is_bind_mount $_mntpoint; then
_path=${_save_path##"$_mntpoint"}
# the real dump path in the 2nd kernel, if the mount point is bind mounted.
_path=$(get_bind_mount_directory $_mntpoint)/$_path
adjust_dump_target $_fstype $_target $_path
elif [ "$_mntpoint" != "/" ]; then if $(is_fs_type_nfs $_fstype); then kdump_install_net "$_target" _fstype="nfs" else _target=$(kdump_to_udev_name $_target) fi
echo "$_fstype $_target" >> /tmp/$$-kdump.conf
_path=${_save_path##"$_mntpoint"}
#erase the old path line, then insert the parsed path
sed -i "/^path/d" /tmp/$$-kdump.conf
echo "path $_path" >> /tmp/$$-kdump.conf
fiadjust_dump_target $_fstype $_target $_path
}
#install kdump.conf and what user specifies in kdump.conf diff --git a/kdump-lib.sh b/kdump-lib.sh index f24f08d..d8a547a 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -86,6 +86,38 @@ get_root_fs_device() return }
+# findmnt uses the option "-v, --nofsroot" to exclusive the [/dir] +# in the SOURCE column for bind-mounts, then if $_mntpoint equals to +# $_mntpoint_nofsroot, the mountpoint is not bind mounted directory. +is_bind_mount() +{
- local _mntpoint=$(findmnt $1 | tail -n 1 | awk '{print $2}')
- local _mntpoint_nofsroot=$(findmnt -v $1 | tail -n 1 | awk '{print $2}')
- if [[ $_mntpoint = $_mntpoint_nofsroot ]]; then
return 1
- else
return 0
- fi
+}
+# the value of $_mntpoint will be +# /dev/mapper/atomicos-root[/ostree/deploy/rhel-atomic-host/var], if the +# directory is bind mounted. The former part represents the device path, rest +# part is the bind mounted directory which quotes by bracket "[]". +get_bind_mount_directory() +{
- local _mntpoint=$(findmnt $1 | tail -n 1 | awk '{print $2}')
- local _mntpoint_nofsroot=$(findmnt -v $1 | tail -n 1 | awk '{print $2}')
- _mntpoint=${_mntpoint##$_mntpoint_nofsroot}
- _mntpoint=${_mntpoint#[}
- _mntpoint=${_mntpoint%]}
- echo $_mntpoint
+}
get_mntpoint_from_path() { echo $(df $1 | tail -1 | awk '{print $NF}') diff --git a/mkdumprd b/mkdumprd index 4d251ba..951eb6d 100644 --- a/mkdumprd +++ b/mkdumprd @@ -201,8 +201,7 @@ mkdir_save_path_ssh() #Function: get_fs_size #$1=dump target get_fs_size() {
- local _mnt=$(to_mount_point $1)
- echo -n $(df -P "${_mnt}/$SAVE_PATH"|tail -1|awk '{print $4}')
- echo -n $(df -P "$SAVE_PATH"|tail -1|awk '{print $4}')
}
#Function: get_raw_size @@ -364,7 +363,6 @@ handle_default_dump_target() _mntpoint=$(get_mntpoint_from_path $SAVE_PATH) _target=$(get_target_from_path $SAVE_PATH) if [ "$_mntpoint" != "/" ]; then
SAVE_PATH=${SAVE_PATH##"$_mntpoint"} _fstype=$(get_fs_type_from_target $_target) if $(is_fs_type_nfs $_fstype); then
-- 2.2.2
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On 02/25/15 at 03:10pm, Minfei Huang wrote:
On 02/25/15 at 02:25pm, Dave Young wrote:
Minfei
The patch seems conflicts with Bao's patch for cleaning up /tmp/ files.
Hi, Dave!
yes. I will add the prefix "${initdir}" to the "/tmp/".
I have merged the /tmp patch, you can pull the latest code and repost on top of it.
BTW, what's the difference between this version and the previous version?
On 02/16/15 at 06:03pm, Minfei Huang wrote:
The kdump will dump the core in incorrect target directory /sysroot/crash, if the target is bind mounted.
The /var is bind mounted in Atomic, kdump will dump the core in /sysroot/crash, instead of /var/crash, if we specifies the value "path /var/crash" in the /etc/kdump.conf.
To correct dumping target, we can construct the real dumping path, which contains two part, one bind mounted path, the other specified dump target.
Following is an example:
-bash-4.2# cat /etc/kdump.conf | grep ^path path /var/crash -bash-4.2# findmnt /var | tail -n 1 | awk '{print $2}' /dev/mapper/atomicos-root[/ostree/deploy/rhel-atomic-host/var] -bash-4.2# findmnt -v /var | tail -n 1 | awk '{print $2}' /dev/mapper/atomicos-root
There's no real dumping path for bind mount as we discussed in previous thread, right?
We can construct the real dump path for the bind mounted, using findmnt. As the above comment, we can identify the bind mount directory by using findmnt command.
BTW btrfs subvolumes also use [] in findmnt output, how to differenciate them?
For now, I don't test the btrfs.
It will be better to check btrfs. For now I think this patch is good. 2 things need be carefully tested, 1st is recursively bind mount, 2nd is btrfs. If it doesn't break current code in above 2 cases, I would like to ack it.
Thanks Minfei
I'm thinking we can do nothing for bind mount, we probably can only fix things case by case..
Hi, Minfei
-bash-4.2# findmnt -v /var | tail -n 1 | awk '{print $2}' /dev/mapper/atomicos-root
There's no real dumping path for bind mount as we discussed in previous thread, right?
We can construct the real dump path for the bind mounted, using findmnt. As the above comment, we can identify the bind mount directory by using findmnt command.
No, it did not answer my question, As Karel said for bind mount is same as non-bind mount, see below the original source can be unmounted while the later bind mount still exist:
[dyoung@dhcp-xx-xx dyoung]# mount /dev/sda7 /mnt/sda7 [dyoung@dhcp-xx-xx dyoung]# ls /mnt/sda7 bin dev home lib64 media opt dyoung sbin sys usr boot etc lib lost+found mnt proc run srv tmp var [dyoung@dhcp-xx-xx dyoung]# ls /mnt/sda7/var adm db games lock mail named rwho state www cache empty lib log man run spool tmp yp [dyoung@dhcp-xx-xx dyoung]# mount -o bind /mnt/sda7/var tmp [dyoung@dhcp-xx-xx dyoung]# ls tmp adm db games lock mail named rwho state www cache empty lib log man run spool tmp yp [dyoung@dhcp-xx-xx dyoung]# umount /mnt/sda7 [dyoung@dhcp-xx-xx dyoung]# ls tmp adm db games lock mail named rwho state www cache empty lib log man run spool tmp yp
BTW btrfs subvolumes also use [] in findmnt output, how to differenciate them?
For now, I don't test the btrfs.
btrfs is supported so we it need be taken care
Thanks Dave
On 02/26/15 at 10:49am, Dave Young wrote:
Hi, Minfei
-bash-4.2# findmnt -v /var | tail -n 1 | awk '{print $2}' /dev/mapper/atomicos-root
There's no real dumping path for bind mount as we discussed in previous thread, right?
We can construct the real dump path for the bind mounted, using findmnt. As the above comment, we can identify the bind mount directory by using findmnt command.
No, it did not answer my question, As Karel said for bind mount is same as non-bind mount, see below the original source can be unmounted while the later bind mount still exist:
[dyoung@dhcp-xx-xx dyoung]# mount /dev/sda7 /mnt/sda7 [dyoung@dhcp-xx-xx dyoung]# ls /mnt/sda7 bin dev home lib64 media opt dyoung sbin sys usr boot etc lib lost+found mnt proc run srv tmp var [dyoung@dhcp-xx-xx dyoung]# ls /mnt/sda7/var adm db games lock mail named rwho state www cache empty lib log man run spool tmp yp [dyoung@dhcp-xx-xx dyoung]# mount -o bind /mnt/sda7/var tmp [dyoung@dhcp-xx-xx dyoung]# ls tmp adm db games lock mail named rwho state www cache empty lib log man run spool tmp yp [dyoung@dhcp-xx-xx dyoung]# umount /mnt/sda7 [dyoung@dhcp-xx-xx dyoung]# ls tmp adm db games lock mail named rwho state www cache empty lib log man run spool tmp yp
Hi, Dave!
Yes, but we can use the findmnt to recognize the directory is bind mounted or not, if the filesystem is not the btrfs.
In your case, we can find the fact that real path of tmp directory is /dev/sda7[/var]. So we can dump core to the /dev/sda7[/var], if the target is tmp.
The kdump's manner will be always correct, although the directory is bind mounted.
Thanks Minfei
BTW btrfs subvolumes also use [] in findmnt output, how to differenciate them?
For now, I don't test the btrfs.
btrfs is supported so we it need be taken care
Thanks Dave
On 02/26/15 at 11:02am, Minfei Huang wrote:
On 02/26/15 at 10:49am, Dave Young wrote:
Hi, Minfei
-bash-4.2# findmnt -v /var | tail -n 1 | awk '{print $2}' /dev/mapper/atomicos-root
There's no real dumping path for bind mount as we discussed in previous thread, right?
We can construct the real dump path for the bind mounted, using findmnt. As the above comment, we can identify the bind mount directory by using findmnt command.
No, it did not answer my question, As Karel said for bind mount is same as non-bind mount, see below the original source can be unmounted while the later bind mount still exist:
[dyoung@dhcp-xx-xx dyoung]# mount /dev/sda7 /mnt/sda7 [dyoung@dhcp-xx-xx dyoung]# ls /mnt/sda7 bin dev home lib64 media opt dyoung sbin sys usr boot etc lib lost+found mnt proc run srv tmp var [dyoung@dhcp-xx-xx dyoung]# ls /mnt/sda7/var adm db games lock mail named rwho state www cache empty lib log man run spool tmp yp [dyoung@dhcp-xx-xx dyoung]# mount -o bind /mnt/sda7/var tmp [dyoung@dhcp-xx-xx dyoung]# ls tmp adm db games lock mail named rwho state www cache empty lib log man run spool tmp yp [dyoung@dhcp-xx-xx dyoung]# umount /mnt/sda7 [dyoung@dhcp-xx-xx dyoung]# ls tmp adm db games lock mail named rwho state www cache empty lib log man run spool tmp yp
Hi, Dave!
Yes, but we can use the findmnt to recognize the directory is bind mounted or not, if the filesystem is not the btrfs.
In your case, we can find the fact that real path of tmp directory is /dev/sda7[/var]. So we can dump core to the /dev/sda7[/var], if the target is tmp.
Yeah, it looks reasonable for now.
I suggest you have a check on btrfs. Find a kvm guest and add a disk, then make btrfs on that. It's easy to check if btrfs is special.
The kdump's manner will be always correct, although the directory is bind mounted.
Thanks Minfei
On 02/26/15 at 11:17am, Baoquan He wrote:
On 02/26/15 at 11:02am, Minfei Huang wrote:
On 02/26/15 at 10:49am, Dave Young wrote:
Hi, Minfei
-bash-4.2# findmnt -v /var | tail -n 1 | awk '{print $2}' /dev/mapper/atomicos-root
There's no real dumping path for bind mount as we discussed in previous thread, right?
We can construct the real dump path for the bind mounted, using findmnt. As the above comment, we can identify the bind mount directory by using findmnt command.
No, it did not answer my question, As Karel said for bind mount is same as non-bind mount, see below the original source can be unmounted while the later bind mount still exist:
[dyoung@dhcp-xx-xx dyoung]# mount /dev/sda7 /mnt/sda7 [dyoung@dhcp-xx-xx dyoung]# ls /mnt/sda7 bin dev home lib64 media opt dyoung sbin sys usr boot etc lib lost+found mnt proc run srv tmp var [dyoung@dhcp-xx-xx dyoung]# ls /mnt/sda7/var adm db games lock mail named rwho state www cache empty lib log man run spool tmp yp [dyoung@dhcp-xx-xx dyoung]# mount -o bind /mnt/sda7/var tmp [dyoung@dhcp-xx-xx dyoung]# ls tmp adm db games lock mail named rwho state www cache empty lib log man run spool tmp yp [dyoung@dhcp-xx-xx dyoung]# umount /mnt/sda7 [dyoung@dhcp-xx-xx dyoung]# ls tmp adm db games lock mail named rwho state www cache empty lib log man run spool tmp yp
Hi, Dave!
Yes, but we can use the findmnt to recognize the directory is bind mounted or not, if the filesystem is not the btrfs.
In your case, we can find the fact that real path of tmp directory is /dev/sda7[/var]. So we can dump core to the /dev/sda7[/var], if the target is tmp.
Yeah, it looks reasonable for now.
I suggest you have a check on btrfs. Find a kvm guest and add a disk, then make btrfs on that. It's easy to check if btrfs is special.
Agreed! The testing is still in process.
Thanks Minfei
The kdump's manner will be always correct, although the directory is bind mounted.
Thanks Minfei
On 02/26/15 at 11:02am, Minfei Huang wrote:
On 02/26/15 at 10:49am, Dave Young wrote:
Hi, Minfei
-bash-4.2# findmnt -v /var | tail -n 1 | awk '{print $2}' /dev/mapper/atomicos-root
There's no real dumping path for bind mount as we discussed in previous thread, right?
We can construct the real dump path for the bind mounted, using findmnt. As the above comment, we can identify the bind mount directory by using findmnt command.
No, it did not answer my question, As Karel said for bind mount is same as non-bind mount, see below the original source can be unmounted while the later bind mount still exist:
[dyoung@dhcp-xx-xx dyoung]# mount /dev/sda7 /mnt/sda7 [dyoung@dhcp-xx-xx dyoung]# ls /mnt/sda7 bin dev home lib64 media opt dyoung sbin sys usr boot etc lib lost+found mnt proc run srv tmp var [dyoung@dhcp-xx-xx dyoung]# ls /mnt/sda7/var adm db games lock mail named rwho state www cache empty lib log man run spool tmp yp [dyoung@dhcp-xx-xx dyoung]# mount -o bind /mnt/sda7/var tmp [dyoung@dhcp-xx-xx dyoung]# ls tmp adm db games lock mail named rwho state www cache empty lib log man run spool tmp yp [dyoung@dhcp-xx-xx dyoung]# umount /mnt/sda7 [dyoung@dhcp-xx-xx dyoung]# ls tmp adm db games lock mail named rwho state www cache empty lib log man run spool tmp yp
Hi, Dave!
Yes, but we can use the findmnt to recognize the directory is bind mounted or not, if the filesystem is not the btrfs.
In your case, we can find the fact that real path of tmp directory is /dev/sda7[/var]. So we can dump core to the /dev/sda7[/var], if the target is tmp.
The kdump's manner will be always correct, although the directory is bind mounted.
How did findmnt know this is a bindmnt, is it stable? OTOH, we need consider more cases, such as non-root case I believe you tested on atomic host. Have you tested normal bind mount test case, dump to root, dump to non root, nfs, etc.?
Thanks Dave
On 02/26/15 at 11:23am, Dave Young wrote:
On 02/26/15 at 11:02am, Minfei Huang wrote:
On 02/26/15 at 10:49am, Dave Young wrote:
Hi, Minfei
-bash-4.2# findmnt -v /var | tail -n 1 | awk '{print $2}' /dev/mapper/atomicos-root
There's no real dumping path for bind mount as we discussed in previous thread, right?
We can construct the real dump path for the bind mounted, using findmnt. As the above comment, we can identify the bind mount directory by using findmnt command.
No, it did not answer my question, As Karel said for bind mount is same as non-bind mount, see below the original source can be unmounted while the later bind mount still exist:
[dyoung@dhcp-xx-xx dyoung]# mount /dev/sda7 /mnt/sda7 [dyoung@dhcp-xx-xx dyoung]# ls /mnt/sda7 bin dev home lib64 media opt dyoung sbin sys usr boot etc lib lost+found mnt proc run srv tmp var [dyoung@dhcp-xx-xx dyoung]# ls /mnt/sda7/var adm db games lock mail named rwho state www cache empty lib log man run spool tmp yp [dyoung@dhcp-xx-xx dyoung]# mount -o bind /mnt/sda7/var tmp [dyoung@dhcp-xx-xx dyoung]# ls tmp adm db games lock mail named rwho state www cache empty lib log man run spool tmp yp [dyoung@dhcp-xx-xx dyoung]# umount /mnt/sda7 [dyoung@dhcp-xx-xx dyoung]# ls tmp adm db games lock mail named rwho state www cache empty lib log man run spool tmp yp
Hi, Dave!
Yes, but we can use the findmnt to recognize the directory is bind mounted or not, if the filesystem is not the btrfs.
In your case, we can find the fact that real path of tmp directory is /dev/sda7[/var]. So we can dump core to the /dev/sda7[/var], if the target is tmp.
The kdump's manner will be always correct, although the directory is bind mounted.
How did findmnt know this is a bindmnt, is it stable? OTOH, we need consider more cases, such as non-root case I believe you tested on atomic host. Have you tested normal bind mount test case, dump to root, dump to non root, nfs, etc.?
Yes. I will test more cases to cover the generic testcase.
Thanks Minfei
Thanks Dave
On 02/26/15 at 01:02pm, Minfei Huang wrote:
On 02/26/15 at 11:23am, Dave Young wrote:
On 02/26/15 at 11:02am, Minfei Huang wrote:
On 02/26/15 at 10:49am, Dave Young wrote:
Hi, Minfei
> -bash-4.2# findmnt -v /var | tail -n 1 | awk '{print $2}' > /dev/mapper/atomicos-root
There's no real dumping path for bind mount as we discussed in previous thread, right?
We can construct the real dump path for the bind mounted, using findmnt. As the above comment, we can identify the bind mount directory by using findmnt command.
No, it did not answer my question, As Karel said for bind mount is same as non-bind mount, see below the original source can be unmounted while the later bind mount still exist:
[dyoung@dhcp-xx-xx dyoung]# mount /dev/sda7 /mnt/sda7 [dyoung@dhcp-xx-xx dyoung]# ls /mnt/sda7 bin dev home lib64 media opt dyoung sbin sys usr boot etc lib lost+found mnt proc run srv tmp var [dyoung@dhcp-xx-xx dyoung]# ls /mnt/sda7/var adm db games lock mail named rwho state www cache empty lib log man run spool tmp yp [dyoung@dhcp-xx-xx dyoung]# mount -o bind /mnt/sda7/var tmp [dyoung@dhcp-xx-xx dyoung]# ls tmp adm db games lock mail named rwho state www cache empty lib log man run spool tmp yp [dyoung@dhcp-xx-xx dyoung]# umount /mnt/sda7 [dyoung@dhcp-xx-xx dyoung]# ls tmp adm db games lock mail named rwho state www cache empty lib log man run spool tmp yp
Hi, Dave!
Yes, but we can use the findmnt to recognize the directory is bind mounted or not, if the filesystem is not the btrfs.
In your case, we can find the fact that real path of tmp directory is /dev/sda7[/var]. So we can dump core to the /dev/sda7[/var], if the target is tmp.
The kdump's manner will be always correct, although the directory is bind mounted.
How did findmnt know this is a bindmnt, is it stable? OTOH, we need consider more cases, such as non-root case I believe you tested on atomic host. Have you tested normal bind mount test case, dump to root, dump to non root, nfs, etc.?
Yes. I will test more cases to cover the generic testcase.
Also need consider nfs test case, especially it envolved [], you know ipv6 also use [] in addresses..
Thanks Dave
On 02/26/15 at 11:02am, Minfei Huang wrote:
On 02/26/15 at 10:49am, Dave Young wrote:
Hi, Minfei
-bash-4.2# findmnt -v /var | tail -n 1 | awk '{print $2}' /dev/mapper/atomicos-root
There's no real dumping path for bind mount as we discussed in previous thread, right?
We can construct the real dump path for the bind mounted, using findmnt. As the above comment, we can identify the bind mount directory by using findmnt command.
No, it did not answer my question, As Karel said for bind mount is same as non-bind mount, see below the original source can be unmounted while the later bind mount still exist:
[dyoung@dhcp-xx-xx dyoung]# mount /dev/sda7 /mnt/sda7 [dyoung@dhcp-xx-xx dyoung]# ls /mnt/sda7 bin dev home lib64 media opt dyoung sbin sys usr boot etc lib lost+found mnt proc run srv tmp var [dyoung@dhcp-xx-xx dyoung]# ls /mnt/sda7/var adm db games lock mail named rwho state www cache empty lib log man run spool tmp yp [dyoung@dhcp-xx-xx dyoung]# mount -o bind /mnt/sda7/var tmp [dyoung@dhcp-xx-xx dyoung]# ls tmp adm db games lock mail named rwho state www cache empty lib log man run spool tmp yp [dyoung@dhcp-xx-xx dyoung]# umount /mnt/sda7 [dyoung@dhcp-xx-xx dyoung]# ls tmp adm db games lock mail named rwho state www cache empty lib log man run spool tmp yp
Hi, Dave!
Yes, but we can use the findmnt to recognize the directory is bind mounted or not, if the filesystem is not the btrfs.
In your case, we can find the fact that real path of tmp directory is /dev/sda7[/var]. So we can dump core to the /dev/sda7[/var], if the target is tmp.
The kdump's manner will be always correct, although the directory is bind mounted.
looking below code in mkdumprd: to_mount() { local _dev=$1 _source _target _fstype _options _mntopts _pdev
_source=$(findmnt -k -f -n -r -o SOURCE $_dev) _target=$(findmnt -k -f -n -r -o TARGET $_dev)
The _source will contain [] for bindmnt, I'm afraid it will fail on 2nd kernel
Thanks Dave