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
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.
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
going under review
Where? How can we test it out?
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.
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):
- Disk usage is not showing.
- 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).
- 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.
Donāt give up man 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.
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?
Letās see the code
Where is the PR? Canāt wait to see it