On 06/18/15 at 10:12am, Dave Young wrote:
On 06/15/15 at 04:33pm, Minfei Huang wrote:
> As you know, each filesystem instance is unique, and we can use UUID
> which is generated by mkfs to identify the specified filesystem. Fstabe
> can use the UUID to mount the specified filesystem on the directory
> which is specified in the /etc/fstab.
>
> udev will create following soft-link, once we mount the device(s) on
> directory successfully.
>
> $ ls -l /dev/disk/by-uuid/
> lrwxrwxrwx. 1 root root 10 Jun 15 15:45 21b7296c-13b3-4c9f-8b80-07a76ca26a49 ->
../../vda1
> lrwxrwxrwx. 1 root root 10 Jun 15 15:45 6a808f08-1391-4fe5-90e3-107371a72742 ->
../../vda2
> lrwxrwxrwx. 1 root root 10 Jun 15 15:45 dc97ae60-2abf-4804-8122-6cae176274e3 ->
../../vda3
>
> In gereral, we can use device name to find the filesystem UUID in
> /dev/disk. But it fails, if a filesystem is integrated by seveal
> devices, like btrfs. Following is the structure of btrfs.
>
> $ btrfs filesystem show /mnt/btrfs
> Label: none uuid: b7ee07cd-6b28-43ec-aaed-af269bbcc0c9
> Total devices 3 FS bytes used 240.00KiB
> devid 1 size 1.00GiB used 232.25MiB path /dev/mapper/testvg-lvtest01
> devid 2 size 1.00GiB used 92.88MiB path /dev/mapper/testvg-lvtest02
> devid 3 size 500.00MiB used 220.25MiB path /dev/mapper/testvg-lvtest03
>
> When we list the content of /dev/disk/by-uuid, we can find
> /dev/dm-0[1] points to the corresponding UUID.
>
> $ ls -al /dev/disk/by-uuid/
> total 0
> lrwxrwxrwx. 1 root root 10 Jun 15 15:45 21b7296c-13b3-4c9f-8b80-07a76ca26a49 ->
../../vda1
> lrwxrwxrwx. 1 root root 10 Jun 15 15:45 6a808f08-1391-4fe5-90e3-107371a72742 ->
../../vda2
> lrwxrwxrwx. 1 root root 10 Jun 15 15:45 dc97ae60-2abf-4804-8122-6cae176274e3 ->
../../vda3
> lrwxrwxrwx. 1 root root 10 Jun 15 15:48 b7ee07cd-6b28-43ec-aaed-af269bbcc0c9 ->
../../dm-0
>
> Thus Kdump maybe fail to the find UUID, once user specifies the
> device in kdump.conf.
>
> In order to fix this issue, we can use blkid to point out the UUID.
>
> Here is some content from blkid manpage.
> - Note that blkid reads information directly from devices and for
> non-root users it returns cached unverified information.
> - Avoid using the symlinks directly; it is not reliable to use the
> symlinks without verification.
>
> [1] The structure of lvm volume.
> [root@localhost ~]# ls -al /dev/testvg/
> total 0
> lrwxrwxrwx. 1 root root 7 Jun 15 15:48 lvtest01 -> ../dm-0
> lrwxrwxrwx. 1 root root 7 Jun 15 15:48 lvtest02 -> ../dm-1
> lrwxrwxrwx. 1 root root 7 Jun 15 15:48 lvtest03 -> ../dm-2
>
> Signed-off-by: Minfei Huang <mhuang(a)redhat.com>
> ---
> mkdumprd | 16 ++++++++++++++--
> 1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/mkdumprd b/mkdumprd
> index 28ecdd7..4e69526 100644
> --- a/mkdumprd
> +++ b/mkdumprd
> @@ -30,14 +30,14 @@ perror() {
> }
>
> get_persistent_dev() {
> - local i _tmp _dev
> + local i _tmp _dev _uuid
>
> _dev=$(udevadm info --query=name --name="$1" 2>/dev/null)
> [ -z "$_dev" ] && {
> perror_exit "Kernel dev name of $1 is not found."
> }
>
> - for i in /dev/mapper/* /dev/disk/by-uuid/* /dev/disk/by-id/*; do
> + for i in /dev/mapper/* /dev/disk/by-id/*; do
> _tmp=$(udevadm info --query=name --name="$i" 2>/dev/null)
> if [ "$_tmp" = "$_dev" ]; then
> echo $i
> @@ -45,6 +45,18 @@ get_persistent_dev() {
> fi
> done
>
> + if [ "x" != "x""$(blkid $1 | grep
"UUID")" ]; then
> + _uuid=`blkid $1 | grep "UUID" | awk '{print $2}'`
> + _uuid=${_uuid#*\"}
> + _uuid=${_uuid%\"*}
> + _dev=/dev/disk/by-uuid/$_uuid
> + _tmp=$(udevadm info --query=name --name=$_dev 2>/dev/null)
> + if [ "x" != "x"$_tmp ]; then
> + echo $_dev
> + return
> + fi
> + fi
> +
Thinking more about it, You may need fix it in dracut, and then backport to mkdumprd.
It is btrfs specific so only doing this for btrfs case is better..
We have already a bug for cleaning up get persistant dev functions:
https://bugzilla.redhat.com/show_bug.cgi?id=1077921
> perror "WARNING: Persistent device name of $1 not found. Using $1 as dump
target name"
> echo $1
> }
> --
> 2.1.0
>
> _______________________________________________
> kexec mailing list
> kexec(a)lists.fedoraproject.org
>
https://lists.fedoraproject.org/mailman/listinfo/kexec
>
>
_______________________________________________
kexec mailing list
kexec(a)lists.fedoraproject.org
https://lists.fedoraproject.org/mailman/listinfo/kexec