Logic Machine Forum
USB Drive - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: USB Drive (/showthread.php?tid=4533)



USB Drive - dave.bolas@se.com - 25.01.2023

Hi, is there any way of programmatically reading the status of a USB drive ie, is it healthy and read to write?
I had a corrupted drive and no obvious way of knowing until things stopped working.

Thanks

Dave


RE: USB Drive - admin - 26.01.2023

There's no way of knowing if the USB drive is fully operational or not. You can only check if it is mounted or not:
Code:
mounted = io.readfile('/proc/mounts'):match('/dev/sd') ~= nil
log(mounted)
Using USB drives is not recommended because they are not designed for 24/7 operation. A preferred way is to use network storage or cloud solutions.