cyberpanel icon indicating copy to clipboard operation
cyberpanel copied to clipboard

[BUG] Backup v2 fails with /home partition

Open SaJeTek-Developer opened this issue 10 months ago • 0 comments

There are 2 issues with the backup v2 I'll discuss. The issue may not occur on majority of VPS but on dedicated servers where custom partitions are made.

Issue #1. In Backupsv2.py within "InitiateBackup" we have the following line to check for free space

self.CurrentFreeSpaceOnDisk = int( ProcessUtilities.outputExecutioner("df -m / | awk 'NR==2 {print $4}'", 'root', True).rstrip('\n'))

The problem here is that on checking the remaining space, the partition / is checked for remaining space but the following line is set based on a default of "/home/backup"

self.FinalPathRuctic = f"{self.data['BasePath']}/{self.website.domain}"

In a case where one of my dedicated servers with custom partitioning has 43GB free on / but 250+GB on /home/ my backups fail for a 54GB site because there is no space on the / partition although the backup dir is /home/backup.

It would be more appropriate to check /home/ as opposed to /

Issue #2

Within the same context and file within "InitiateBackup".

if self.WebsiteDiskUsage > self.CurrentFreeSpaceOnDisk:
                    self.UpdateStatus(f'Not enough disk space on the server to backup this website.',
                                      CPBackupsV2.FAILED)
                    return 0

self.UpdateStatus is called when there is not enough space and the backup is cancelled. CPBackupsV2 is now in a failed state but within the method UpdateStatus the following line is called:

command = f'rm -f {self.FinalPathRuctic}/*.sql'

However: self.FinalPathRuctic has not been set yet in "InitiateBackup". self.FinalPathRuctic shoup be initialized before self.UpdateStatus is called.

Operating system: Centos 7.9

CyberPanel version: 2.3.4

SaJeTek-Developer avatar Oct 27 '23 04:10 SaJeTek-Developer