Check space left of the backup drive

Hi @giacomo , we also have to think about what happens if you change the drives (have more than one USB hdd) and what to do in case the file that keeps the info is deleted, not available or something else.
The read will have to default to something else or the process can fail (it gets the value of 0 available space).

Why we should do mount umnount? Maybe it is better to mount permanently?

@Nas
From the risk management it is not good. If e.g. virus find a way to encrypt your data and the backup drive is mounted it will be encrypted as well.
The best would be to mirror the backup drive to a outside location. If the building burns down a copy of the company data would still exist. To prevent that an non authorises person read the data it should be encrypted. To play the backup in would be an additional step before you can do but this would be only for a disaster recovery :smile:

1 Like

For security reasons. The backup data should not be available if possibile (think about cryptolocker).

Iā€™m not sure this is the most horrible code Iā€™ve ever written, but itā€™s close to it. :smile:
Itā€™s mostly c&p from other files or the net.
Download the file to a NethServer 6.7:

wget http://nethservice.nethesis.it/backup-du.tar.gz

Extract:

tar -zxvf backup-du.tar.gz -C /

Force a backup or wait a scheduled run:

/sbin/e-smith/backup-data

Check the backup email (please, set the backup to always send an email)
Check the dashboard.

Todo

  • translations
3 Likes

going under review :slight_smile:

Where? How can we test it out? :smile:

Itā€™s not working with USB?

Hi @filippo_carletti,

I think that another condition should be made to this code to create the file if it does not exist.

if (-f '/var/lib/nethserver/backup/disk_usage') { $content .= "\n--------------[ Disk Usage ]--------------\n"; open (FILE, '/var/lib/nethserver/backup/disk_usage'); while () { $content.=$_; } close FILE; $content .= "\n"; }

Or instead of a file we could put the information into DB. What do you think ?

It should. I think youā€™ve found a problem. Iā€™ve tested it with cifs, give me some time to setup a usb backup.

1 Like

I tested the backup disk usage customization on usb and it works correctly.

Hi Filippo,

It works but look what is happening on my NS (System version: NethServer release 6.7 (final); Kernel release: 2.6.32-573.18.1.el6.x86_64), backup to USB (8GB):

  1. Disk usage is not showing.
  2. The settings are for daily incremental backup at 01:00 and full backup on Sunday: full backup not done, only incremental (please see the attached pictures).
  3. I followed your instructions from post 25.

EDIT for point 2:
Type: Incremental with full backup option for Sunday.

Maybe the backup is made but how I can know if the backup was full?
Neither in email report is not written.
Itā€™s implicit if the settings are for Incremental with full on any day of the week, in that day, the backup was full?
Can you add on section Last backup a line with the information about the type of the backup? Or at least in the email report.

Backup: general information about the backup configuration
Last backup: informations about the last backup + new line about the type of the last backup: Full (when the general settings are for Full or Incremental + day for full); Incremental for the other days.
Disk usage: informations about the backup location.

Kind regards,
Gabriel

Tried to implement this feature on NethServer 7. Didnā€™t know which method to choose to store the stats (file or db), so I followed @filippo_carlettiā€™s example and gone with a file, but we could think to use the db if itā€™s more appropriate or convenient. No real-time stats.

6 Likes

Donā€™t give up man :slight_smile: I definitely love your enhancements

@dnutan
Why isnā€™t it a real-time status if you show the data after the backup is done?

Stats are only taken after a backup task.
If the storage is not used exclusively for NethServer backups the stats reported on the dashboard may differ from the real available storage capacity.

@dnutan
I wouldnā€™t use a storage shared with other application. Backup are too important and I would spend one storage space exclusive for it.

2 Likes

May I create a PR for code review and testing, or should we discuss further where to store the stats or take into account other considerations?

2 Likes

Letā€™s see the code :heart_eyes:

Where is the PR? Canā€™t wait to see it :slight_smile: