-   *BSD (
-   -   protecting data integrity of a server which is always on (

DJOtaku 09-17-2007 09:55 PM

protecting data integrity of a server which is always on
As we know, with all *nix machines, it's bad for the machine to be shutdown without rebooting. However, the reason we use *nix instead of Windows is so that we don't have to constantly be rebooting.

So, is there some command I can put into a cron job that will write whatever needs to be written to the harddrive so that if the power goes out, I don't have as much of a chance of data corruption?


Scroggs79 09-18-2007 01:05 AM

The command:


will flush buffers to the disk.

DJOtaku 09-20-2007 10:31 PM

excellent, I will do that!

choogendyk 09-21-2007 10:06 AM

So, you're going to put in a cron job to sync, what, every 5 minutes? You're still playing a roulette game with power outage, and you're messing with your machine's speed and efficiency.

Why not just get a UPS? They aren't that expensive. If you're worried about little blips in the power, that would take care of it, and would be nicer to the server in general. If you're concerned about real outages, install the software that talks to the UPS and get whatever cable is required for that UPS. Then your server will shut down properly if there is a real power outage.

Any OS is subject to problems of power outage. Yank the power plug on a Windows box a few times, and it's likely to come up blue.

frob23 09-22-2007 12:53 PM


    The sync utility utilizes the sync(2) function call.

a sync() system
    call is issued frequently by the user process syncer(4) (about every 30

Since cron has a granularity of 1 minute, and sync is called more often than that, there is no practical purpose to putting it in a cronjob.

I have to second the recommendation for a UPS. FreeBSD is very good 99% of the time recovering from ugly shutdowns... but why take the chance?

All times are GMT -5. The time now is 10:47 PM.