# Our disk space disappeared - how to find who/where?

**URL:** https://meta.discourse.org/t/our-disk-space-disappeared-how-to-find-who-where/45798
**Category:** Self-hosting
**Tags:** server-resources
**Created:** [June 17, 2016, 12:45am UTC](https://meta.discourse.org/t/our-disk-space-disappeared-how-to-find-who-where/45798 "2016-06-17T00:45:59Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![fearlessfrog](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fearlessfrog/32/119653_2.png) [@fearlessfrog](https://meta.discourse.org/u/fearlessfrog)
#### Post date: [June 17, 2016, 12:45am UTC](https://meta.discourse.org/t/our-disk-space-disappeared-how-to-find-who-where/45798/1 "2016-06-17T00:45:59Z")

</div>

Our free disk space went down by about a gig overnight, or rather the backup image size jumped up.

We’re trying to figure out where it went, as we think a user may be uploading files to themselves via PM or something?

Where are good places to start looking in Discourse for this type of info, i.e. where the upload allocation went per user?

---

<div class="post-metadata">

### Author: ![marcospreviato](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/marcospreviato/32/54766_2.png) [@marcospreviato](https://meta.discourse.org/u/marcospreviato)
#### Post date: [June 17, 2016, 12:51am UTC](https://meta.discourse.org/t/our-disk-space-disappeared-how-to-find-who-where/45798/2 "2016-06-17T00:51:50Z")

</div>

try this commands in your host:

sudo apt-get autoclean

sudo apt-get autoremove

cd /var/discourse

and after

sudo ./launcher cleanup

and press y for cleanup files!

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [June 17, 2016, 12:56am UTC](https://meta.discourse.org/t/our-disk-space-disappeared-how-to-find-who-where/45798/3 "2016-06-17T00:56:45Z")

</div>

Usually what I’ll do is to run

[df -h](http://linux.die.net/man/1/df) and see which file system is taking up most of the disk space and then try to narrow down the scope with [du -h](http://linux.die.net/man/1/du) with an optional `--max-depth=1` to find the offending file/folder. Another tool that you might want to checkout is [ncdu](http://linux.die.net/man/1/ncdu)

---

<div class="post-metadata">

### Author: ![fearlessfrog](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fearlessfrog/32/119653_2.png) [@fearlessfrog](https://meta.discourse.org/u/fearlessfrog)
#### Post date: [June 17, 2016, 12:57am UTC](https://meta.discourse.org/t/our-disk-space-disappeared-how-to-find-who-where/45798/4 "2016-06-17T00:57:14Z")

</div>

Thank you - yep, we do that and it certainly does stop the bumps. I’ll double check for sure, but also did want to just see if there was a quota/report per user as well - especially as it was within the Discourse backup.tar.gz.

---

<div class="post-metadata">

### Author: ![fearlessfrog](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fearlessfrog/32/119653_2.png) [@fearlessfrog](https://meta.discourse.org/u/fearlessfrog)
#### Post date: [June 17, 2016, 5:56pm UTC](https://meta.discourse.org/t/our-disk-space-disappeared-how-to-find-who-where/45798/5 "2016-06-17T17:56:59Z")

</div>

So @sam just to be super brief 🙂 perhaps the simplest thing that would work for us is that I just do a

```
./launcher enter app
rails c 

```

..and then just use models for Upload (:filesize) and User and go irb query that way? I think that would get what we want.

EDIT: Yep, I just did it that way, i.e. user.uploads.sum(:filesize) &map. We found someone with 9GB of uploaded content in Discourse.

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [June 17, 2016, 8:42pm UTC](https://meta.discourse.org/t/our-disk-space-disappeared-how-to-find-who-where/45798/6 "2016-06-17T20:42:13Z")

</div>

> [@fearlessfrog](#):
>
> 9GB of uploaded content

9GB Whew!  
Are your settings very high?

> max image size kb  
> The maximum image upload size in kB. This must be configured in nginx (client\_max\_body\_size) / apache or proxy as well.  
> max attachment size kb  
> The maximum attachment files upload size in kB. This must be configured in nginx (client\_max\_body\_size) / apache or proxy as well.

Or is this a member doing a mess of smaller uploads?

---

<div class="post-metadata">

### Author: ![fearlessfrog](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fearlessfrog/32/119653_2.png) [@fearlessfrog](https://meta.discourse.org/u/fearlessfrog)
#### Post date: [June 17, 2016, 9:02pm UTC](https://meta.discourse.org/t/our-disk-space-disappeared-how-to-find-who-where/45798/7 "2016-06-17T21:02:58Z")

</div>

> [@Mittineague](#):
>
> Or is this a member doing a mess of smaller uploads?

^ That. Our max image size was left at 3072 kb. It looks like just over a year of constant screen-shot uploading, but we are still figuring that out. It doesn’t look malicious, just really keen/dedicated and we are a very screenshot-centric forum. One tutorial topic alone had over 100 images uploaded. An interesting thing is the 2nd place uploader has only 0.6 GB used, so we’ll talk to who is doing it and figure something better out.

I wonder if the trust\_levels could have a file/image quota added? I haven’t searched through the feature wishlist to find out as yet. This user is a level\_3.

EDIT: I added a feature idea here, if others might have the need too:

> [@User Upload Reporting & Quota](https://meta.discourse.org/t/user-upload-reporting-quota/45976):
>
> We had a recent need to find where our uploads size was increasing quickly, so this feature request breaks down into two ideas: (1) A way to see per user the file upload capacity used, i.e. a per user total uploads in mb. (2) A trust-based or per-user upload quota limit that would either warn staff/admin that a quota was exceeded or prevent further uploading until the quota was increased. Our support experience I am basing this request for feature discussion is here:

---

<div class="post-metadata">

### Author: ![fearlessfrog](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fearlessfrog/32/119653_2.png) [@fearlessfrog](https://meta.discourse.org/u/fearlessfrog)
#### Post date: [June 18, 2016, 12:00am UTC](https://meta.discourse.org/t/our-disk-space-disappeared-how-to-find-who-where/45798/8 "2016-06-18T00:00:53Z")

</div>

Ok, some new information the more we dig.

This looks like a Discourse bug somehow. The user with the 9 GB of files has the same 13 files that were uploaded as a set repeated 1728 times, i.e. 22,464 duplicate file uploads.

I’ll raise a bug and hopefully we can remove these plus stop it happening again.

Bug is reported here. Will welcome any help/advice 🙂

> [@Duplicate Uploaded Files](https://meta.discourse.org/t/duplicate-uploaded-files/45983):
>
> Hi! We’re on 1.6.0.beta8 and recently experience a quick disappearance of our local server disk space, as detailed here: We’ve found out that one user has taken 9GB of uploads disk space, despite not uploading that many files (file limits kept to defaults etc). Looking at the upload::original\_filename values it seems like we have a repeating set of 14 files duplicated 1729 times, i.e. 24,206 new files. The files themselves in that 14 file set are roughly the right size that when repeated wo…

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [June 18, 2016, 12:15am UTC](https://meta.discourse.org/t/our-disk-space-disappeared-how-to-find-who-where/45798/9 "2016-06-18T00:15:03Z")

</div>

> [@fearlessfrog](#):
>
> the same 13 files that were uploaded as a set repeated 1728 times

Hmmm, AFAIK the only multiple images are optimized\_images of uploaded avatars

 ![](https://global.discourse-cdn.com/meta/original/3X/9/e/9eee1c4d509ea6800f9d5d9772f03023eed2757f.png)

I think there is something different going on here with your situation. I cant imagine avatars weighing all that much.

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [June 18, 2016, 12:16am UTC](https://meta.discourse.org/t/our-disk-space-disappeared-how-to-find-who-where/45798/10 "2016-06-18T00:16:13Z")

</div>

Unless he enabled animated avatars.

---

<div class="post-metadata">

### Author: ![fearlessfrog](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fearlessfrog/32/119653_2.png) [@fearlessfrog](https://meta.discourse.org/u/fearlessfrog)
#### Post date: [June 18, 2016, 12:18am UTC](https://meta.discourse.org/t/our-disk-space-disappeared-how-to-find-who-where/45798/11 "2016-06-18T00:18:56Z")

</div>

I recognize the filenames repeated I think, and am pretty sure this was a bulk upload of screenshots either in a topic post or in a personal message. The size of the files (all .png’s) is like ‘595934 bytes’ or ‘322155’ as in, not files that look like they have been processed to thumbs or are avatars.

EDIT: We should move the discussion to the new bug topic I think, as I’m filling out the details as I find them there.

---

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [August 26, 2016, 12:58am UTC](https://meta.discourse.org/t/our-disk-space-disappeared-how-to-find-who-where/45798/12 "2016-08-26T00:58:51Z")

</div>

on my site it turned out to be backups that take up all the space. I’ve now changed it to only keep 3 on server, and the rest on s3. I also turned off “s3 disable cleanup” which means I can decide myself which backups there to keep.

---

<div class="post-metadata">

### Author: ![jord8on](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jord8on/32/166809_2.png) [@jord8on](https://meta.discourse.org/u/jord8on)
#### Post date: [March 8, 2020, 3:02am UTC](https://meta.discourse.org/t/our-disk-space-disappeared-how-to-find-who-where/45798/13 "2020-03-08T03:02:11Z")

</div>

@tobiaseigen, Thank you for chiming back in with what you did here. This is super helpful insight!! 🙏

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [June 8, 2024, 12:37pm UTC](https://meta.discourse.org/t/our-disk-space-disappeared-how-to-find-who-where/45798/14 "2024-06-08T12:37:03Z")

</div>

This topic was automatically closed after 2913 days. New replies are no longer allowed.
