1

The production machines in my shop are running Red Hat Linux Server release 6.3. I have found that Linux appears to not flush file caches to disk upon reboot. Here is the following test I ran under the system administrator account:

# echo "kdnf2oeintgi3tn3itntel,slekrlejrkjr2o002982484t848t28842t" > /root/testfile
# reboot

After the system came back up, I logged as system administrator account and executed the following commands:

# ls -l /root/testfile
-rw------- 1 root root 0 Nov 15 23:23 /root/testfile

As you can see, it is a zero length file.

Here is the corresponding line from /etc/fstab, which shows that the filesystem is ext4

UUID=f7cb1bbf-4a90-4213-8007-bf3636f217f5 / ext4 defaults 1 1

Is the reboot command too harsh? I tried shutdown -r and it fails in the same way. I tried init 6 and it fails in the same way. Is there some Linux kernel parameter I can go check for file caching to be flushed on reboot? Could it be a possible file system setup issue in /etc/fstab? I cannot fathom that Linux actually works this way "out of the box".

I want to point out that if you issue sync before the reboot, then this works just fine. If you wait for about one minute instead of issuing sync before the reboot, it works just fine. This seems to be clearly an indication of some file buffering that is not being flushed to disk.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.