LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > *BSD
User Name
Password
*BSD This forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.

Notices

Reply
 
Search this Thread
Old 09-17-2007, 09:55 PM   #1
DJOtaku
Member
 
Registered: Oct 2004
Location: USA
Distribution: Fedora 20; Arch; Kubuntu; Debian
Posts: 711

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

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

Rep: Reputation: 0
The command:

sync

will flush buffers to the disk.
 
Old 09-20-2007, 10:31 PM   #3
DJOtaku
Member
 
Registered: Oct 2004
Location: USA
Distribution: Fedora 20; Arch; Kubuntu; Debian
Posts: 711

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

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
frob23
Senior Member
 
Registered: Jan 2004
Location: Roughly 29.467N / 81.206W
Distribution: Ubuntu, FreeBSD, NetBSD
Posts: 1,449

Rep: Reputation: 47
sync(8)
Code:
     The sync utility utilizes the sync(2) function call.
sync(2)
Code:
a sync() system
     call is issued frequently by the user process syncer(4) (about every 30
     seconds).
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?
 
  


Reply

Tags
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


All times are GMT -5. The time now is 06:33 AM.

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