Commit Graph

82 Commits (master)

Author SHA1 Message Date
shirou bc060cc227 add SPDX License, remove old build tag, and replace import 10 months ago
shirou ce11e9ca5f [linux][disk]: fix Rdev cast 1 year ago
Ville Skyttä adaeba09d9 feat(disk): look for filesystem labels from udev on Linux 1 year ago
shirou 0665cafa1b chore: replace deprecated ioutil package to os and io 2 years ago
Greg Dallavalle 0a23dc690f comment cleanup 2 years ago
Greg Dallavalle b2d1f05f08 update comment 2 years ago
Greg aa4c84c6b3
Update disk/disk_linux.go
Co-authored-by: shirou <shirou.faw@gmail.com>
2 years ago
Greg Dallavalle 0ca6266393 fix IOCounters() SerialNumber enumeration 2 years ago
Antoine Toulme 38b94668ea allow to pass context values to override environment variables 2 years ago
Matthieu MOREL 1fb1e3e3e6 ci(lint): correct gci linter
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2 years ago
Josh Powers 7645051510
fix(disk): correctly replace /dev in /dev/mapper
Only replace the first instance of /dev in a /dev/mapper string.
Otherwise, if an LVM group is named dev it will replace that as well.

fixes: #1411
2 years ago
arstercz f6dc96c30e follow the psutil principles, do nothing if can not find root device 3 years ago
arstercz d52b97cd25 fix disk readlink error which system boot by nfs mount 3 years ago
Jamie Strandboge 9e6e627ec8 [disk][linux] add HOST_PROC_MOUNTINFO, closes #1271
The changes to gopsutil for reading /proc/1/mountinfo affected
applications running under restricted environments that disallows access
to /proc/1/mountinfo. #1159 was filed for android but other restricted
environments are also affected (eg, snaps)). The fix for #1159 addressed
the application behavior to work under confinement for non-android as
well. However, depending on the system, the attempt to read
/proc/1/mountinfo could cause a sandbox denial in the logs which can be
quite noisy if using gopsutil as part of a monitoring solution that
polls often.

This introduces HOST_PROC_MOUNTINFO to force reading from the parent dir
of the specified path instead of first trying /proc/1. When unset,
retain the current behavior with fallback. This allows people, for
example, to set HOST_PROC_MOUNTINFO=/proc/self/mountinfo when gopsutil
is running under these restricted environments.

This change updates the private readMountFile() to use a root path
instead of a root subpath, and adjusts PartitionsWithContext() to set
the root path to /proc/1 initially and falling back to /proc/self. When
HOST_PROC_MOUNTINFO is not empty, set the root path to the parent
directory of HOST_PROC_MOUNTINFO.
3 years ago
Ville Skyttä 5095c3f51e [disk][linux] recognize more file systems 3 years ago
shirou 49037dd0d8 [disk][linux] add fallback to /proc/self 3 years ago
Matthieu MOREL 4671e649aa
enable revive linter 3 years ago
mmorel-35 1e6b445a8a gofumpt 3 years ago
Matthieu MOREL b673968d5d
enable errorlint linter 3 years ago
shirou d2e27c1712 fix dependabot v2 deletion. 3 years ago
shirou 0969c9436b delete v2 directory, move v3 to top #1078 3 years ago
shirou b39f8bb90e
[v2][disk][linux] apply DiskPartiton change to v2 4 years ago
shirou 1f733a99dc [disk] move without context functions to disk.go. 4 years ago
Aman Karmani 23d63601d1 [disk][linux] flag bind mounts 4 years ago
Ilya Prudnikov 256e00319e implement proposed solution 5 years ago
Ilya Prudnikov 7277cdf050 Fix for track disk stats when running in container 5 years ago
Lomanic e4ec7b275a [disk][linux] Fix #555 for kernels >=2.6.26 6 years ago
Aman Gupta 74d3cea10f Proper fix for unavailable /proc/filesystems 6 years ago
John Floren 93e08ea089 Fixes a problem when using Docker on a host with an encrypted LLVM root. A docker container with a volume mounted from the host will see /dev/mapper in its mount info file, but will not be able to read it. 6 years ago
eshimizu 91b1c81467
Update disk_linux.go 6 years ago
Aman Gupta 34b030b41c
Ignore getFileSystems errors when requesting all partitions 6 years ago
Aman Gupta ea0f864aef ignore /proc/filesystems errors on android 6 years ago
Tony Lambiris 80ceab90aa
Add support for hfsplus file system 6 years ago
Lomanic d7405fd873 [disk][linux] Follow symlinks with filepath.EvalSymlinks for LVM volumes
See #686
6 years ago
Tony Lambiris 8037dc42c8
Add a check for logical volume paths 6 years ago
Lomanic 368a865910 [disk][linux] Fix comment in PartitionsWithContext 6 years ago
Lomanic 0d3a2ac515
[disk][linux] Fix comment in PartitionsWithContext 6 years ago
JHE a08b926ce6 It could be another error than the "self/mountinfo" missing 6 years ago
JHE 06a21ae66a Fix some issue. 6 years ago
JHE a5cb715e64 if mountinfo not found, use mounts 6 years ago
JHE d141349619 if mountinfo not found, use mounts 6 years ago
JHE a45f6d8a03 if mountinfo not found, use mounts 6 years ago
Nico Vinzens 1a7a39a789
Merge branch 'master' into master 6 years ago
Remy Mathieu fda98ebc34 disk: trim the device mapper name.
While reading the value of the file with `ioutil.ReadFile`,
the name is suffixed with a `\n`

Tested on Ubuntu 18.10
6 years ago
Lomanic 8888537497 [disk][linux] Fix #555 Unescape escaped sequences in fstab path in disk.Partitions 6 years ago
Nico Vinzens 1079f31626 change the way we handle the mountinfo lines 6 years ago
Nico Vinzens 23dfe98621 use HostSys to construct device path 7 years ago
Nico Vinzens 813c630e9c replace self/mounts with self/mountinfo 7 years ago
Jaime Soriano Pastor 61902bc2a5 Use HOST_* environment variables for getting disk serial number in Linux 7 years ago
shirou d813235a11 disk[linux]: cast uint64 for build on MIPS
related: #533
7 years ago