diff --git a/cmd/config/constants.go b/cmd/config/constants.go index 856e59a6c..0538656a8 100644 --- a/cmd/config/constants.go +++ b/cmd/config/constants.go @@ -35,6 +35,8 @@ const ( EnvArgs = "MINIO_ARGS" EnvDNSWebhook = "MINIO_DNS_WEBHOOK_ENDPOINT" + EnvRootDiskThresholdSize = "MINIO_ROOTDISK_THRESHOLD_SIZE" + EnvUpdate = "MINIO_UPDATE" EnvEndpoints = "MINIO_ENDPOINTS" // legacy diff --git a/cmd/xl-storage.go b/cmd/xl-storage.go index b670e504c..f87d4da1a 100644 --- a/cmd/xl-storage.go +++ b/cmd/xl-storage.go @@ -260,6 +260,25 @@ func newXLStorage(ep Endpoint) (*xlStorage, error) { if err != nil { return nil, err } + if !rootDisk { + // If for some reason we couldn't detect the + // root disk use - MINIO_ROOTDISK_THRESHOLD_SIZE + // to figure out if the disk is root disk or not. + if rootDiskSize := env.Get(config.EnvRootDiskThresholdSize, ""); rootDiskSize != "" { + info, err := disk.GetInfo(path) + if err != nil { + return nil, err + } + size, err := humanize.ParseBytes(rootDiskSize) + if err != nil { + return nil, err + } + // size of the disk is less than the threshold or + // equal to the size of the disk at path, treat + // such disks as rootDisks and reject them. + rootDisk = info.Total <= size + } + } p := &xlStorage{ diskPath: path,