ocfs2-online-filecheck.txt 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. OCFS2 online file check
  2. -----------------------
  3. This document will describe OCFS2 online file check feature.
  4. Introduction
  5. ============
  6. OCFS2 is often used in high-availability systems. However, OCFS2 usually
  7. converts the filesystem to read-only when encounters an error. This may not be
  8. necessary, since turning the filesystem read-only would affect other running
  9. processes as well, decreasing availability.
  10. Then, a mount option (errors=continue) is introduced, which would return the
  11. -EIO errno to the calling process and terminate further processing so that the
  12. filesystem is not corrupted further. The filesystem is not converted to
  13. read-only, and the problematic file's inode number is reported in the kernel
  14. log. The user can try to check/fix this file via online filecheck feature.
  15. Scope
  16. =====
  17. This effort is to check/fix small issues which may hinder day-to-day operations
  18. of a cluster filesystem by turning the filesystem read-only. The scope of
  19. checking/fixing is at the file level, initially for regular files and eventually
  20. to all files (including system files) of the filesystem.
  21. In case of directory to file links is incorrect, the directory inode is
  22. reported as erroneous.
  23. This feature is not suited for extravagant checks which involve dependency of
  24. other components of the filesystem, such as but not limited to, checking if the
  25. bits for file blocks in the allocation has been set. In case of such an error,
  26. the offline fsck should/would be recommended.
  27. Finally, such an operation/feature should not be automated lest the filesystem
  28. may end up with more damage than before the repair attempt. So, this has to
  29. be performed using user interaction and consent.
  30. User interface
  31. ==============
  32. When there are errors in the OCFS2 filesystem, they are usually accompanied
  33. by the inode number which caused the error. This inode number would be the
  34. input to check/fix the file.
  35. There is a sysfs directory for each OCFS2 file system mounting:
  36. /sys/fs/ocfs2/<devname>/filecheck
  37. Here, <devname> indicates the name of OCFS2 volume device which has been already
  38. mounted. The file above would accept inode numbers. This could be used to
  39. communicate with kernel space, tell which file(inode number) will be checked or
  40. fixed. Currently, three operations are supported, which includes checking
  41. inode, fixing inode and setting the size of result record history.
  42. 1. If you want to know what error exactly happened to <inode> before fixing, do
  43. # echo "<inode>" > /sys/fs/ocfs2/<devname>/filecheck/check
  44. # cat /sys/fs/ocfs2/<devname>/filecheck/check
  45. The output is like this:
  46. INO DONE ERROR
  47. 39502 1 GENERATION
  48. <INO> lists the inode numbers.
  49. <DONE> indicates whether the operation has been finished.
  50. <ERROR> says what kind of errors was found. For the detailed error numbers,
  51. please refer to the file linux/fs/ocfs2/filecheck.h.
  52. 2. If you determine to fix this inode, do
  53. # echo "<inode>" > /sys/fs/ocfs2/<devname>/filecheck/fix
  54. # cat /sys/fs/ocfs2/<devname>/filecheck/fix
  55. The output is like this:
  56. INO DONE ERROR
  57. 39502 1 SUCCESS
  58. This time, the <ERROR> column indicates whether this fix is successful or not.
  59. 3. The record cache is used to store the history of check/fix results. It's
  60. default size is 10, and can be adjust between the range of 10 ~ 100. You can
  61. adjust the size like this:
  62. # echo "<size>" > /sys/fs/ocfs2/<devname>/filecheck/set
  63. Fixing stuff
  64. ============
  65. On receiving the inode, the filesystem would read the inode and the
  66. file metadata. In case of errors, the filesystem would fix the errors
  67. and report the problems it fixed in the kernel log. As a precautionary measure,
  68. the inode must first be checked for errors before performing a final fix.
  69. The inode and the result history will be maintained temporarily in a
  70. small linked list buffer which would contain the last (N) inodes
  71. fixed/checked, the detailed errors which were fixed/checked are printed in the
  72. kernel log.