1833866 Members
2671 Online
110063 Solutions
New Discussion

Sync command details

 
Jeffrey Shannon_1
Occasional Contributor

Sync command details

What will the "sync" command do?
Create core file?
Crash system?
etc?

Thanks!
8 REPLIES 8
John Poff
Honored Contributor

Re: Sync command details

Hi,

The 'sync' command should do none of the above. Here is a snippet from the man page for 'sync':

sync executes the sync() system call (see sync(2)). If the system is
to be stopped, the sync command must be called to ensure file system
integrity.

sync flushes all previously unwritten system buffers including
modified super blocks, modified inodes, and delayed block I/O out to
disk. This ensures that all file modifications are properly saved
before performing a critical operation such as a system shutdown. For
additional protection from power failures or possible system crashes,
use syncer to execute sync automatically at periodic intervals (see
syncer(1M)).

I'm curious. Why do you ask?

JP
Helen French
Honored Contributor

Re: Sync command details

sync command is used to synchronize file systems. The sync() system call will be generated to ensure the FS integrity. You will get a details information from here:
# man 1m sync
Life is a promise, fulfill it!
Jeffrey Shannon_1
Occasional Contributor

Re: Sync command details

We are doing operations readiness testing and I basically need to verify a core dump, hence using the sync command...any suggestions?
John Poff
Honored Contributor

Re: Sync command details

When you say, "verify a core dump", do you mean to see which program caused the core dump? You can use 'file core' to see that. If you need to get the core dump file into a debugger to do some real analysis of it, you'll probably need to use something like 'adb'.

JP
Helen French
Honored Contributor

Re: Sync command details

Are you trying to create a core dump or trying to verify a core dump file which you already got? For verifying a core dump file which you got, you could use the Q4 analysis with the help of HP. Other tools which will be useful is - file, adb etc.
Life is a promise, fulfill it!
Anil C. Sedha
Trusted Contributor

Re: Sync command details

Jeff,

Sync command is just used to ensure that all files which have not been written to the system are written immediately.

So all processes or changes which are held for writing to the system get committed and the system is updated completely for any changes withheld.

It has got nothing to do with core file or crash system.

Regards,
Anil
If you need to learn, now is the best opportunity
Sanjay_6
Honored Contributor

Re: Sync command details

Hi,

The sync command will sync the memory buffers with the disk. So if there was an update in the memory but not yet synced to disk, it will be done with the sync command. Do "man sync" for more details.

Hope this helps.

Regds
doug hosking
Esteemed Contributor

Re: Sync command details

I think quite a few of us are confused about the question, much less the answer.
Are you trying to force a system panic on demand and verify that a proper crash dump is created? If so, forget about sync and:

On series 700 systems, look for a small button marked 'TOC' on the system chassis and push it.

On series 800 systems, be sure the key switch (or, on some systems, a switch on the back of the machine) is in the 'service' position then type ^B on the system console, followed by 'tc' and a newline. Typically you then have to type a
'y' to confirm that you want to take the system down forcefully. The process for this can vary a bit from machine to machine.

In both cases you are effectively generating a non-maskable interrupt (a Transfer of Control -I'll bet you can now guess what 'tc' stands for) that causes the system to jump to a routine that forces a crash dump to be taken. The system will come down very ungracefully, with the chance of some (usually very minor and easily recovered from) disk corruption, since the system has not had a chance to cleanly stop processing.

There is one tie from this back to your original 'sync' comment:
Running 'sync' just before doing the above can reduce the risk of disk corruption. Normally there is a background process called syncer that will essentially run 'sync' every 30 seconds or so. During normal operation, you don't have to worry at all about that. If you know the system is about to die, forcing a sync to happen at that time may be helpful in reducing the risk of damage.

Was that what you were really asking? If not, let's try again to understand your question.