Help answer threads with 0 replies.
Go Back > Forums > Other *NIX Forums > *BSD
User Name
*BSD This forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.


  Search this Thread
Old 09-17-2007, 09:55 PM   #1
Registered: Oct 2004
Location: USA
Distribution: Fedora 25;CentOS 7; Kubuntu; Debian
Posts: 846

Rep: Reputation: 35
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?

Old 09-18-2007, 01:05 AM   #2
LQ Newbie
Registered: Feb 2006
Location: California
Distribution: Mandriva
Posts: 15

Rep: Reputation: 0
The command:


will flush buffers to the disk.
Old 09-20-2007, 10:31 PM   #3
Registered: Oct 2004
Location: USA
Distribution: Fedora 25;CentOS 7; Kubuntu; Debian
Posts: 846

Original Poster
Rep: Reputation: 35
excellent, I will do that!
Old 09-21-2007, 10:06 AM   #4
Senior Member
Registered: Aug 2007
Location: Massachusetts, USA
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,194

Rep: Reputation: 105Reputation: 105
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.
Old 09-22-2007, 12:53 PM   #5
Senior Member
Registered: Jan 2004
Location: Roughly 29.467N / 81.206W
Distribution: OpenBSD, Ubuntu, FreeBSD
Posts: 1,449

Rep: Reputation: 48
     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?


bsd, nix, sync

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Review: Protecting Data with Encrypted Linux Partitions Part 2 LXer Syndicated Linux News 0 06-22-2007 05:46 AM
LXer: Tutorial: Protecting Data with Encrypted Linux Partitions LXer Syndicated Linux News 0 06-14-2007 08:17 PM
Data Integrity Checks itnaa Linux - Software 7 12-22-2006 02:28 PM
creating tar files with high data integrity edman007 Linux - Software 13 10-10-2006 03:00 PM
Protecting data... Dee-ehn Linux - General 5 06-09-2005 05:41 PM > Forums > Other *NIX Forums > *BSD

All times are GMT -5. The time now is 01:29 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration