× NETGEAR will be terminating ReadyCLOUD service by July 1st, 2023. For more details click here.
Orbi WiFi 7 RBE973
Reply

OS6: get percentage data used

mauricenl
Aspirant

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

 

Message 1 of 3

Accepted Solutions
StephenB
Guru

Re: OS6: get percentage data used


@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).

 

 

 

 

View solution in original post

Message 2 of 3

All Replies
StephenB
Guru

Re: OS6: get percentage data used


@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).

 

 

 

 

Message 2 of 3
mauricenl
Aspirant

Re: OS6: get percentage data used

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.

Message 3 of 3
Top Contributors
Discussion stats
  • 2 replies
  • 702 views
  • 1 kudo
  • 2 in conversation
Announcements