Check space left of the backup drive

I use an USB HDD for the backup. Because the HDD is mounted only during the backup I can’t see how much space is left. Is there a possibility to make this information visible in the dash board?

I know how I can get the information via CLI but this is a work I like to prevent. Start Putty, login, mount the USB HDD, check the space, umount the HDD and log out.

3 Likes

Adding a line with usb disk space usage at the bottom of the email backup report could be a valid workaround? That would be easy.
Something like:

===== Report for data backup =====

Backup started at 2015-10-21 01:00:16
Pre backup scripts status: SUCCESS
Post backup scripts status: SUCCESS
Backup status: SUCCESS
Backup ended at 2015-10-21 01:49:20
Time elapsed: 0 hours, 49 minutes, 4 seconds

Disk usage:
Size  Used Avail Use%
2.7T  2.3T  413G  85%
5 Likes

Yes it is @filippo_carletti but put this information within the dashboard, as @WillZen suggested, would be better :wink:

2 Likes

Under Last backup

Disk usage:
Size: 2.7T
Used: 2.3T
Avail: 413G
Use%: 85%

1 Like

Good idea, thank you both. It’s a bit harder, but I think I can do it.
Maybe I could add the info in both places: email and dashboard.

6 Likes

You are the best :trophy:

2 Likes

Issue on file:
http://dev.nethserver.org/issues/3303

2 Likes

@filippo_carletti
When will it be integrated in the dashboard?

This seems a “junior” job that could be used as a developer training test.

Let’s start with the analysis.

  1. Are we going to implement only disk usage only in the email, only in the dashboard or both?
  2. how could we show it in the email?
  3. and in the dashboard?

The backup process is split in 3 steps:

  1. pre-backup to dump db and mount backup destination
  2. data copy
  3. post-backup to clean db dumps and unmount

I’d add an action to the pre-backup phase to “record” somewhere disk usage after mount.

Then, we need to find a way to insert the information in the email report and the dashboard.
Caution: the disk usage on the dashboard is recorded at time of backup, it’s not calculated when you login to the dashboard.
Also, we could add the action in the post-backup instead of pre-backup to report disk usage after the backup (maybe is better).

Those are the first things that came to my mind, any other issue I may have forgotten?
Any more hints?

I would do it after the backup because this is the information the admin will need.

The dashboard is for me the place where all necessary information about the server situation should be visible. If an email report is send than it should be in there as well.

I also think so, any junior_dev around? @dz00te @Ctek @sitz

Ok, I’ll try “to fit the bill” :slight_smile:
The only issue i can see if the time. I can allocate time in the evening, if you guys agree

I agree :+1: You’re our backup expert here as well :smile:

:slight_smile: I think it is for the normal backup but it can be for both Normal and config :smile:
I’ll have to think about the logic for this so it will be ok and not "complicated/clumsy "
Maybe if @filippo_carletti will have some time in the evenings we can solve this issue quickly.

I’m already doing “research” :smiley: on how to do this

1 Like

I have attached the action to save on file disk usage after backup to issue 3303.

I don’t know how to show info on the dashboard.

Hi @filippo_carletti, Is the storage mounted before the bkp and unmounted after ?
Because if it is always mounted is a simpler solution then the later.

Hi @Ctek
as fare as I know is the storage mounted only during the back up.
At the moment I work via CLI and mount my USB drive, check the space and umount it again.

On dashboard we have Last backup info, there we can add space left and before unmount make df and put this data to db.

1 Like

Hi NAS, this is one solution.
Another (the one I’m looking into now) is to have the setting for the volume that is holding the backups read from the db, then see the free space of that volume.
After the info of free space in the Dashboard is updated, the volume is released.

This will make the information more “live” and accurate, but it will pose the problem of mounting/unmounting the volume every time you access the Dashboard.

I took this into account because in the method you specified, the read is from a file that was created at the moment of the backup, and a lot can change on the target volume from then until the new backup. (files can be added to that volume and space can decrease).

So a more frequent read of that volume’s free space seems more logical to me.

Since the target device should be used for backup only, I think that a script inside the post-backup is enough accurate.
Tomorrow I would like to give a try to Filippo proposal.

If it works, I could share step-by-step tutorial how to integrate it.