When a user performs some setup via a Web GUI, I'm calling
sync() to ensure the setup changement is immediately saved to the SD Card. (I'm doing this because the user sometimes switches off the power after doing the setup task)
I'm working with raspbian. My SD Card is a 16GB Kingston Class 10 (industrial).
sync() system call (from
unistd.h) will block normally about 1-2 seconds, but sometimes it can block up to >5 secs. IMHO: Between two calls of sync() I'm not writing more than 1MB to the persistent filesystem.
I've disabled a lot of logs.
Is this normal that
sync() blocks as this long? What can I do to reduce the consumed time by
I've checked the disk IO with
sudo iotop -o -a for some minutes:
TID PRIO USER DISK READ DISK WRITE SWAPIN IO COMMAND 95 be/3 root 0.00 B 1544.00 K 0.00 % 1.03 % [jbd2/mmcblk0p2-] 32254 be/4 root 0.00 B 0.00 B 0.00 % 0.63 % [kworker/u8:2] 5975 be/4 root 0.00 B 528.00 K 0.00 % 0.32 % myapp.elf
Is syncing to SD Card really that slow?