mirror of
https://github.com/minio/minio.git
synced 2025-01-11 15:03:22 -05:00
fix: add proper errors for disks with preexisting content (#9703)
This commit is contained in:
parent
5e15b0b844
commit
d0ae69087c
@ -181,6 +181,12 @@ Example 1:
|
||||
"",
|
||||
)
|
||||
|
||||
ErrCorruptedBackend = newErrFn(
|
||||
"Unable to use the specified backend, pre-existing content detected",
|
||||
"Please ensure your disk mount does not have any pre-existing content",
|
||||
"",
|
||||
)
|
||||
|
||||
ErrUnableToWriteInBackend = newErrFn(
|
||||
"Unable to write to the backend",
|
||||
"Please ensure MinIO binary has write permissions for the backend",
|
||||
|
@ -27,6 +27,7 @@ import (
|
||||
"sync"
|
||||
|
||||
humanize "github.com/dustin/go-humanize"
|
||||
"github.com/minio/minio/cmd/config"
|
||||
"github.com/minio/minio/cmd/config/storageclass"
|
||||
"github.com/minio/minio/cmd/logger"
|
||||
"github.com/minio/minio/pkg/color"
|
||||
@ -379,11 +380,12 @@ func saveFormatXL(disk StorageAPI, format interface{}, diskID string) error {
|
||||
}
|
||||
|
||||
var ignoredHiddenDirectories = map[string]struct{}{
|
||||
minioMetaBucket: {},
|
||||
".snapshot": {},
|
||||
"lost+found": {},
|
||||
"$RECYCLE.BIN": {},
|
||||
"System Volume Information": {},
|
||||
minioMetaBucket: {}, // metabucket '.minio.sys'
|
||||
".minio": {}, // users may choose to double down the backend as the config folder for certs
|
||||
".snapshot": {}, // .snapshot for ignoring NetApp based persistent volumes WAFL snapshot
|
||||
"lost+found": {}, // 'lost+found' directory default on ext4 filesystems
|
||||
"$RECYCLE.BIN": {}, // windows specific directory for each drive (hidden)
|
||||
"System Volume Information": {}, // windows specific directory for each drive (hidden)
|
||||
}
|
||||
|
||||
func isHiddenDirectories(vols ...VolInfo) bool {
|
||||
@ -499,7 +501,7 @@ func formatXLFixDeploymentID(endpoints Endpoints, storageDisks []StorageAPI, ref
|
||||
formats, sErrs := loadFormatXLAll(storageDisks, false)
|
||||
for i, sErr := range sErrs {
|
||||
if _, ok := formatCriticalErrors[sErr]; ok {
|
||||
return fmt.Errorf("Disk %s: %w", endpoints[i], sErr)
|
||||
return config.ErrCorruptedBackend(err).Hint(fmt.Sprintf("Clear any pre-existing content on %s", endpoints[i]))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/dustin/go-humanize"
|
||||
"github.com/minio/minio/cmd/config"
|
||||
xhttp "github.com/minio/minio/cmd/http"
|
||||
"github.com/minio/minio/cmd/logger"
|
||||
"github.com/minio/minio/cmd/rest"
|
||||
@ -227,7 +228,7 @@ func connectLoadInitFormats(retryCount int, firstDisk bool, endpoints Endpoints,
|
||||
// Check if we have
|
||||
for i, sErr := range sErrs {
|
||||
if _, ok := formatCriticalErrors[sErr]; ok {
|
||||
return nil, nil, fmt.Errorf("Disk %s: %w", endpoints[i], sErr)
|
||||
return nil, nil, config.ErrCorruptedBackend(err).Hint(fmt.Sprintf("Clear any pre-existing content on %s", endpoints[i]))
|
||||
}
|
||||
// not critical error but still print the error, nonetheless, which is perhaps unhandled
|
||||
if sErr != errUnformattedDisk && sErr != errDiskNotFound && retryCount >= 5 {
|
||||
|
Loading…
Reference in New Issue
Block a user