The pvs
command is part of lvm
. If you, as root, need to enable non-root users this funtionality, you can use setcap
, to set the lvm executable permissions to perform actions that are restricted to root by default.
This goes to any executable that needs to do root-privileged actions.
Read more about the file capabilities: http://man7.org/linux/man-pages/man7/capabilities.7.html
An example: BEFORE setcap
$ pvs
WARNING: Running as a non-root user. Functionality may be unavailable.
/run/lvm/lvmetad.socket: connect failed: Permission denied
WARNING: Failed to connect to lvmetad: Permission denied. Falling back to internal scanning.
/run/lvm/lvmetad.socket: connect failed: Permission denied
/run/lock/lvm/P_global:aux: open failed: Permission denied
Unable to obtain global lock.
AFTER
setcap "cap_dac_override,cap_dac_read_search,cap_fowner,cap_fsetid,cap_setuid,cap_setpcap,cap_net_bind_service,cap_net_admin,cap_sys_chroot,cap_sys_admin,cap_sys_resource,cap_audit_control,cap_setfcap=+eip" /sbin/lvm
$ pvs
WARNING: Running as a non-root user. Functionality may be unavailable.
PV VG Fmt Attr PSize PFree
/dev/sda2 centos lvm2 a-- 15.51g 0
/dev/sdb DataPool lvm2 a-- 50.00g 0
/dev/sdc DataPool lvm2 a-- 60.00g 0
/dev/sdd DBArchivePool lvm2 a-- 50.00g 0
Notice that I used much more caps than needed, probably, because I just copied something that I used once, but you might find your minimal set of caps...
Don't forget to quote the caps you want to set.
pvs
command, but maybefdisk -l /dev/sda
or evendf
command might help you.sudo
?