# Used space gets reset after restart

**URL:** <https://forum.storj.io/t/used-space-gets-reset-after-restart/28408>\
**Category:** troubleshooting\
**Tags:** filewalker, database\
**Created:** [October 31, 2024, 10:38am UTC](https://forum.storj.io/t/used-space-gets-reset-after-restart/28408 "2024-10-31T10:38:41Z")\
**Posts on this page:** 20\
**Page:** 4

<div class="post-metadata">

**Author:** ![Alexey](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/alexey/32/41_2.png) [@Alexey](https://forum.storj.io/u/Alexey)\
**Post date:** [November 23, 2024, 7:53am UTC](https://forum.storj.io/t/used-space-gets-reset-after-restart/28408/61 "2024-11-23T07:53:30Z")

</div>

Ok. I was able to reproduce in `storj-up`.

> <https://github.com/storj/storj/issues/7269>
>
> \<!--
> Please make sure that we do not have any duplicates already open. 
> You ca…n ensure this by searching the issue list for this repository. 
> If there is a duplicate, please close your issue and add a comment to the 
> existing issue instead.
> 
> For more information about reporting issues, see
> https://github.com/storj/storj/blob/main/docs/storagenode/CONTRIBUTING.md
> 
> \---------------------------------------------------
> GENERAL SUPPORT INFORMATION
> \---------------------------------------------------
> 
> The GitHub issue tracker is for bug reports and feature requests.
> General support can be found at the following locations:
> 
> \- Storj Community Forum - https://forum.storj.io
> \- File a ticket at https://support.storj.io/
> 
> \---------------------------------------------------
> BUG REPORT INFORMATION
> \---------------------------------------------------
> \--\>
> 
> \*\*Description\*\*
> After restart of storagenode, the \`used-space-filewalker\` doesn't update the usage since v1.115.4
> 
> See https://forum.storj.io/t/used-space-gets-reset-after-restart/28408?u=alexey
> 
> \*\*Steps to reproduce the issue:\*\*
> 
> 
> 
> 1. used \`storj-up\` environment
> 2. upload several 128MiB files with TTL +2m (or any)
> 3. run \`docker compose exec storagenode1 storagenode dashboard --address=:30002\` to see a dashboard
> 4. Wait for the TTL collector chore to complete (better several hours)
> 5. Check the dashboard - it should show some non-zero value (perhaps the TTL collector doesn't update the usage again or not in all databases - we now have an additional database \`used\_space\_per\_prefix.db\`)
> 6. upload several 128MiB files with TTL
> 7. Make sure, that the usage value on the dashboard has changed
> 8. Restart the node:
> \`\`\`
> docker compose exec storagenode1 rm /var/lib/storj/.local/share/storj/storagenode/storage/trash/.trash-uses-day-dirs-indicator && docker compose restart storagenode1
> \`\`\`
> 9. The value would be the same, which was before uploading additional 128MiB files.
> 10. after the used-space-filewalker has completed the scan, the value will not change.
> 
> \*\*Describe the results you expected:\*\*
> The \`used-space-filewalker\` should calculate the used space correctly
> 
> \*\*Describe the results you received:\*\*
> The \`used-space-filewalker\` was finish in seconds, the used space will be invalid.
> 
> \*\*Possible Fix\*\*
> 
> Remove the \`used\_space\_per\_prefix.db\` database and restart the node, the used space value will be updated correctly.
> 
> \*\*Your environment\*\*
> 
> \- Operating system and version: any
> \- Additional environment details (Raspberry PI, Docker, VMWare, etc.): any

Just need to keep it running for more than 24h.

---

<div class="post-metadata">

**Author:** ![Alexey](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/alexey/32/41_2.png) [@Alexey](https://forum.storj.io/u/Alexey)\
**Post date:** [November 24, 2024, 3:15am UTC](https://forum.storj.io/t/used-space-gets-reset-after-restart/28408/62 "2024-11-24T03:15:47Z")

</div>

@mahir Do you use a dedicated disk feature?

---

<div class="post-metadata">

**Author:** ![snorkel](https://storj.bcdn.literatehosting.com/letter_avatar/snorkel/32/6_449c533f586939b6e5f246632a46421f.png) [@snorkel](https://forum.storj.io/u/snorkel)\
**Post date:** [November 24, 2024, 8:08am UTC](https://forum.storj.io/t/used-space-gets-reset-after-restart/28408/63 "2024-11-24T08:08:43Z")

</div>

I observed this behavior, with file walker finished in ms on one of my nodes too, but I didn’t pay to much importance to it.  
Ubuntu Server, 32GB RAM, no dedicated disk, no lazzy, no badger, 2 nodes on 2 drives, Docker, both with 3TB+ data.  
I started the scan, and short after it finished, an update restarted the node and the scan started again, finishing very quickly. At that time I thought it was normal because the metadata was already cached in RAM. Now it seems there is a bug. I can’t remember if this happened before moving dbes to storage drive, or after. They were on OS m2 SSD. Normaly, the scan takes like 7+ hours.

---

<div class="post-metadata">

**Author:** ![Alexey](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/alexey/32/41_2.png) [@Alexey](https://forum.storj.io/u/Alexey)\
**Post date:** [November 24, 2024, 8:13am UTC](https://forum.storj.io/t/used-space-gets-reset-after-restart/28408/64 "2024-11-24T08:13:48Z")

</div>

The quick scan is not a bug, it’s a feature to speedup the used-space-filewalker even more.

Do you have a discrepancy after it’s finished?

---

<div class="post-metadata">

**Author:** ![snorkel](https://storj.bcdn.literatehosting.com/letter_avatar/snorkel/32/6_449c533f586939b6e5f246632a46421f.png) [@snorkel](https://forum.storj.io/u/snorkel)\
**Post date:** [November 24, 2024, 9:31am UTC](https://forum.storj.io/t/used-space-gets-reset-after-restart/28408/65 "2024-11-24T09:31:53Z")

</div>

Didn’t check at that moment. It seemed right. I believe it looses a few GB, and they are hard to spot on a 3TB node. They are visible on new small nodes.

---

<div class="post-metadata">

**Author:** ![Alexey](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/alexey/32/41_2.png) [@Alexey](https://forum.storj.io/u/Alexey)\
**Post date:** [November 24, 2024, 9:49am UTC](https://forum.storj.io/t/used-space-gets-reset-after-restart/28408/66 "2024-11-24T09:49:28Z")

</div>

Yes, this is only confirms what I have tested.  
The quick used-space-filewalker is not a bug.

However, there are some circumstances, where the difference may occur.

---

<div class="post-metadata">

**Author:** ![mahir](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/mahir/32/7825_2.png) [@mahir](https://forum.storj.io/u/mahir)\
**Post date:** [November 24, 2024, 3:36pm UTC](https://forum.storj.io/t/used-space-gets-reset-after-restart/28408/67 "2024-11-24T15:36:04Z")

</div>

> [@Alexey](#):
>
> @mahir Do you use a dedicated disk feature?

what do you mean with dedicated disk feature?  
its running inside a VM with no extra disk mounted.

---

<div class="post-metadata">

**Author:** ![acoustician](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/acoustician/32/71_2.png) [@acoustician](https://forum.storj.io/u/acoustician)\
**Post date:** [November 25, 2024, 12:19am UTC](https://forum.storj.io/t/used-space-gets-reset-after-restart/28408/68 "2024-11-25T00:19:12Z")

</div>

tried workaround on my node with ~410gb of data, got 357 in dashboard (didn’t help at all)

seems like it’s showing usage after first restart

---

<div class="post-metadata">

**Author:** ![EasyRhino](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/easyrhino/32/1133_2.png) [@EasyRhino](https://forum.storj.io/u/EasyRhino)\
**Post date:** [November 25, 2024, 12:40am UTC](https://forum.storj.io/t/used-space-gets-reset-after-restart/28408/69 "2024-11-25T00:40:26Z")

</div>

is what I’m seeing also the same problem?

1. satellites report .99TB used
2. used space on dashboard reports 1.4TB used.
3. df --si reports 1.8TB used
4. with a restart the used space filewalker finishes in 1 second per node.
5. delete these used\_space\_per\_prefix.db and restart, and filewalker takes normal times (a few hours)
6. dashboard still showing same numbers 0.99TB vs 1.4TB

and i’m using the badger cache on this node, btw.

---

<div class="post-metadata">

**Author:** ![edortaprz](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/edortaprz/32/7831_2.png) [@edortaprz](https://forum.storj.io/u/edortaprz)\
**Post date:** [November 25, 2024, 1:57am UTC](https://forum.storj.io/t/used-space-gets-reset-after-restart/28408/70 "2024-11-25T01:57:17Z")

</div>

“seems like it’s showing usage after first restart” my nodes have same behaviour.

if I check database corruption it say OK but something happend because it fix the issue.

---

<div class="post-metadata">

**Author:** ![Alexey](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/alexey/32/41_2.png) [@Alexey](https://forum.storj.io/u/Alexey)\
**Post date:** [November 25, 2024, 5:44am UTC](https://forum.storj.io/t/used-space-gets-reset-after-restart/28408/71 "2024-11-25T05:44:09Z")

</div>

If you deleted a database and restarted the node, then you need to wait until the used-space-filewalker would finish the scan for all trusted satellites (search for `used-space` and `completed`).

---

<div class="post-metadata">

**Author:** ![Alexey](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/alexey/32/41_2.png) [@Alexey](https://forum.storj.io/u/Alexey)\
**Post date:** [November 25, 2024, 5:51am UTC](https://forum.storj.io/t/used-space-gets-reset-after-restart/28408/72 "2024-11-25T05:51:23Z")

</div>

> [@EasyRhino](#):
>
> is what I’m seeing also the same problem?
> 
> 1. satellites report .99TB used
> 2. used space on dashboard reports 1.4TB used.
> 3. df --si reports 1.8TB used

No, there is discussed a difference between the usage on the piechart and the usage reported by OS. In your case 1.8TB vs 1.4TB.

The difference between the satellites reports and the actual usage is likely related either to a missing reports from the satellites or not collected garbage (for example, your node didn’t receive or yet processed the Bloom Filters from the satellites).

> [@EasyRhino](#):
>
> - with a restart the used space filewalker finishes in 1 second per node.
> - delete these used\_space\_per\_prefix.db and restart, and filewalker takes normal times (a few hours)

The quick used-space-filewalker is a feature, not a bug. But it may have a bug in the processing.  
Does deleting the database eliminate the difference between 1.8TB (OS) and 1.4TB (dashboard)?

---

<div class="post-metadata">

**Author:** ![Alexey](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/alexey/32/41_2.png) [@Alexey](https://forum.storj.io/u/Alexey)\
**Post date:** [November 25, 2024, 5:57am UTC](https://forum.storj.io/t/used-space-gets-reset-after-restart/28408/73 "2024-11-25T05:57:44Z")

</div>

This is a new feature which allows to do not calculate the used space but use the usage reported by OS directly. However, this is an experimental feature and the usage on the dashboard will be wrong.

---

<div class="post-metadata">

**Author:** ![acoustician](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/acoustician/32/71_2.png) [@acoustician](https://forum.storj.io/u/acoustician)\
**Post date:** [November 25, 2024, 6:29am UTC](https://forum.storj.io/t/used-space-gets-reset-after-restart/28408/74 "2024-11-25T06:29:34Z")

</div>

upd: all settled down after i opened dashboard after several hours

now it shows right disk usage

---

<div class="post-metadata">

**Author:** ![EasyRhino](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/easyrhino/32/1133_2.png) [@EasyRhino](https://forum.storj.io/u/EasyRhino)\
**Post date:** [November 25, 2024, 3:36pm UTC](https://forum.storj.io/t/used-space-gets-reset-after-restart/28408/75 "2024-11-25T15:36:19Z")

</div>

> [@Alexey](#):
>
> Does deleting the database eliminate the difference between 1.8TB (OS) and 1.4TB (dashboard)?

No it’s been more than a day since restart, filewalkers are done, and it’s still showing the 1.8 / 1.4 / 0.9 discrepancies. I’m using badger cache which i didn’t touch, btw.

---

<div class="post-metadata">

**Author:** ![Alexey](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/alexey/32/41_2.png) [@Alexey](https://forum.storj.io/u/Alexey)\
**Post date:** [November 26, 2024, 6:20am UTC](https://forum.storj.io/t/used-space-gets-reset-after-restart/28408/76 "2024-11-26T06:20:18Z")

</div>

This case I cannot reproduce yet.  
Could you please try to recreate a `piece_spaced_used.db` too?

---

<div class="post-metadata">

**Author:** ![foegra](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/foegra/32/1134_2.png) [@foegra](https://forum.storj.io/u/foegra)\
**Post date:** [November 26, 2024, 3:54pm UTC](https://forum.storj.io/t/used-space-gets-reset-after-restart/28408/77 "2024-11-26T15:54:04Z")

</div>

Seems same for me as well, every time node is restarted - used disk value goes to value, that was after 1st restart. I’m using TrueNas Scale.

---

<div class="post-metadata">

**Author:** ![EasyRhino](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/easyrhino/32/1133_2.png) [@EasyRhino](https://forum.storj.io/u/EasyRhino)\
**Post date:** [November 26, 2024, 6:44pm UTC](https://forum.storj.io/t/used-space-gets-reset-after-restart/28408/78 "2024-11-26T18:44:13Z")

</div>

> [@Alexey](#):
>
> This case I cannot reproduce yet.  
> Could you please try to recreate a `piece_spaced_used.db` too?

to clarify, you want me to delete piece\_spaced\_used.db and restart and see what happens?

---

<div class="post-metadata">

**Author:** ![Alexey](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/alexey/32/41_2.png) [@Alexey](https://forum.storj.io/u/Alexey)\
**Post date:** [November 27, 2024, 3:47am UTC](https://forum.storj.io/t/used-space-gets-reset-after-restart/28408/79 "2024-11-27T03:47:02Z")

</div>

Using this procedure:

> **[How to fix database: file is not a database error](https://support.storj.io/hc/en-us/articles/4403032417044-How-to-fix-database-file-is-not-a-database-error)**
>
> If your node was abruptly terminated due to power failure, the database file could be irreversible corrupted, you can see an error Error starting master database on storagenode: database: file is n...

because it wouldn’t be able to recreate only one missing database (because there are migrations).

---

<div class="post-metadata">

**Author:** ![EasyRhino](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/easyrhino/32/1133_2.png) [@EasyRhino](https://forum.storj.io/u/EasyRhino)\
**Post date:** [November 27, 2024, 6:45pm UTC](https://forum.storj.io/t/used-space-gets-reset-after-restart/28408/80 "2024-11-27T18:45:14Z")

</div>

> [@Alexey](#):
>
> Using this procedure:  
> [https://support.storj.io/hc/en-us/articles/4403032417044-How-to-fix-database-file-is-not-a-database-error](https://support.storj.io/hc/en-us/articles/4403032417044-How-to-fix-database-file-is-not-a-database-error)

Okay I did the sqlite3 database check (Everyone was ok), and deleted BOTH the pieces piece\_spaced\_used.db and used\_space\_per\_prefix.db, and the dashboard is now showing nearly zero disk space usage but going up as the filewalker is running.

So… we’ll so how that goes!

[Previous page](https://forum.storj.io/t/used-space-gets-reset-after-restart/28408.md?page=3)

[Next page](https://forum.storj.io/t/used-space-gets-reset-after-restart/28408.md?page=5)
