19.3. Restore a bad file
When bad files are revealed by the scrubber, you can perform the following process to heal the file by recovering a copy from a replicate volume.
Important
The following procedure is easier if GFID-to-path translation is enabled.
Mount all volumes using the
-oaux-gfid-mount
mount option, and enable GFID-to-path translation on each volume by running the following command.
gluster volume set VOLNAME build-pgfid on
# gluster volume set VOLNAME build-pgfid on
Files created before this option was enabled must be looked up with the
find
command.
Procedure 19.1. Restoring a bad file from a replicate volume
Note the identifiers of bad files
Check the output of thescrub status
command to determine the identifiers of corrupted files.Copy to Clipboard Copied! Toggle word wrap Toggle overflow Determine the path of each corrupted object
For files created after GFID-to-path translation was enabled, use thegetfattr
command to determine the path of the corrupted files.getfattr -n glusterfs.ancestry.path -e text
# getfattr -n glusterfs.ancestry.path -e text /mnt/VOLNAME/.gfid/GFID ... glusterfs.ancestry.path="/path/to/corrupted_file"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For files created before GFID-to-path translation was enabled, use thefind
command to determine the path of the corrupted file and the index file that match the identifying GFID.find /rhgs/brick*/.glusterfs -name GFID
# find /rhgs/brick*/.glusterfs -name GFID /rhgs/brick1/.glusterfs/path/to/GFID
Copy to Clipboard Copied! Toggle word wrap Toggle overflow find /rhgs -samefile /rhgs/brick1/.glusterfs/path/to/GFID
# find /rhgs -samefile /rhgs/brick1/.glusterfs/path/to/GFID /rhgs/brick1/.glusterfs/path/to/GFID /rhgs/brick1/path/to/corrupted_file
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Delete the corrupted files
Delete the corrupted files from the path output by thegetfattr
orfind
command.Delete the GFID file
Delete the GFID file from the/rhgs/brickN/.glusterfs
directory.Heal the file
If you have client self-heal enabled, the file is healed the next time that you access it.If you do not have client self-heal enabled, you must manually heal the volume with the following command.gluster volume heal VOLNAME
# gluster volume heal VOLNAME
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The next time that the bitrot scrubber runs, this GFID is no longer listed (unless it has become corrupted again).