diff --git a/api-errors.go b/api-errors.go index 75ef7709c..3237e9cb9 100644 --- a/api-errors.go +++ b/api-errors.go @@ -228,7 +228,7 @@ var errorCodeResponse = map[int]APIError{ }, RootPathFull: { Code: "RootPathFull", - Description: "Root path has reached its minimum free disk threshold. Please clear few objects to proceed.", + Description: "Root path has reached its minimum free disk threshold. Please delete few objects to proceed.", HTTPStatusCode: http.StatusInternalServerError, }, } diff --git a/pkg/fs/fs-bucket.go b/pkg/fs/fs-bucket.go index dcdab70c2..ff48f9521 100644 --- a/pkg/fs/fs-bucket.go +++ b/pkg/fs/fs-bucket.go @@ -98,7 +98,9 @@ func (fs Filesystem) MakeBucket(bucket, acl string) *probe.Error { return probe.NewError(err) } - if int64((float64(stfs.Free)/float64(stfs.Total))*100) <= fs.minFreeDisk { + // Remove 5% from total space for cumulative disk space used for journalling, inodes etc. + availableDiskSpace := (float64(stfs.Free) / (float64(stfs.Total) - (0.05 * float64(stfs.Total)))) * 100 + if int64(availableDiskSpace) <= fs.minFreeDisk { return probe.NewError(RootPathFull{Path: fs.path}) } diff --git a/pkg/fs/fs-multipart.go b/pkg/fs/fs-multipart.go index d520e4930..fd94bbff2 100644 --- a/pkg/fs/fs-multipart.go +++ b/pkg/fs/fs-multipart.go @@ -153,7 +153,9 @@ func (fs Filesystem) NewMultipartUpload(bucket, object string) (string, *probe.E return "", probe.NewError(err) } - if int64((float64(stfs.Free)/float64(stfs.Total))*100) <= fs.minFreeDisk { + // Remove 5% from total space for cumulative disk space used for journalling, inodes etc. + availableDiskSpace := (float64(stfs.Free) / (float64(stfs.Total) - (0.05 * float64(stfs.Total)))) * 100 + if int64(availableDiskSpace) <= fs.minFreeDisk { return "", probe.NewError(RootPathFull{Path: fs.path}) } @@ -228,7 +230,9 @@ func (fs Filesystem) CreateObjectPart(bucket, object, uploadID, expectedMD5Sum s return "", probe.NewError(err) } - if int64((float64(stfs.Free)/float64(stfs.Total))*100) <= fs.minFreeDisk { + // Remove 5% from total space for cumulative disk space used for journalling, inodes etc. + availableDiskSpace := (float64(stfs.Free) / (float64(stfs.Total) - (0.05 * float64(stfs.Total)))) * 100 + if int64(availableDiskSpace) <= fs.minFreeDisk { return "", probe.NewError(RootPathFull{Path: fs.path}) } diff --git a/pkg/fs/fs-object.go b/pkg/fs/fs-object.go index 8cf5e33d5..57f053fd9 100644 --- a/pkg/fs/fs-object.go +++ b/pkg/fs/fs-object.go @@ -171,7 +171,9 @@ func (fs Filesystem) CreateObject(bucket, object, expectedMD5Sum string, size in return ObjectMetadata{}, probe.NewError(err) } - if int64((float64(stfs.Free)/float64(stfs.Total))*100) <= fs.minFreeDisk { + // Remove 5% from total space for cumulative disk space used for journalling, inodes etc. + availableDiskSpace := (float64(stfs.Free) / (float64(stfs.Total) - (0.05 * float64(stfs.Total)))) * 100 + if int64(availableDiskSpace) <= fs.minFreeDisk { return ObjectMetadata{}, probe.NewError(RootPathFull{Path: fs.path}) } diff --git a/server-main.go b/server-main.go index 1291aa81f..50aeee7c4 100644 --- a/server-main.go +++ b/server-main.go @@ -247,6 +247,8 @@ func serverMain(c *cli.Context) { var minFreeDisk int64 minFreeDiskSet := false + // Default + minFreeDisk = 10 var expiration time.Duration expirationSet := false