# Best Practices for Disk Space Management in Community w/ lots of Images

**URL:** https://meta.discourse.org/t/best-practices-for-disk-space-management-in-community-w-lots-of-images/74858
**Category:** Self-hosting
**Tags:** server-resources
**Created:** [11월 27, 2017, 4:44오전 UTC](https://meta.discourse.org/t/best-practices-for-disk-space-management-in-community-w-lots-of-images/74858 "2017-11-27T04:44:18Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![keith1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/keith1/32/178982_2.png) [@keith1](https://meta.discourse.org/u/keith1)
#### Post date: [11월 27, 2017, 4:44오전 UTC](https://meta.discourse.org/t/best-practices-for-disk-space-management-in-community-w-lots-of-images/74858/1 "2017-11-27T04:44:18Z")

</div>

I’m running a very visual oriented community ([www.realtimevfx.com](http://www.realtimevfx.com)) and have watched my disk space creep up over the past year (obviously). I’m about to do some cleanup (per this discussion “[https://meta.discourse.org/t/low-on-disk-space-cleaning-up-old-docker-containers/15792/83](https://meta.discourse.org/t/low-on-disk-space-cleaning-up-old-docker-containers/15792/83)”), but I wanted to start a general conversation to get people’s thoughts on the best way to approach this - If I can avoid it, I’d rather not have exponential disk space growth as the community grows.

Are there best practices / standards that I should implement regarding user uploads? Should I disable uploads entirely and have people only host through imgur, etc?

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [11월 27, 2017, 5:26오전 UTC](https://meta.discourse.org/t/best-practices-for-disk-space-management-in-community-w-lots-of-images/74858/2 "2017-11-27T05:26:53Z")

</div>

Serve static resources via AWS is the best You can do as it will offload a significant amount of less important data from the server.

---

<div class="post-metadata">

### Author: ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)
#### Post date: [11월 27, 2017, 5:33오전 UTC](https://meta.discourse.org/t/best-practices-for-disk-space-management-in-community-w-lots-of-images/74858/3 "2017-11-27T05:33:57Z")

</div>

> [@itsbhanusharma](#):
>
> Serve static resources via AWS is the best

Won’t the local copies of all uploaded images still reside on your server?

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [11월 27, 2017, 5:35오전 UTC](https://meta.discourse.org/t/best-practices-for-disk-space-management-in-community-w-lots-of-images/74858/4 "2017-11-27T05:35:27Z")

</div>

Rebuild Your container once the Images are offloaded to s3 bucket and then all those can be safely removed from your local server. system is supposed to automatically clean up the content once it is properly uploaded to the AWS cloud.

---

<div class="post-metadata">

### Author: ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)
#### Post date: [11월 27, 2017, 5:36오전 UTC](https://meta.discourse.org/t/best-practices-for-disk-space-management-in-community-w-lots-of-images/74858/5 "2017-11-27T05:36:26Z")

</div>

> [@itsbhanusharma](#):
>
> system is supposed to automatically clean up the content once it is properly uploaded to the AWS cloud.

I see, didn’t know about it.  
What about making a backup of a Discourse instance, it won’t contain those images, will it?

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [11월 27, 2017, 5:38오전 UTC](https://meta.discourse.org/t/best-practices-for-disk-space-management-in-community-w-lots-of-images/74858/6 "2017-11-27T05:38:18Z")

</div>

it will contain necessary references to those images and when You restore such a backup, it will link them to Your instance’s AWS s3 configuration and look for resources in the relative directories afaik but maybe someone from the discourse team can provide better details about how backups are handled in case of files.

@HAWK @sam can You provide some extra details about how backups handle the media files uploaded by users?

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [11월 27, 2017, 9:13오전 UTC](https://meta.discourse.org/t/best-practices-for-disk-space-management-in-community-w-lots-of-images/74858/7 "2017-11-27T09:13:20Z")

</div>

When images are stored on S3, they won’t be backed up by Discourse anymore. This would be pointless since most of the time, you’re using S3 because you don’t have enough space locally.

If you want to backup your images, I’m sure there are plenty of tools available to do that by talking to S3 directly 😉

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [11월 27, 2017, 9:17오전 UTC](https://meta.discourse.org/t/best-practices-for-disk-space-management-in-community-w-lots-of-images/74858/8 "2017-11-27T09:17:47Z")

</div>

@zogstrip one Question though!  
what if that backup is restored when the site is moved to a new host? will that break all the images or will it be as simple as configuring with the same AWS details again to restore all the media?

---

<div class="post-metadata">

### Author: ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)
#### Post date: [11월 27, 2017, 9:24오전 UTC](https://meta.discourse.org/t/best-practices-for-disk-space-management-in-community-w-lots-of-images/74858/9 "2017-11-27T09:24:46Z")

</div>

Backup will contain all your site settings. So new restored instance also will have the same S3 configuration.

---

<div class="post-metadata">

### Author: ![Dmitry\_Krasnoperov](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dmitry_krasnoperov/32/65079_2.png) [@Dmitry\_Krasnoperov](https://meta.discourse.org/u/Dmitry_Krasnoperov)
#### Post date: [12월 18, 2017, 8:57오후 UTC](https://meta.discourse.org/t/best-practices-for-disk-space-management-in-community-w-lots-of-images/74858/10 "2017-12-18T20:57:07Z")

</div>

I have several question about images storage/processing

1. I have two folders  
/var/discourse/shared/standalone/uploads/default/original — 9GB in my case  
../3X  
../2X  
../1X  
/var/discourse/shared/standalone/uploads/default/optimized — 4GB in my case  
../3X  
../2X  
../1X

Is there way to keep **only** optimized images?

1. Does folder  
/var/discourse/shared/standalone/postgres\_data/base  
store the same images as folders above?

2. Is there any Discourse settings for storing images in lower quality?

3. Is there any client-side image optimization to make it lower size?

---

<div class="post-metadata">

### Author: ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)
#### Post date: [12월 21, 2017, 12:25오전 UTC](https://meta.discourse.org/t/best-practices-for-disk-space-management-in-community-w-lots-of-images/74858/11 "2017-12-21T00:25:59Z")

</div>

> [@Dmitry\_Krasnoperov](#):
>
> Is there way to keep only optimized images?

Original images are shown when their optimised counterparts within topics/replies are clicked.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2월 26, 2020, 10:37오후 UTC](https://meta.discourse.org/t/best-practices-for-disk-space-management-in-community-w-lots-of-images/74858/12 "2020-02-26T22:37:34Z")

</div>



---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2월 27, 2020, 12:59오전 UTC](https://meta.discourse.org/t/best-practices-for-disk-space-management-in-community-w-lots-of-images/74858/13 "2020-02-27T00:59:04Z")

</div>

이 @sam 관련해서 다른 의견 있으신가요? 이미지에 대한 최적화 rake 태스크가 있다는 걸 알고 있는데, @jomaxro님, 셀프 호스터들도 이걸 사용할 수 있나요?

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [2월 27, 2020, 1:04오전 UTC](https://meta.discourse.org/t/best-practices-for-disk-space-management-in-community-w-lots-of-images/74858/14 "2020-02-27T01:04:44Z")

</div>

레이크 태스크는 아니지만, 해당 스크립트는 셀프 호스터가 사용할 수 있도록 제공됩니다. [https://github.com/discourse/discourse/blob/master/script/downsize\_uploads.rb](https://github.com/discourse/discourse/blob/master/script/downsize_uploads.rb)

사용하려면 다음을 실행하세요:

```plaintext
./launcher enter app
cd /var/www/discourse
RAILS_ENV=production bundle exec ruby script/downsize_uploads.rb

```

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [2월 27, 2020, 3:24오전 UTC](https://meta.discourse.org/t/best-practices-for-disk-space-management-in-community-w-lots-of-images/74858/15 "2020-02-27T03:24:32Z")

</div>

> [@zogstrip](#):
>
> 이미지가 S3에 저장되면 더 이상 Discourse에 의해 백업되지 않습니다.

이것은 S3 백업에 대한 전체적인 설명이 더 이상 아닙니다.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2월 27, 2020, 4:48오전 UTC](https://meta.discourse.org/t/best-practices-for-disk-space-management-in-community-w-lots-of-images/74858/16 "2020-02-27T04:48:56Z")

</div>

관리자 패널에서 바로 사용할 수 있도록 하고 싶습니다. 다음 릴리스에 포함할까요, 아니면 그다음 릴리스에 포함할까요?
