Aim for 60% used space

This commit is contained in:
Girish Ramakrishnan
2020-11-02 23:42:53 -08:00
parent b5a83ab902
commit e68db4ce57

View File

@@ -73,7 +73,7 @@ function checkPreconditions(apiConfig, dataLayout, callback) {
if (result.mountpoint === '/') return callback(new BoxError(BoxError.FS_ERROR, `${apiConfig.backupFolder} is not mounted`));
}
const needed = used + (1024 * 1024 * 1024); // check if there is atleast 1GB left afterwards
const needed = 0.6 * used + (1024 * 1024 * 1024); // check if there is atleast 1GB left afterwards. aim for 60% because rsync/tgz won't need full 100%
if (result.available <= needed) return callback(new BoxError(BoxError.FS_ERROR, `Not enough disk space for backup. Needed: ${prettyBytes(needed)} Available: ${prettyBytes(result.available)}`));
callback(null);