NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
mauricenl
May 17, 2020Aspirant
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
- StephenBGuru - 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).
Related Content
NETGEAR Academy

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