backups: Handle error when there is not enough space on disk

Tests:

- Fill up disk to have very little space left. Perform a large backup operation
by writing a large file to one of the directories to be backed up. Try to
perform the backup and notice that a nice error message is shown that there is
not enough disk space instead of a generic error message.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2025-01-06 10:32:47 -08:00 committed by James Valleroy
parent 055e7603b2
commit 872e161ec2
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
2 changed files with 9 additions and 0 deletions

View File

@ -33,3 +33,7 @@ class BorgArchiveDoesNotExist(BorgError):
class BorgBusy(BorgError): class BorgBusy(BorgError):
"""Borg could not acquire lock being busy with another operation.""" """Borg could not acquire lock being busy with another operation."""
class BorgNoSpace(BorgError):
"""There is not enough space left on the device to perform operation."""

View File

@ -87,6 +87,11 @@ KNOWN_ERRORS = [
'message': _('Backup system is busy with another operation.'), 'message': _('Backup system is busy with another operation.'),
'raise_as': errors.BorgBusy, 'raise_as': errors.BorgBusy,
}, },
{
'errors': ['No space left on device'],
'message': _('Not enough space left on the disk or remote location.'),
'raise_as': errors.BorgNoSpace,
},
] ]