NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.

Forum Discussion

mauricenl's avatar
mauricenl
Aspirant
May 17, 2020
Solved

OS6: get percentage data used

Hi,

 

On the commandline, using df I can easily find the percentage used of my nas. However, this includes spaces taken for snapshots. Is there an (easy) way to get the percentage used without the amount for snapshots, in a bash script on the commandline?

 

Thank you

 


  • mauricenl wrote:

     

    On the commandline, using df I can easily find the percentage used of my nas.

     


    If you are talking about the data volume, then you'd want to use btrfs fi df and not df.

     


    mauricenl wrote:

    Is there an (easy) way to get the percentage used without the amount for snapshots, in a bash script on the commandline?

     


    You'd think there would be something easy built into BTRFS, but there isn't.  The simplest way is to look at the shares page in the NAS admin UI (or on the volume page for the full volume).  Quota needs to be enabled on the volume.

     

    There is a script here that works, but it will only give you the details of the snapshot use on the entire volume - not a subvolume (e.g., a share):  https://ownyourbits.com/2017/12/06/check-disk-space-of-your-btrfs-snapshots-with-btrfs-du/

     

    Quota does need to be enabled for the script to work.  Use at your own risk of course.

     

    There is a similar script called btrfs-size - it runs quite a bit more slowly, and it needs to be modified to run on the NAS (all the sudos need to be removed).

     

     

     

     

2 Replies

Replies have been turned off for this discussion
  • StephenB's avatar
    StephenB
    Guru - Experienced User

    mauricenl wrote:

     

    On the commandline, using df I can easily find the percentage used of my nas.

     


    If you are talking about the data volume, then you'd want to use btrfs fi df and not df.

     


    mauricenl wrote:

    Is there an (easy) way to get the percentage used without the amount for snapshots, in a bash script on the commandline?

     


    You'd think there would be something easy built into BTRFS, but there isn't.  The simplest way is to look at the shares page in the NAS admin UI (or on the volume page for the full volume).  Quota needs to be enabled on the volume.

     

    There is a script here that works, but it will only give you the details of the snapshot use on the entire volume - not a subvolume (e.g., a share):  https://ownyourbits.com/2017/12/06/check-disk-space-of-your-btrfs-snapshots-with-btrfs-du/

     

    Quota does need to be enabled for the script to work.  Use at your own risk of course.

     

    There is a similar script called btrfs-size - it runs quite a bit more slowly, and it needs to be modified to run on the NAS (all the sudos need to be removed).

     

     

     

     

    • mauricenl's avatar
      mauricenl
      Aspirant

      Thank you StephenB for the quick reply, and pointing me to the btrfs command. I am indeed seeking for info on the data volume.

       

      I now take the output of btrfs fi us /data -b but understand that this gives only an estimate on the free space.

NETGEAR Academy

Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology! 

Join Us!

ProSupport for Business

Comprehensive support plans for maximum network uptime and business peace of mind.

 

Learn More