I think that the problem with sync/umount is caused by the lua before it.
There is a readfrom("|du 1") T=read("*n") which opens a process in the background.
This background-prozess has $MP as rootdir.
A readfrom() should close _INPUT and terminate this prozess.
This modified snip works:
RI=floor(1.125*(T-UI))
UI=floor(1.125*UI)
readfrom("|du 1") T=read("*n")
readfrom()
Z1=(2*T)+10
OA=floor((Z1+1)/2)
print("RZ="..RZ)
print("RI="..RI)
print("UZ="..UZ)
print("UI="..UI)
print("Z1="..Z1)
print("OA="..OA)
'>>$ID/ST
cd $ID
.. ST
sync
umount $MP
--
MFG Gernot