Safe to unplug without poweroff?

Hello,

I’ve tried to find an answer on the forum but couldn’t find any revelant information.

So, is it safe to stop a zynthian box by simply unplugging the usb power cord ?

I’ve read a lot about sd card corruption and some people saying having no problem for months.
So can you tell me a bit more on how zynthian is designed around this problem, thinking about an environnement where EVERY single power cycle would be a brutal power off.

I’m currtly working on a tinycore on raspberry environnement which loads everything to ram on startup and is perfect for this task, but setting up a complete audio system is too complicated as there are a lot of missing packages to compile, so if zynthian is robust enough on the filesystem side of things, this may save my life :wink:

Looking forward to your answers, feel free to be technical if necesary.
thank you in advance

1 Like

Hi @jerash!

First of all … don’t forget to choose a category when creating a new topic. If not, your topic wont appear in the main page list :wink:

Regarding your question, Zynthian image is tuned to write on SD only when really needed. That means that normally you can unplug the power without corrupting the SD card.

But … sometimes SD card content is modified and if you unplug the power while write operations are performed, you are at risk of corrupting the SD. This happens when:

  • Updating the software
  • Modifiying the configuration
  • Saving Snapshots
  • Recording Audio or MIDI
  • etc.

The more dangerous cases are when recording Audio/MIDI or updating the system. The other “write operations” are really fast and it’s not easy to “sync” the power unplug with some of them :wink:

The only thing you can do for improving this behaviour is not recording directly in the SD. Instead, you can plug a USB memory-stick and the recording utility will detect and use it for saving the data, avoiding the “unplug problem”. Regarding the “Update Software”, there is little we can do:

  • Use a reliable power source and cable
  • Don’t move the unit while updating

If you keep in mind all that facts, you wont have problems. I’m constantly unplugging my zynthians and it’s been more than 2 years from the last time i got a corrupted SD card :wink:

Kind Regards,

2 Likes

thanks for the indepth analysis :slight_smile:

This is all very good; a standard use would be just powering up, playing, powering off, there should be no real sd card writes.
The only case would be when saving a snaphot.

Big up !

1 Like

Running the uk’s only zynthian farm, I’ve a fair bit of experience of turning them on and off and as such I concur with jofemodo they are pretty robust, especially more recently.
There are a few occasions where it’s the only option, but one can normally get to the machine with a terminal to kill it.
Once or twice I’ve had problems but it’s generally when it’s stuck doing something, updating or Audio record. The boot sector particularly seems to have lost it’s sensitivity in this area.

Yea it’s a game of chance, Linux usually has cache files open, than can be lost in an unexpected power-down.

We (and any other ras pi black box) really need some brownout detecting hardware that wound hit an interrupt, pin, triggering some orderly file closes in some miliseconds.

I just recently rediscovered that a long? press in the lower-right Select knob triggers a shutdown.

I too was looking into Tinycore Linux, which runs entirely from ram, so there are no active cache file on the SD card, (recording audio would still be at risk)
Last saw they were about to release an update that would run on the Pi 3B+

1 Like

Hi MaxMaxis!

Zynthian images are tweaked for not writing files in the SD. The system log doesn’t write anything to disk, so ou don’t have to worry about corruption while using Zynthian normally. Only when explicitly writing something to disk you are in risk of corrupting the SD, and this only happens when:

  • Recording Audio / MIDI directly to the SD (easy to avoid by using an USB memory-stick)
  • Saving Snapshots
  • Updating the Software
  • Modifiying configuration from webconf
  • Managing presets from webconf
  • etc.

Regarding the power-off function when pushing long the SELECT switch, it is documented in the User’s Guide:

Zynthian UI Users Guide - V1/V4 - ZynthianWiki

I don’t think you need this to achieve a reliable system and loading everything in RAM will exhaust the memory that you need to load samples and audio stuff.

As i’ve tried to explain, loading from SD is not a problem at all and doesn’t increase the SD-corruption risk. Only when writing you are in risk, and you can’t avoid doing it when saving snapshots, updating the software or modifying the configuration.

Kind Regards,

To partially combat/safeguard against this, you could simply grab an image of what’s on your SD card (after you’ve configured it, set up all your snapshots, etc.) and store that on a laptop or harddrive somewhere, so you’d be able to restore from image in case of corruption.

Generally yanking power on the RasPi would only corrupt the filesystem (if anything), so the underlying SD card would likely be fine after a restore from your ‘golden’ image.

1 Like

I do agree that a dd of the SD card content is a safe way to backup in case of emergency.
The way the filesystem is currently handled is a good solution for 99% of cases, so safe enough for now.
I’ll hope to be able to achieve a tinycore audio system, because i like the 100% instead of 99% :wink: but to be totally honest, if you want to save something on a tinycore system, you have to issue the “backup” commande which actually writes to disk and you’d better not unplug at this very moment, which is exactly the same as what the zynthian does as @jofemodo said !

1 Like