Is the sync script an SD-card hazard?
Is the sync script an SD-card hazard?
Wow, this has been a while I hope everyone is doing OK
I finally have some spare time to play around with the MiSTer again, yay!
The MiSTer linux image has a sync script that syncs every 5s which in my uninformed opinion is hazardous to every SD-card. So I started a search and found that embedded devices (where power can be cut off at any time like the MiSTer), use a 470µF capacitor to give the OS enough time to finish writing in case of power failure.
Is this already present on the IO-board, and if not would this be a good idea to introduce?
I finally have some spare time to play around with the MiSTer again, yay!
The MiSTer linux image has a sync script that syncs every 5s which in my uninformed opinion is hazardous to every SD-card. So I started a search and found that embedded devices (where power can be cut off at any time like the MiSTer), use a 470µF capacitor to give the OS enough time to finish writing in case of power failure.
Is this already present on the IO-board, and if not would this be a good idea to introduce?
- LamerDeluxe
- Top Contributor
- Posts: 1239
- Joined: Sun May 24, 2020 10:25 pm
- Has thanked: 887 times
- Been thanked: 284 times
Re: Is the sync script an SD-card hazard?
What does it sync? The capacitor sounds like an interesting idea.
Re: Is the sync script an SD-card hazard?
Yeah, I thought so too.LamerDeluxe wrote: ↑Thu Nov 24, 2022 10:53 am What does it sync? The capacitor sounds like an interesting idea.
I disabled it on my setup, at least the green light stops flashing so frequently.
-
- Core Developer
- Posts: 459
- Joined: Wed May 26, 2021 9:35 pm
- Has thanked: 59 times
- Been thanked: 383 times
Re: Is the sync script an SD-card hazard?
The constant sync'ing won't hurt the SD card since it's not really writing data to it each time it syncs.
Syncing doesn't only protect against data loss during a power outage, but if you were to reset Mister, any unsaved data is lost.
Now I could be wrong but for cores that allow game saves and what not, it helps make sure the data is written/flushed to the SD card or external drive in case of a reset, power outage or even switching cores.
So unless the the flashing of the green light is annoying, I would leave it enabled.
Syncing doesn't only protect against data loss during a power outage, but if you were to reset Mister, any unsaved data is lost.
Now I could be wrong but for cores that allow game saves and what not, it helps make sure the data is written/flushed to the SD card or external drive in case of a reset, power outage or even switching cores.
So unless the the flashing of the green light is annoying, I would leave it enabled.
Re: Is the sync script an SD-card hazard?
Well the partition is mounted with sync, so it should write to disk asap like @Malor pointed out.
I have seen no ill effects yet since it has been disabled (before my last visit here, so a couple of months) but YMMV.
Good catch on the reset, although I think that is a problem either way. It could still be syncing when the button is pressed.
I have seen no ill effects yet since it has been disabled (before my last visit here, so a couple of months) but YMMV.
Good catch on the reset, although I think that is a problem either way. It could still be syncing when the button is pressed.
-
- Top Contributor
- Posts: 1911
- Joined: Wed May 27, 2020 1:59 pm
- Has thanked: 145 times
- Been thanked: 454 times
Re: Is the sync script an SD-card hazard?
You can always create a script containing "sync;sync" and run it before whatever you think could cause corruption. This would not be useful in case of power failure/hard reset by pulling the power plug.
- pgimeno
- Top Contributor
- Posts: 710
- Joined: Thu Jun 11, 2020 9:44 am
- Has thanked: 277 times
- Been thanked: 226 times
Re: Is the sync script an SD-card hazard?
The filesystem is already mounted with the sync flag; isn't that script redundant?
Converters I've written: Floppy DIM/FDI/FDD/HDM to D88, D88 to XDF, Tape SVI 318/328 CAS to WAV
-
- Core Developer
- Posts: 459
- Joined: Wed May 26, 2021 9:35 pm
- Has thanked: 59 times
- Been thanked: 383 times
Re: Is the sync script an SD-card hazard?
Yes, since the "fat" partition and external drives are mounted with the sync option, the resync script is redundant. May be it was a hold over from earlier versions prior to adding the sync option to mount?
-
- Top Contributor
- Posts: 1911
- Joined: Wed May 27, 2020 1:59 pm
- Has thanked: 145 times
- Been thanked: 454 times
Re: Is the sync script an SD-card hazard?
I got confused by this post:
"Well the partition is mounted with sync, so it should write to disk asap like @Malor pointed out.
I have seen no ill effects yet since it has been disabled (before my last visit here, so a couple of months) but YMMV."
I did not realize the disabling was referring to the script.
"Well the partition is mounted with sync, so it should write to disk asap like @Malor pointed out.
I have seen no ill effects yet since it has been disabled (before my last visit here, so a couple of months) but YMMV."
I did not realize the disabling was referring to the script.
Re: Is the sync script an SD-card hazard?
Yes I proposed disabling the /etc/resync script if its a wear leveling hazard (or annoyance):jca wrote: ↑Thu Nov 24, 2022 8:20 pm I got confused by this post:
"Well the partition is mounted with sync, so it should write to disk asap like @Malor pointed out.
I have seen no ill effects yet since it has been disabled (before my last visit here, so a couple of months) but YMMV."
I did not realize the disabling was referring to the script.
Code: Select all
#!/bin/sh
( while [ 1 ]; do sync; sleep 5; done ) &
Code: Select all
::sysinit:/etc/resync &