On 06/18/15 at 10:06am, Dave Young wrote:
On 06/15/15 at 04:33pm, Minfei Huang wrote:
...
>
> $ 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
>
> @@ -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
Minfei, in your test case, why it did not fall into /dev/mapper/*?
Hi, Dave.
For the above testcase, the btrfs contains three devices, /dev/dm-0,
/dev/dm-1, /dev/dm-2. Kdump will fail to find the filesystem UUID, once
we pass the /dev/dm-1 or /dev/dm-2 to the function get_persistent_dev,
because the soft-link points to the /dev/dm-0.
Thanks
Minfei