# Uploads to external storage

**URL:** https://meta.discourse.org/t/uploads-to-external-storage/370033
**Category:** Support
**Created:** [June 13, 2025, 10:08am UTC](https://meta.discourse.org/t/uploads-to-external-storage/370033 "2025-06-13T10:08:30Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Lander0606](https://avatars.discourse-cdn.com/v4/letter/l/e56c9b/32.png) [@Lander0606](https://meta.discourse.org/u/Lander0606)
#### Post date: [June 13, 2025, 10:08am UTC](https://meta.discourse.org/t/uploads-to-external-storage/370033/1 "2025-06-13T10:08:30Z")

</div>

Hi all,

I’m trying to change the Discourse uploads location to an external storage location on my self-hosted instance due to space constraints. I have a CIFS share mounted and already copied all existing uploads with the same directory structure to the mounted location.

Then, I added the following lines to the `app.yml`:

```plaintext
- volumes:
  - volume:
      host: /<storage-location>/uploads
      guest: /shared/uploads

```

After rebuilding the container with `./launcher rebuild app` (I’m the `root` user), the images are not visible anymore on the website. I appears that they all return a code 404.

I tried mounting the CIFS share as `root:root` and `_default_hostname:www-data`, but every time, images don’t show up.

What is the best (or correct) way to perform this change of locations for uploads?

Thanks in advance guys!

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [June 13, 2025, 3:15pm UTC](https://meta.discourse.org/t/uploads-to-external-storage/370033/2 "2025-06-13T15:15:44Z")

</div>

Here is what is the default:

```plaintext
volumes:
  - volume:
      host: /var/discourse/shared/standalone
      guest: /shared

```

You probably want something like this:

```plaintext
volumes:
  - volume:
      host: /var/discourse/shared/standalone
      guest: /shared
  - volume:
      host: /your/cifs/share/discourse-uploads
      guest: /shared/uploads

```

---

<div class="post-metadata">

### Author: ![Lander0606](https://avatars.discourse-cdn.com/v4/letter/l/e56c9b/32.png) [@Lander0606](https://meta.discourse.org/u/Lander0606)
#### Post date: [June 16, 2025, 10:21am UTC](https://meta.discourse.org/t/uploads-to-external-storage/370033/3 "2025-06-16T10:21:08Z")

</div>

True! I tried it that way, and it worked, just keeping in mind that the mounted storage location must have the right permissions. `root:root` doesn’t work, but `_default_hostname:www-data` seems to work.

Another thing I noticed: uploads in topics, even with moving them to the new storage location, don’t work anymore and have to be re-uploaded. Other images/uploads (logos, headers etc) work fine.

Thanks!

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [June 16, 2025, 10:42am UTC](https://meta.discourse.org/t/uploads-to-external-storage/370033/4 "2025-06-16T10:42:19Z")

</div>

> [@Lander0606](#):
>
> Another thing I noticed: uploads in topics, even with moving them to the new storage location, don’t work anymore and have to be re-uploaded

That shouldn’t be. Maybe you copied the files to the wrong place.

---

<div class="post-metadata">

### Author: ![Lander0606](https://avatars.discourse-cdn.com/v4/letter/l/e56c9b/32.png) [@Lander0606](https://meta.discourse.org/u/Lander0606)
#### Post date: [June 16, 2025, 12:01pm UTC](https://meta.discourse.org/t/uploads-to-external-storage/370033/5 "2025-06-16T12:01:53Z")

</div>

I was thinking that too, but I double checked that I copied the whole `uploads` folder from `shared/standalone/` to my external storage location, including the `default` and other sub folders.

It’s important to mention that I tried a few times to change the uploads location with different configurations for the external storage (mostly different file and folder permissions) and in between executed a `rake posts:rebake` in an attempt to let the attachments work again, and maybe somewhere in between the problem occurred…

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [June 16, 2025, 2:17pm UTC](https://meta.discourse.org/t/uploads-to-external-storage/370033/6 "2025-06-16T14:17:17Z")

</div>

It’s strange that uploading it again fixes it.

You can look at `Uploads.pluck(:url)` in rails and see if there’s something strange there.

---

<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: [July 16, 2025, 2:17pm UTC](https://meta.discourse.org/t/uploads-to-external-storage/370033/7 "2025-07-16T14:17:24Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
