26.01.2023, 10:21
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:
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.
Code:
mounted = io.readfile('/proc/mounts'):match('/dev/sd') ~= nil
log(mounted)