Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pool usage misreported #1454

Closed
sfranzen opened this issue Sep 29, 2016 · 1 comment · Fixed by #1460
Closed

Pool usage misreported #1454

sfranzen opened this issue Sep 29, 2016 · 1 comment · Fixed by #1460

Comments

@sfranzen
Copy link
Contributor

While testing the coloured progress bars for the dashboard, I filled one pool ("pool1") entirely with data:

[root@rockstorvm share1]# dd if=/dev/zero of=data bs=1M count=2k
dd: error writing ‘data’: No space left on device
1808+0 records in
1807+0 records out
1894776832 bytes (1.9 GB) copied, 5.78675 s, 327 MB/s

The result is that, although the pool cannot store more data, it doesn't look alarmingly full (a red colour is triggered above 90%):
Imgur

It happens because the pool reports the size of its file contents, while some space is also reserved by btrfs:

[root@rockstorvm share1]# btrfs fi show .
Label: 'pool1'  uuid: 6609efe9-6275-427c-baa9-bb0fa8528d63
        Total devices 1 FS bytes used 1.77GiB
        devid    1 size 2.00GiB used 2.00GiB path /dev/sdb

This example is a bit contrived with my tiny virtual disks, but nonetheless I would like the dashboard to show accurately when a pool is nearly full and therefore in need of management, so I'll go have a look at the pool code.

Perhaps in the future it would also be nice to display the btrfs data/metadata in more detail, on the individual pool views.

@sfranzen
Copy link
Contributor Author

sfranzen commented Oct 4, 2016

Ok, after some investigation it turns out we have two issues:

  • The space allocated for btrfs metadata and system data (i.e. not necessarily fully used) is not reported as used space, even though it is not available for regular data;
  • The total size reported for some RAID configurations is not correct, especially with unequal disk sizes.

Luckily an algorithm is available that should work in all of these cases. The author posted it to the btrfs mailing list a while ago and also has a javascript implementation on his btrfs space allocator website. I've translated it to Python and will soon test it on some virtual disk arrays.

sfranzen added a commit to sfranzen/rockstor-core that referenced this issue Oct 5, 2016
Partial fix of rockstor#1454.

This algorithm should give an accurate report of the maximum available
space in a storage pool, regardless of raid configuration and disk
sizes. It will replace the current figure reported by btrfs.pool_usage.
sfranzen added a commit to sfranzen/rockstor-core that referenced this issue Oct 5, 2016
Fixes the other part of rockstor#1454.

New behaviour is to return only the used space value, but this now also
includes space reserved by btrfs and unavailable for data.
sfranzen added a commit to sfranzen/rockstor-core that referenced this issue Oct 9, 2016
Partial fix of rockstor#1454.

This algorithm should give an accurate report of the maximum available
space in a storage pool, regardless of raid configuration and disk
sizes. It will replace the current figure reported by btrfs.pool_usage.
sfranzen added a commit to sfranzen/rockstor-core that referenced this issue Oct 9, 2016
Fixes the other part of rockstor#1454.

New behaviour is to return only the used space value, but this now also
includes space reserved by btrfs and unavailable for data.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant