LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-02-2011, 12:20 PM   #1
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 648

Rep: Reputation: 45
Opinion about Sync command.


I am using fedora in my home pc.I want to know that before shutting down my pc should i use sync command so that all data in the ram buffer should syncronize and i store in hard disk.
What is your opinion about sync command
Thanks
Garden
 
Old 02-02-2011, 02:30 PM   #2
disturbed1
Senior Member
 
Registered: Mar 2005
Location: USA
Distribution: Slackware
Posts: 1,133
Blog Entries: 6

Rep: Reputation: 224Reputation: 224Reputation: 224
sync should be performed by the shutdown scripts. It won't hurt anything if you issue it yourself. I bind a key sequence to a suspend script that calls sync twice - just in case Depending on the file system you use, and options you may have specified, they sync at different intervals. ext3/4 by default syncs every 5 seconds.

Quote:
Originally Posted by man mount
commit=nrsec
Sync all data and metadata every nrsec seconds. The default value is 5 seconds. Zero means default.
Consult the various man pages, or have a look here http://www.kernel.org/doc/Documentation/filesystems/
 
Old 02-02-2011, 04:44 PM   #3
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 648

Original Poster
Rep: Reputation: 45
Thanks for the guidance.well if we does not write sync twice before shutting down the pc what will be the affect ? I my opinion nothing.
How can i write script to add sync before shuting down the pc?
 
Old 02-02-2011, 09:39 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Waste of time. The shutdown sequence in the init scripts umounts all the filesystems. This forces a sync.
 
Old 11-28-2015, 01:22 PM   #5
Mr. Alex
Senior Member
 
Registered: May 2010
Distribution: No more Linux. Done with it.
Posts: 1,238

Rep: Reputation: Disabled
Hi. Sorry for “unprofessional” question (reason why I didn't create new thread for it) but if I copy huge amount of data (let's say it's half of a TB) and while copying is in progress “sync” command is executed. Can it possibly damage the result file? I mean, while copying some data will always be in cache, then it flashes and new data is moved to cache. And “sync” will try to flash all cached data and won't stop untill cache is empty while it is necessary to write to cache for next several hours (by the copy process). Can it somehow screw things up?
 
Old 11-28-2015, 02:00 PM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,842

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
next time please open a new thread. in general sync cannot be dangerous at all.
 
  


Reply



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: Newsbeuter: Command Line Feed Reader With Bloglines Sync Support LXer Syndicated Linux News 0 01-15-2010 09:30 PM
system sync command behavior with respect to file deletions. mmccaff1 Linux - Kernel 3 07-07-2009 11:20 AM
iPod sync from command line? prol Linux - Software 1 08-06-2008 02:04 PM
verbose output of fstab-sync command GingerMegs Linux - Software 0 06-04-2005 04:25 PM
Sync for Samsung Sync master Naphoon Linux - Hardware 1 10-16-2004 06:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:48 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration