23.05.2020, 15:30
Hi all,
I developed an Lua script which writes "csv" files on a USB 2.0 key.
This cyclic script performs regular "mount / umount" (every 6 hours) to guarantee the maximum number of correct files in the event of micro power cuts.
It works fine, but I have random errors on the mount as : "mounting / dev / sda1 on / mnt failed: no such file or directory".
Do you have any explanations for this problem?
Than'k in advance for your help !
--- here is the umout/mount standard script I user ---
I developed an Lua script which writes "csv" files on a USB 2.0 key.
This cyclic script performs regular "mount / umount" (every 6 hours) to guarantee the maximum number of correct files in the event of micro power cuts.
It works fine, but I have random errors on the mount as : "mounting / dev / sda1 on / mnt failed: no such file or directory".
Do you have any explanations for this problem?
Than'k in advance for your help !
--- here is the umout/mount standard script I user ---
Code:
devs = io.ls('/sys/class/block/')
table.sort(devs)
for _, dev in ipairs(devs) do
if dev:match('^sd%a%d$') then
part = dev
break
elseif not devn and dev:match('^sd%a$') then
devn = dev
end
end
part = part or devn
if part then
os.execute('umount -f /mnt 2>&-')
res, stat = io.readproc('mount /dev/' .. part .. ' /mnt 2>&1')
if stat == 0 then
alert('USB mount OK')
else
alert('USB mount failed: ' .. tostring(res)) -----------> this line returns the random errors...
end
else
alert('No valid USB devices found')
end