Skip to content

Conversation

giampaolo
Copy link
Owner

Summary

Description

disk_partitions() may return partitions with device == "/dev/root" or "rootfs". Add different methods to try to obtain the real device path. Resources:

Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
@giampaolo giampaolo changed the title [Linux] convert /dev/rootfs device (fixes #1999) [Linux] convert /dev/root device (fixes #1999) Oct 14, 2021
@giampaolo giampaolo changed the title [Linux] convert /dev/root device (fixes #1999) [Linux] convert /dev/root device to real path (fixes #1999) Oct 14, 2021
@giampaolo giampaolo merged commit 4d03c91 into master Oct 14, 2021
@giampaolo giampaolo deleted the root-fs-device branch October 14, 2021 19:34
@albertvaka
Copy link

albertvaka commented Oct 14, 2021

I can confirm this fixes the original issue for me 😄

Is there a date for a future release that includes this change?

albertvaka added a commit to DataDog/datadog-agent that referenced this pull request Oct 19, 2021
Backport of upstream PR: giampaolo/psutil#2000

On some Linux setups (eg: default Ubuntu 20.04 AWS instances), psutils
would return /dev/root instead of the actual block device (eg: /dev/xvda).

When using the `tag_by_label` option, the disk check tries to match the
output of psutil with the output of `lsblk` or `blkid` to find disk labels.
However, these return the actual path instead of /dev/root, resulting in
missing tags.
albertvaka added a commit to DataDog/datadog-agent that referenced this pull request Oct 19, 2021
Backport of upstream PR: giampaolo/psutil#2000

On some Linux setups (eg: default Ubuntu 20.04 AWS instances), psutils
would return /dev/root instead of the actual block device (eg: /dev/xvda).

When using the tag_by_label option, the disk check tries to match the
output of psutil with the output of lsblk or blkid to find disk labels.
However, these return the actual path instead of /dev/root, resulting in
missing tags.
zandrewitte pushed a commit to StackVista/stackstate-agent that referenced this pull request Nov 17, 2022
Backport of upstream PR: giampaolo/psutil#2000

On some Linux setups (eg: default Ubuntu 20.04 AWS instances), psutils
would return /dev/root instead of the actual block device (eg: /dev/xvda).

When using the tag_by_label option, the disk check tries to match the
output of psutil with the output of lsblk or blkid to find disk labels.
However, these return the actual path instead of /dev/root, resulting in
missing tags.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Linux] psutil.disk_partitions() returns /dev/root on Ubuntu 20.04 on AWS
2 participants