replace popen calls with statfs()