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

Forum Discussion

Sandshark's avatar
Sandshark
Sensei - Experienced User
Mar 30, 2016
Solved

Inaccurate reporting of used/free volume space

I have been moving all of my legacy equipment from OS 4.2.x to 6.4.2, so I have to factory default each of them with the new OS.  As I do so, I've been making sure I have a new backup of data before ...
  • Sandshark's avatar
    Sandshark
    Apr 05, 2016

    OK, so now that all of the back-and-forth transferring of files is done, I did some more looking into things.  It turns out I still had about 1TB of "misssing" space that I mistaklenly thought was accounted for in private shares.  (See my message in Idea Exchange about adding private share usage to the Shares page.).

     

    Well, it turns out that this really is the nature of the beast.  And the name of that beast is BTRFS.  Once I learned that the standard Linux tools for checking drive space won't tell the whole story about BTRFS and a bit about B-Trees, metadata, and such, it turns out that OS6 is reporting exactly what BTRFS is telling it.  As I went on experimenting, I used a mix of BTRFS in SSH and Frontview to check space, and they always agreed.  Frontview just also doesn't give you the whole story -- the unbalanced part of the metadata that's still taking up space.

     

    It seems that metadata can use up allocated space while disconnected (my term) from any real or snapshot data.  That results in an unbalanced system -- for which a balance is the cure.  But it also seems like the balance available in the Frontview UI is not a complete balance.  It even says it reclaims only chunks with 50% or less use.  It also seems that not all space reclaimed by a balance is immediately visible, but that either time or a reboot is required (I rebooted, so don't know if time would have done the same thing.

     

    So, what is the best way to end up in this pickle with an unbalanced system?  Do exactly what I did -- delete a large group of files and then immediately start refilling that space before the system can balance itself out.  Note to self: Don't do that!  It is unclear to me if or how much this would have been a problem if snapshots were not enabled.  But I don't think it has a lot of effect.

     

    So, where is what i did to get back my lost space: 

     

    First, I ran the balance available in Frontview.  That freed up some space, but not a lot.  I wish I had done a reboot then, as it may have freed more than I realized.  Nothing I found on BTRFS indicated a reboot or unmount/mount should be necessry, but it certainhly had a big effect when I finally did.

     

    Having not freed as much as I thought it would, I then went to SSH and started successively commanding a balance with larger and larger dusage options, such as:

    btrfs balance start -dusage=55 /data

     

    Until I got past 50, it didn't free anything, so I think that's what is done in Frontview.  Plus, that matches the comment when you run it.  The tradeoff is time, so i can see why a complete balance would not be the standard.

     

    But I went all the way to dusage=100 and still wasn't seeing all my space.  Finally, I saw somewhere that the following does a complete balance:

    btrfs balance start /mnt

    And, sure enough, that said it relocated the most yet (12 out of 12 chunks), though it took a good long while to do it.  But there was still a lot of space missing.  Here is where I decided to reboot.  And, low and behold, all my precious space was back once I did.  At what point a reboot would have shown most of it already reclaimed, I unfortunately do not know.

     

     

    So, for those who have "lost" space, try a rebalance and reboot.  But it might be nice to have options in Fronftview as to the depth of the balance and an easy way to assess the unbalance without going to SSH.  My leagcy systems were out of warranty long before I moved them to OS6, so dropping down to SSH is not an issue for me.  But for many, it would be.  Also, I knew if all else failed or I made things worse, I could factory default this system.

     

    For those interested, I got most of my newfound BTRFS knowlege here: https://btrfs.wiki.kernel.org/index.php/Main_Page

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