notifiarr icon indicating copy to clipboard operation
notifiarr copied to clipboard

Add quota grab to snapshot

Open notifiarr-bot opened this issue 2 years ago • 1 comments

hello! since I run the client on a shared linux server, is there any way to check the free space allocated to my user with something like quota -s via Snapshot? "Monitor Space" monitors the whole drive which is shared with other users. I don't have root access FYI

Origin user: † † † Origin message: Discord Server Link Reporting user: TwitchCaptain Reporting message: Discord Server Link

notifiarr-bot avatar Aug 10 '22 18:08 notifiarr-bot

output of quota -s:

Disk quotas for user mrrobot (uid 1034): 
     Filesystem   space   quota   limit   grace   files   quota   limit   grace
      /dev/sda1    869G   3725G   3725G           40922       0       0        

solid-pixel avatar Aug 10 '22 18:08 solid-pixel

@solid-pixel Can you play with the --format option and see if you can produce something more machine parseable? Let me know if you need pointers.

I have not dealt with a quota in a long time. What data would you like to actually see? Is a percentage of quota and space sufficient? I'll probably just parse and send all of this and @austinwbest will have to figure out how to display it, so give us some hints! note: some folks may have more than 1 file system show up.

davidnewhall avatar Aug 13 '22 11:08 davidnewhall

@davidnewhall hi and thank you for picking this up so quickly!

I'm not sure this is what you want as I don't know a great deal about Linux, but here you go:

Supported formats are:
  vfsold - original quota format
  vfsv0 - standard quota format
  vfsv1 - quota format with 64-bit limits
  rpc - use RPC calls
  xfs - XFS quota format

mrrobot@polaris:/home1/mrrobot$ quota --format=vfsold
Disk quotas for user mrrobot (uid 1034): 
     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
      /dev/sda1 915626408  3905945600 3905945600           41322       0       0        

mrrobot@polaris:/home1/mrrobot$ quota --format=vfsv0
Disk quotas for user mrrobot (uid 1034): 
     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
      /dev/sda1 915626412  3905945600 3905945600           41322       0       0        

mrrobot@polaris:/home1/mrrobot$ quota --format=vfsv1
Disk quotas for user mrrobot (uid 1034): 
     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
      /dev/sda1 915626452  3905945600 3905945600           41322       0       0        

mrrobot@polaris:/home1/mrrobot$ quota --format=rpc

mrrobot@polaris:/home1/mrrobot$ quota --format=xfs

mrrobot@polaris:/home1/mrrobot$ 

and with the -s option:

mrrobot@polaris:/home1/mrrobot$ quota --format=vfsold -s
Disk quotas for user mrrobot (uid 1034): 
     Filesystem   space   quota   limit   grace   files   quota   limit   grace
      /dev/sda1    874G   3725G   3725G           41324       0       0        

mrrobot@polaris:/home1/mrrobot$ quota --format=vfsv0 -s
Disk quotas for user mrrobot (uid 1034): 
     Filesystem   space   quota   limit   grace   files   quota   limit   grace
      /dev/sda1    874G   3725G   3725G           41324       0       0        

mrrobot@polaris:/home1/mrrobot$ quota --format=vfsv1 -s
Disk quotas for user mrrobot (uid 1034): 
     Filesystem   space   quota   limit   grace   files   quota   limit   grace
      /dev/sda1    874G   3725G   3725G           41324       0       0        

mrrobot@polaris:/home1/mrrobot$ quota --format=rpc -s

mrrobot@polaris:/home1/mrrobot$ quota --format=xfs -s

mrrobot@polaris:/home1/mrrobot$ 

and a more verbose output:

