Closed alpgarcia closed 3 years ago
I did some tests. I added the following script to the sd card:
create_files.sh
:
#!/bin/sh
for i in 1 2 3 4 5; do
echo ${i} >> ${i}
done
The test consisted of the following steps:
cd /sdcard
./created_files.sh
ls
and cat
.cd /sdcard
ls
and cat
.rm 1 2 3 4 5
(or whatever files were actually created).I repeated it 5 times. Step 4 always returned 5 files with their expected content. Step 8 returned a different set of unexpected results:
Then, I did the same but instead of powering off via button in step 5, I powered off the console via poweroff
command. Again 5 times:
At this point seems to be clear that poweroff
command works as expected and the buffers are flushed during the shutdown process.
Next test was repeating the same initial steps as described above, but adding the following one before step 2:
mount -o remount,sync /mnt/sdcard/
cd /sdcard
./created_files.sh
ls
and cat
.cd /sdcard
ls
and cat
.rm 1 2 3 4 5
(or whatever files were actually created).The results were:
So the next steps are:
sync
flag.poweroff
command when exiting RetroArch, this way we make sure there is a proper way of triggering an ordered shutdown.sync
flag.
When a file is modified either in the sd card or in the
userdata
partition, changes are not always persisted.As a workaround, forcing
sync
explicitly works.It is worth exploring whether the filesystems are mounted using the
sync
flag and if they aren't, test whether it could solve the problem without affecting performance.