You don’t need this, because the programs before it close their file handles and consequently flush their buffers. As for the file system journal, it has its own methods for updating file contents before being read if they have yet to be committed to disk and
sync won’t provide any benefits during normal disk operations.
On the other hand, you risk interfering with other background processes which may require delayed read/write to work properly. The Linux
sync command is a problem-solving tool, not a generic tool for everyday use. Do not use it like this.
Don’t EVER use aur helpers to upgrade your system. AUR helpers should only be used to install packages from the AUR and upgrade them. They shouldn’t even be used to uninstall packages.
Use pacman instead with
-Syyu. Then when pacman is done, you can update your AUR packages with
yaourt -Sua. This is safer since it permits that your repository packages be managed by the official application of the package system, and delegates to third-party tools only the task of managing packages from the AUR.
As @c00ter explained.
So that means the problem is elsewhere. Likely with your use of pacman-optimize (another program that really only needs to be used rarely) or yaourt.
Also note that you are forcing a synchronization of the database twice. Once with
pacman -Syy and another with
yaourt -Syy. Needless duplication of efforts.
If you insist in running your updates through a similar command line, then I suggest the following:
$ sudo pacman-mirrors -f5 && sudo pacman -Syyu
Stop here. Do not add "&& yaourt…` to the above command line. The reason is that you want to look at the output given. And if needed be act after a successful update before updating the AUR. Avoid chaining commands like that every time you know there is a chance you may have to be called to act after a command completes.
$ yaourt -Sua
And you will be done after this.