mirror of
https://github.com/minio/minio.git
synced 2025-11-22 10:37:42 -05:00
fix: ignore faulty drives and continue (#10511)
drives might return different types of errors handle them individually, and for some errors just log an error and continue
This commit is contained in:
@@ -830,21 +830,32 @@ func registerStorageRESTHandlers(router *mux.Router, endpointZones EndpointZones
|
||||
}
|
||||
storage, err := newXLStorage(endpoint)
|
||||
if err != nil {
|
||||
if err == errMinDiskSize {
|
||||
switch err {
|
||||
case errMinDiskSize:
|
||||
logger.Fatal(config.ErrUnableToWriteInBackend(err).Hint(err.Error()), "Unable to initialize backend")
|
||||
} else if err == errUnsupportedDisk {
|
||||
hint := fmt.Sprintf("'%s' does not support O_DIRECT flags, refusing to use", endpoint.Path)
|
||||
case errUnsupportedDisk:
|
||||
hint := fmt.Sprintf("'%s' does not support O_DIRECT flags, MinIO erasure coding requires filesystems with O_DIRECT support", endpoint.Path)
|
||||
logger.Fatal(config.ErrUnsupportedBackend(err).Hint(hint), "Unable to initialize backend")
|
||||
case errDiskNotDir:
|
||||
hint := fmt.Sprintf("'%s' MinIO erasure coding needs a directory", endpoint.Path)
|
||||
logger.Fatal(config.ErrUnableToWriteInBackend(err).Hint(hint), "Unable to initialize backend")
|
||||
case errFileAccessDenied:
|
||||
// Show a descriptive error with a hint about how to fix it.
|
||||
var username string
|
||||
if u, err := user.Current(); err == nil {
|
||||
username = u.Username
|
||||
} else {
|
||||
username = "<your-username>"
|
||||
}
|
||||
hint := fmt.Sprintf("Run the following command to add write permissions: `sudo chown -R %s %s && sudo chmod u+rxw %s`", username, endpoint.Path, endpoint.Path)
|
||||
logger.Fatal(config.ErrUnableToWriteInBackend(err).Hint(hint), "Unable to initialize posix backend")
|
||||
case errFaultyDisk:
|
||||
logger.LogIf(GlobalContext, fmt.Errorf("disk is faulty at %s, please replace the drive", endpoint))
|
||||
case errDiskFull:
|
||||
logger.LogIf(GlobalContext, fmt.Errorf("disk is already full at %s, incoming I/O will fail", endpoint))
|
||||
default:
|
||||
logger.LogIf(GlobalContext, fmt.Errorf("disk returned an unexpected error at %s, please investigate", endpoint))
|
||||
}
|
||||
// Show a descriptive error with a hint about how to fix it.
|
||||
var username string
|
||||
if u, err := user.Current(); err == nil {
|
||||
username = u.Username
|
||||
} else {
|
||||
username = "<your-username>"
|
||||
}
|
||||
hint := fmt.Sprintf("Run the following command to add the convenient permissions: `sudo chown -R %s %s && sudo chmod u+rxw %s`", username, endpoint.Path, endpoint.Path)
|
||||
logger.Fatal(config.ErrUnableToWriteInBackend(err).Hint(hint), "Unable to initialize posix backend")
|
||||
}
|
||||
|
||||
server := &storageRESTServer{storage: storage}
|
||||
|
||||
Reference in New Issue
Block a user