# Backups keep failing

**URL:** https://meta.discourse.org/t/backups-keep-failing/247734
**Category:** Self-hosting
**Tags:** backups
**Created:** [December 5, 2022, 12:16am UTC](https://meta.discourse.org/t/backups-keep-failing/247734 "2022-12-05T00:16:03Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![darkpixlz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/darkpixlz/32/549896_2.png) [@darkpixlz](https://meta.discourse.org/u/darkpixlz)
#### Post date: [December 5, 2022, 12:16am UTC](https://meta.discourse.org/t/backups-keep-failing/247734/1 "2022-12-05T00:16:03Z")

</div>

Hello,

Whenever I try and backup my site, I get an error.

```plaintext
[2022-12-05 00:08:22] pg_dump: executing SEQUENCE SET custom_emojis_id_seq
[2022-12-05 00:08:22] Finalizing backup...
[2022-12-05 00:08:22] Creating archive: blackiron-2022-12-05-000759-v20221201035918.tar.gz
[2022-12-05 00:08:22] Making sure archive does not already exist...
[2022-12-05 00:08:22] Creating empty archive...
[2022-12-05 00:08:22] EXCEPTION: /var/www/discourse/lib/discourse.rb:131:in `exec': tar: /var/www/discourse/public/backups/default/blackiron-2022-12-05-000759-v20221201035918.tar: Cannot open: Permission denied
tar: Error is not recoverable: exiting now

[2022-12-05 00:08:22] /var/www/discourse/lib/discourse.rb:158:in `execute_command'
/var/www/discourse/lib/discourse.rb:131:in `exec'
/var/www/discourse/lib/discourse.rb:28:in `execute_command'
/var/www/discourse/lib/backup_restore/backuper.rb:205:in `create_archive'
/var/www/discourse/lib/backup_restore/backuper.rb:41:in `run'
/var/www/discourse/script/spawn_backup_restore.rb:9:in `backup'
/var/www/discourse/script/spawn_backup_restore.rb:34:in `block in <main>'
/var/www/discourse/script/spawn_backup_restore.rb:4:in `fork'
/var/www/discourse/script/spawn_backup_restore.rb:4:in `<main>'
[2022-12-05 00:08:22] Deleting old backups...
[2022-12-05 00:08:22] Cleaning stuff up...
[2022-12-05 00:08:22] Removing '.tar' leftovers...
[2022-12-05 00:08:22] Marking backup as finished...
[2022-12-05 00:08:22] Refreshing disk stats...
[2022-12-05 00:08:22] Notifying 'darkpixlz' of the end of the backup...
[2022-12-05 00:08:29] Finished!

```

I’m not sure what’s causing this. It was working fine before yesterday, when we moved to a new machine, which was fresh before we copied over the app.yml file to include our config.

---

<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: [December 5, 2022, 5:13am UTC](https://meta.discourse.org/t/backups-keep-failing/247734/2 "2022-12-05T05:13:18Z")

</div>

Are you running discourse as root? What is the disk mapping (in the app.yml)?

---

<div class="post-metadata">

### Author: ![darkpixlz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/darkpixlz/32/549896_2.png) [@darkpixlz](https://meta.discourse.org/u/darkpixlz)
#### Post date: [December 5, 2022, 1:38pm UTC](https://meta.discourse.org/t/backups-keep-failing/247734/3 "2022-12-05T13:38:14Z")

</div>

Yes I am, and I’ll check the disk layout.

---

<div class="post-metadata">

### Author: ![crcoli7307](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/crcoli7307/32/267901_2.png) [@crcoli7307](https://meta.discourse.org/u/crcoli7307)
#### Post date: [December 6, 2022, 4:10am UTC](https://meta.discourse.org/t/backups-keep-failing/247734/5 "2022-12-06T04:10:11Z")

</div>

These are the disk mappings:

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

```

---

<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: [December 6, 2022, 11:04am UTC](https://meta.discourse.org/t/backups-keep-failing/247734/6 "2022-12-06T11:04:32Z")

</div>

Strange. I would enter the container and see what) whether that directory exists and if you can create a directory there.

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [December 6, 2022, 11:20am UTC](https://meta.discourse.org/t/backups-keep-failing/247734/7 "2022-12-06T11:20:04Z")

</div>

> [@darkpixlz](#):
>
> when we moved to a new machine

Did you copy (parts of) the `/var/discourse` folder to the new server? That might have messed with the permissions/owner.

---

<div class="post-metadata">

### Author: ![crcoli7307](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/crcoli7307/32/267901_2.png) [@crcoli7307](https://meta.discourse.org/u/crcoli7307)
#### Post date: [December 6, 2022, 3:43pm UTC](https://meta.discourse.org/t/backups-keep-failing/247734/8 "2022-12-06T15:43:15Z")

</div>

We ran the setup script, copied the app.yml, and restored from backup.

> [@pfaffman](#):
>
> Strange. I would enter the container and see what) whether that directory exists and if you can create a directory there.

I will do that!
