diff --git a/src/appstore.js b/src/appstore.js index fb4f80d76..862d982fa 100644 --- a/src/appstore.js +++ b/src/appstore.js @@ -164,7 +164,8 @@ function sendAliveStatus(data, callback) { provider: result[settings.TLS_CONFIG_KEY].provider }, backupConfig: { - provider: result[settings.BACKUP_CONFIG_KEY].provider + provider: result[settings.BACKUP_CONFIG_KEY].provider, + hardlinks: !result[settings.BACKUP_CONFIG_KEY].noHardlinks }, mailConfig: { enabled: result[settings.MAIL_CONFIG_KEY].enabled diff --git a/src/storage/filesystem.js b/src/storage/filesystem.js index 9ba9f75f0..bc47e9902 100644 --- a/src/storage/filesystem.js +++ b/src/storage/filesystem.js @@ -107,7 +107,8 @@ function copy(apiConfig, oldFilePath, newFilePath) { if (error) return events.emit('done', new BackupsError(BackupsError.EXTERNAL_ERROR, error.message)); // this will hardlink backups saving space - shell.exec('copy', '/bin/cp', [ '-al', oldFilePath, newFilePath ], { }, function (error) { + var cpOptions = apiConfig.noHardlinks ? '-a' : '-al'; + shell.exec('copy', '/bin/cp', [ cpOptions, oldFilePath, newFilePath ], { }, function (error) { if (error) return events.emit('done', new BackupsError(BackupsError.EXTERNAL_ERROR, error.message)); events.emit('done', null); @@ -159,6 +160,8 @@ function testConfig(apiConfig, callback) { if (!apiConfig.backupFolder) return callback(new BackupsError(BackupsError.BAD_FIELD, 'backupFolder is required')); + if ('noHardlinks' in apiConfig && typeof apiConfig.noHardlinks !== 'boolean') return callback(new BackupsError(BackupsError.BAD_FIELD, 'noHardlinks must be boolean')); + fs.stat(apiConfig.backupFolder, function (error, result) { if (error) { debug('testConfig: %s', apiConfig.backupFolder, error); diff --git a/webadmin/src/views/settings.html b/webadmin/src/views/settings.html index dd45a6ec4..04ba3531b 100644 --- a/webadmin/src/views/settings.html +++ b/webadmin/src/views/settings.html @@ -146,6 +146,14 @@

+
+ +
+
diff --git a/webadmin/src/views/settings.js b/webadmin/src/views/settings.js index f5b140b4c..b02a19ec5 100644 --- a/webadmin/src/views/settings.js +++ b/webadmin/src/views/settings.js @@ -327,6 +327,7 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca backupFolder: '', retentionSecs: 7 * 24 * 60 * 60, acceptSelfSignedCerts: false, + useHardlinks: true, format: 'tgz', clearForm: function () { @@ -340,6 +341,7 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca $scope.configureBackup.retentionSecs = 7 * 24 * 60 * 60; $scope.configureBackup.format = 'tgz'; $scope.configureBackup.acceptSelfSignedCerts = false; + $scope.configureBackup.useHardlinks = true; }, show: function () { @@ -358,6 +360,7 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca $scope.configureBackup.retentionSecs = $scope.backupConfig.retentionSecs; $scope.configureBackup.format = $scope.backupConfig.format; $scope.configureBackup.acceptSelfSignedCerts = !!$scope.backupConfig.acceptSelfSignedCerts; + $scope.configureBackup.useHardlinks = !$scope.backupConfig.noHardlinks; $('#configureBackupModal').modal('show'); }, @@ -397,6 +400,7 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca } } else if (backupConfig.provider === 'filesystem') { backupConfig.backupFolder = $scope.configureBackup.backupFolder; + backupConfig.noHardlinks = !$scope.configureBackup.useHardlinks; } Client.setBackupConfig(backupConfig, function (error) {