What is the solution to the loss of data by interrupting the flow of electricity?

Sometimes FreeBSD has problems such as loss of hard disk data or it cannot boot,... when the flow of electricity interrupt.

what is your suggestion to avoid these problems?
Thanks
 
That depends on the your up-time requirement. If you want three nines (99.9%) go buy a cheap UPS. If you want nine nines (99.9999999%) up-time go buy a continuous-duty grade RUPS (Rotary UPS = generator + 1 ton flywheel + electric motor + clutch + diesel engine) system.
 
Thank you for your replies.

UPS is a good idea, but what is your idea about some configuration in system?. for example I found that the / partition should mount read only. I have no idea is this method is good or not and I cannot found the other solutions yet.
 
for example I found that the / partition should mount read only.
That will prevent some file system corruption but you can't mount everything read-only, I'm assuming you want to be able to actually write files in your home directory for example.

This problem isn't specific to FreeBSD, any file system on any OS can get corrupted if you pull the plug at the 'right' time. Even ZFS can get really messed up that way. You can only manage the effects to some extend. ZFS for example has very good "auto heal" capabilities and it'll be a lot more resilient to "unfixable" corruptions. But even that can only do so much. If it happens often enough there will be a time when ZFS's healing won't be able to fix things.
 
I have not bought a UPS yet. Keep meaning to, but life gets in the way of life. I would like to have a system where I can install a port on FreeBSD so that when the UPS battery gets down past the 'low' threshold, it sends a signal/message to FreeBSD (via said port), and then FreeBSD issues a shutdown -p now or a series of commands via a script if I preferred. But so far it seems like any existing ports use a serial cable which I really can't be bothered with. So for now I would just use my backups if the requirement arises.

I know the OS can shut itself down with a momentary press of the power button, so I might try searching for a supported motherboard with a remote power button connector, and a UPS that has a relay it can 'pulse' during low battery, and pulse again when the AC comes on. This would be preferred actually.
 
I have not bought a UPS yet. Keep meaning to, but life gets in the way of life. I would like to have a system where I can install a port on FreeBSD so that when the UPS battery gets down past the 'low' threshold, it sends a signal/message to FreeBSD (via said port), and then FreeBSD issues a shutdown -p now or a series of commands via a script if I preferred. But so far it seems like any existing ports use a serial cable which I really can't be bothered with. So for now I would just use my backups if the requirement arises.

Check out sysutils/apcupsd for working with APC UPSes, including USB models.
 
Would you please explain it more?
Filesystem corruption only happens when the power goes out during a write action.

I mean what is the disadvantage of this method?
Well, it's read-only. So you can't write to it. This would make updating a bit trickier as you need to remount the filesystem before you can update.
 
Many thanks for wasting your time to help me to find the best soloution,

I came to the conclusion that the hardware solution is UPS and if we do not have UPS, it is better to use ZFS instead of UFS. And if updating was not important for us we can mount / partiton.

If you have any other idea, I would appreciate it.
 
maybe I'am wrong,but this sysctl settings dont sync the data to disc every x seconds?

Code:
kern.metadelay
kern.dirdelay
kern.filedelay

the defaults are
Code:
kern.metadelay: 28
kern.dirdelay: 29
kern.filedelay: 30
 
Back
Top