Ce contenu n'est pas disponible dans la langue sélectionnée.
14.3. Restoring a bad file
Important
-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
find command.
Procedure 14.1. Restoring a bad file from a replicate volume
Note the identifiers of bad files
Check the output of thescrub statuscommand 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 thegetfattrcommand 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 thefindcommand 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/GFIDCopy 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_fileCopy to Clipboard Copied! Toggle word wrap Toggle overflow Delete the corrupted files
Delete the corrupted files from the path output by thegetfattrorfindcommand.Delete the GFID file
Delete the GFID file from the/rhgs/brickN/.glusterfsdirectory.Restore the file
Follow these steps to safely restore corrupt files.Disable metadata caching
If the metadata cache is enabled, disable it by running the following command:gluster volume set VOLNAME stat-prefetch off
# gluster volume set VOLNAME stat-prefetch offCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a recovery mount point
Create a mount point to use for the recovery process. For example,/mnt/recovery.mkdir /mnt/recovery
# mkdir /mnt/recoveryCopy to Clipboard Copied! Toggle word wrap Toggle overflow Mount the volume with timeouts disabled
mount -t glusterfs -o attribute-timeout=0,entry-timeout=0 hostname:volume-path /mnt/recovery
# mount -t glusterfs -o attribute-timeout=0,entry-timeout=0 hostname:volume-path /mnt/recoveryCopy to Clipboard Copied! Toggle word wrap Toggle overflow Heal files and hard links
Access files and hard links to heal them. For example, run thestatcommand on the files and hard links you need to heal.stat /mnt/recovery/corrupt-file
$ stat /mnt/recovery/corrupt-fileCopy to Clipboard Copied! Toggle word wrap Toggle overflow 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 VOLNAMECopy to Clipboard Copied! Toggle word wrap Toggle overflow Unmount and optionally remove the recovery mount point
umount /mnt/recovery rmdir /mnt/recovery
# umount /mnt/recovery # rmdir /mnt/recoveryCopy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: Re-enable metadata caching
If the metadata cache was enabled previously, re-enable it by running the following command:gluster volume set VOLNAME stat-prefetch on
# gluster volume set VOLNAME stat-prefetch onCopy to Clipboard Copied! Toggle word wrap Toggle overflow