How to get hdd drive state (like active/idle,standy) in python 3 without admin rights?

111 Views Asked by At

Is there a way to get the status of a hard drive in debian linux without admin rights in python?

What I have done (in shell, not python):

1. I installed hdparm via shell:

sudo apt-get install hdparm

2. In the shell I can type now:

sudo /sbin/hdparm -C /dev/disk/by-label/harddrive1

3. The output is:

/dev/disk/by-label/harddrive1:
drive state is:  standby

I want to grep the state like "drive state is: standby" or "drive state is: active/idle". With bash and admin rights it is very easy. But I want to read the device state (standby, active/idle) in python without admin rights.

Is there a way to do this in python 3 without admin rights? It does not need to be hdparm.

0

There are 0 best solutions below