mrrobot@polaris:/home1/mrrobot$ quota -v
Disk quotas for user mrrobot (uid 1034): 
     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
     /dev/sdai1       0  3905945600 3905945600               0       0       0        
      /dev/sdj1       0  3905945600 3905945600               0       0       0        
      /dev/sdb1       0  3905945600 3905945600               0       0       0        
     /dev/sdag1       0  3905945600 3905945600               0       0       0        
      /dev/sdh1       0  3905945600 3905945600               0       0       0        
      /dev/sdt1       0  3905945600 3905945600               0       0       0        
      /dev/sdw1       0  3905945600 3905945600               0       0       0        
     /dev/sdaf1       0  3905945600 3905945600               0       0       0        
      /dev/sdy1       0  3905945600 3905945600               0       0       0        
      /dev/sdo1       0  3905945600 3905945600               0       0       0        
      /dev/sdm1       0  3905945600 3905945600               0       0       0        
      /dev/sda1 915625296  3905945600 3905945600           41322       0       0        
      /dev/sdk1       0  3905945600 3905945600               0       0       0        
      /dev/sdg1       0  3905945600 3905945600               0       0       0        
      /dev/sdl1       0  3905945600 3905945600               0       0       0        
      /dev/sdf1       0  3905945600 3905945600               0       0       0        
     /dev/sdad1       0  3905945600 3905945600               0       0       0        
      /dev/sdc1       0  3905945600 3905945600               0       0       0        
     /dev/sdac1       0  3905945600 3905945600               0       0       0        
      /dev/sde1       0  3905945600 3905945600               0       0       0        
      /dev/sds1       0  3905945600 3905945600               0       0       0        
      /dev/sdr1       0  3905945600 3905945600               0       0       0        
      /dev/sdd1       0  3905945600 3905945600               0       0       0        
      /dev/sdi1       0  3905945600 3905945600               0       0       0        
      /dev/sdv1       0  3905945600 3905945600               0       0       0        
     /dev/sdae1       0  3905945600 3905945600               0       0       0        
      /dev/sdu1       0  3905945600 3905945600               0       0       0        
     /dev/sdaj1       0  3905945600 3905945600               0       0       0        
     /dev/sdah1       0  3905945600 3905945600               0       0       0        
     /dev/sdaa1       0  3905945600 3905945600               0       0       0        
      /dev/sdp1       0  3905945600 3905945600               0       0       0        
      /dev/sdz1       0  3905945600 3905945600               0       0       0        
      /dev/sdq1       0  3905945600 3905945600               0       0       0        
      /dev/sdx1       0  3905945600 3905945600               0       0       0        
      /dev/sdn1       0  3905945600 3905945600               0       0       0        
     /dev/sdab1       0       0       0               0       0       0        

To answer your question, I would like (if possible) to use this through Snapshots and alert me only if Storage Free <= XX% or Storage Free <= XXXGB (either option is fine). If that's not possible, it would be enough to have the available space remaining in my quota showing up in the daily Snapshot. Either percentage or GB/MB/whatever are fine, as long as I can see at a glance if I'm about to hit my cap.

Does this all make sense to you?

Feel free to hit me up on Discord if you need to, only I won't be available for the next few hours.

Thanks a lot! Pelly

solid-pixel avatar Aug 13 '22 11:08 solid-pixel

Thanks for the extra data! Can you be more specific when you say "storage free" ? Storage free is not one of the header columns; tell me how you calculate that in your head. I just don't want to assume I know what these columns are.

davidnewhall avatar Aug 13 '22 14:08 davidnewhall

Sorry for the miscommunication :D

By Storage Free I meant this setting in the Snapshot integration setup:

image

So my initial request was: is it possible to have this setting look into quota instead of the whole drive to see how much storage is left?

Taking this output into account:

$ quota -s
Disk quotas for user mrrobot (uid 1034): 
     Filesystem   space   quota   limit   grace   files   quota   limit   grace
      /dev/sda1    942G   3725G   3725G           41557       0       0        

the space column is how much storage is being used. the quota column is the amount of storage that's been assigned to my user, which we can treat as the disk size essentially. So to get the Storage (Free in GB) you'd have to calculate (quota - space).

This would allow me to set a trigger that notifies me when the unused storage (the difference between space and quota) is below the amount I specify .

If that's not possible, then having a row for Quota like the Storage one here would still be better than nothing, although being able to set up a trigger would be amazing :P

image

Hope this clears your doubts :)

solid-pixel avatar Aug 14 '22 10:08 solid-pixel