Maintaining metadata consistency of a mounted file system during runtime
Within metadata of a mounted file system with a file system transaction logging capability, a set of inodes is identified, each inode in the set of inodes comprising a data structure identifying a file system storage location of a portion of a file stored in the file system. A set of unused inodes is excluded from the set of inodes. A set of changing inodes is excluded from the set of inodes, each inode in the set of changing inodes comprising a flag indicating an in-progress write operation. A consistency check is performed on the metadata of the file system excluding the set of unused inodes and the set of changing inodes, the consistency check attempting to identify an inconsistency in the metadata. Responsive to the consistency check identifying an inconsistency in the metadata, the file system is remediated.
1 . A computer-implemented method comprising:
performing a consistency check on a plurality of inodes of a mounted portion of a file system, the consistency check performed while the plurality of inodes is accessible for use in a file read operation and while the plurality of inodes is not participating in an in-progress write operation, the consistency check attempting to identify an inconsistency in data stored in the plurality of inodes, each inode in the plurality of inodes comprising a data structure identifying a file system storage location of a portion of a file stored in the file system; and
remediating, responsive to the consistency check identifying an inconsistency in the data stored in the plurality of inodes, the file system.
2 . The computer-implemented method of claim 1 , wherein the consistency check includes a consistency check of an inode map of the file system, the inode map recording a status of the plurality of inodes.
3 . The computer-implemented method of claim 1 , wherein the consistency check includes a consistency check of an allocation map of the file system, the allocation map recording a status of a set of blocks used to store data in the file system.
4 . The computer-implemented method of claim 1 , wherein the consistency check includes a consistency check of a superblock of the file system, the superblock maintaining information about the file system.
5 . The computer-implemented method of claim 1 , further comprising logging results of the consistency check.
6 . The computer-implemented method of claim 1 , further comprising marking, responsive to the consistency check determining that third metadata associated with a portion of a file stored in the file system has a consistency error, the portion as read-only, the marking preventing modification of the portion.
7 . The computer-implemented method of claim 1 , further comprising marking, responsive to the consistency check determining that fourth metadata of the file system has a consistency error, the file system as read-only, the marking preventing modification of files stored in the file system.
8 . A computer usable program product comprising one or more computer-readable storage devices, and program instructions stored on at least one of the one or more storage devices, the stored program instructions comprising:
program instructions to perform a consistency check on a plurality of inodes of a mounted portion of a file system, the consistency check performed while the plurality of inodes is accessible for use in a file read operation and while the plurality of inodes is not participating in an in-progress write operation, the consistency check attempting to identify an inconsistency in data stored in the plurality of inodes, each inode in the plurality of inodes comprising a data structure identifying a file system storage location of a portion of a file stored in the file system; and
program instructions to remediate, responsive to the consistency check identifying an inconsistency in the data stored in the plurality of inodes, the file system.
9 . The computer usable program product of claim 8 , wherein the consistency check includes a consistency check of an inode map of the file system, the inode map recording a status of the plurality of inodes.
10 . The computer usable program product of claim 8 , wherein the consistency check includes a consistency check of an allocation map of the file system, the allocation map recording a status of a set of blocks used to store data in the file system.
11 . The computer usable program product of claim 8 , wherein the consistency check includes a consistency check of a superblock of the file system, the superblock maintaining information about the file system.
12 . The computer usable program product of claim 8 , further comprising program instructions to log results of the consistency check.
13 . The computer usable program product of claim 8 , further comprising program instructions to mark, responsive to the consistency check determining that third metadata associated with a portion of a file stored in the file system has a consistency error, the portion as read-only, the marking preventing modification of the portion.
14 . The computer usable program product of claim 8 , further comprising program instructions to mark, responsive to the consistency check determining that fourth metadata of the file system has a consistency error, the file system as read-only, the marking preventing modification of files stored in the file system.
15 . The computer usable program product of claim 8 , wherein the stored program instructions are stored in a computer readable storage device in a data processing system, and wherein stored program instructions are transferred over a network from a remote data processing system.
16 . The computer usable program product of claim 8 , wherein the stored program instructions are stored in a computer readable storage device in a server data processing system, and wherein the stored program instructions are downloaded over a network to a remote data processing system for use in a computer readable storage device associated with the remote data processing system.
17 . A computer system comprising one or more processors, one or more computer-readable memories, and one or more computer-readable storage devices, and program instructions stored on at least one of the one or more storage devices for execution by at least one of the one or more processors via at least one of the one or more memories, the stored program instructions comprising:
program instructions to perform a consistency check on a plurality of inodes of a mounted portion of a file system, the consistency check performed while the plurality of inodes is accessible for use in a file read operation and while the plurality of inodes is not participating in an in-progress write operation, the consistency check attempting to identify an inconsistency in data stored in the plurality of inodes, each inode in the plurality of inodes comprising a data structure identifying a file system storage location of a portion of a file stored in the file system; and
program instructions to remediate, responsive to the consistency check identifying an inconsistency in the data stored in the plurality of inodes, the file system.