mirror of
https://github.com/minio/minio.git
synced 2025-01-11 23:13:23 -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(
|
ErrUnableToWriteInBackend = newErrFn(
|
||||||
"Unable to write to the backend",
|
"Unable to write to the backend",
|
||||||
"Please ensure MinIO binary has write permissions for the backend",
|
"Please ensure MinIO binary has write permissions for the backend",
|
||||||
|
@ -27,6 +27,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
humanize "github.com/dustin/go-humanize"
|
humanize "github.com/dustin/go-humanize"
|
||||||
|
"github.com/minio/minio/cmd/config"
|
||||||
"github.com/minio/minio/cmd/config/storageclass"
|
"github.com/minio/minio/cmd/config/storageclass"
|
||||||
"github.com/minio/minio/cmd/logger"
|
"github.com/minio/minio/cmd/logger"
|
||||||
"github.com/minio/minio/pkg/color"
|
"github.com/minio/minio/pkg/color"
|
||||||
@ -379,11 +380,12 @@ func saveFormatXL(disk StorageAPI, format interface{}, diskID string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var ignoredHiddenDirectories = map[string]struct{}{
|
var ignoredHiddenDirectories = map[string]struct{}{
|
||||||
minioMetaBucket: {},
|
minioMetaBucket: {}, // metabucket '.minio.sys'
|
||||||
".snapshot": {},
|
".minio": {}, // users may choose to double down the backend as the config folder for certs
|
||||||
"lost+found": {},
|
".snapshot": {}, // .snapshot for ignoring NetApp based persistent volumes WAFL snapshot
|
||||||
"$RECYCLE.BIN": {},
|
"lost+found": {}, // 'lost+found' directory default on ext4 filesystems
|
||||||
"System Volume Information": {},
|
"$RECYCLE.BIN": {}, // windows specific directory for each drive (hidden)
|
||||||
|
"System Volume Information": {}, // windows specific directory for each drive (hidden)
|
||||||
}
|
}
|
||||||
|
|
||||||
func isHiddenDirectories(vols ...VolInfo) bool {
|
func isHiddenDirectories(vols ...VolInfo) bool {
|
||||||
@ -499,7 +501,7 @@ func formatXLFixDeploymentID(endpoints Endpoints, storageDisks []StorageAPI, ref
|
|||||||
formats, sErrs := loadFormatXLAll(storageDisks, false)
|
formats, sErrs := loadFormatXLAll(storageDisks, false)
|
||||||
for i, sErr := range sErrs {
|
for i, sErr := range sErrs {
|
||||||
if _, ok := formatCriticalErrors[sErr]; ok {
|
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"
|
"time"
|
||||||
|
|
||||||
"github.com/dustin/go-humanize"
|
"github.com/dustin/go-humanize"
|
||||||
|
"github.com/minio/minio/cmd/config"
|
||||||
xhttp "github.com/minio/minio/cmd/http"
|
xhttp "github.com/minio/minio/cmd/http"
|
||||||
"github.com/minio/minio/cmd/logger"
|
"github.com/minio/minio/cmd/logger"
|
||||||
"github.com/minio/minio/cmd/rest"
|
"github.com/minio/minio/cmd/rest"
|
||||||
@ -227,7 +228,7 @@ func connectLoadInitFormats(retryCount int, firstDisk bool, endpoints Endpoints,
|
|||||||
// Check if we have
|
// Check if we have
|
||||||
for i, sErr := range sErrs {
|
for i, sErr := range sErrs {
|
||||||
if _, ok := formatCriticalErrors[sErr]; ok {
|
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
|
// not critical error but still print the error, nonetheless, which is perhaps unhandled
|
||||||
if sErr != errUnformattedDisk && sErr != errDiskNotFound && retryCount >= 5 {
|
if sErr != errUnformattedDisk && sErr != errDiskNotFound && retryCount >= 5 {
|
||||||
|
Loading…
Reference in New Issue
Block a user