# Disk space cleanup

**URL:** https://meta.discourse.org/t/disk-space-cleanup/301984
**Category:** Self-hosting
**Tags:** server-resources
**Created:** [April 2, 2024, 4:05am UTC](https://meta.discourse.org/t/disk-space-cleanup/301984 "2024-04-02T04:05:51Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![CT075](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ct075/32/375367_2.png) [@CT075](https://meta.discourse.org/u/CT075)
#### Post date: [April 2, 2024, 4:05am UTC](https://meta.discourse.org/t/disk-space-cleanup/301984/1 "2024-04-02T04:05:51Z")

</div>

I run an old forum (~10 years, 200k posts) that has been running into some chronic disk issues. At the moment, we’re not in imminent danger of the lights going out, but we have reached the point where I’m getting daily messages about backups failing due to no disk space (the backup process itself seems to take like 10 gigabytes of disk, which fails if we already have a backup on-server).

Is there anything I can do to stem this tide a little?

I accept that disk space is one of those things I have to deal with as time goes on and do plan to upgrade eventually, but I’m wondering if there are other ways to buy time via compression, or just some cleanup of files that I haven’t thought to check.

I have already run `./launcher cleanup` (0B saved), and have attached a snapshot of the db stats.

[db\_stats.txt](https://meta.discourse.org/uploads/short-url/opD938QJ0yh1TmvygO4QLC8wZil.txt) (17.7 KB)

---

<div class="post-metadata">

### Author: ![Ed\_S](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ed_s/32/134015_2.png) [@Ed\_S](https://meta.discourse.org/u/Ed_S)
#### Post date: [April 2, 2024, 12:11pm UTC](https://meta.discourse.org/t/disk-space-cleanup/301984/2 "2024-04-02T12:11:48Z")

</div>

I’d start with a measurement:

```plaintext
du -kx / | sort -n | tail -499

```

Probably also worth

```plaintext
df

```

and perhaps

```plaintext
find / -xdev -ls|sort -n -k 2|tail -199

```

which might take a few minutes

You might see one or more swapfiles so it’s worth checking if they are in use:

```plaintext
swapon

```

---

<div class="post-metadata">

### Author: ![CT075](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ct075/32/375367_2.png) [@CT075](https://meta.discourse.org/u/CT075)
#### Post date: [April 3, 2024, 5:53pm UTC](https://meta.discourse.org/t/disk-space-cleanup/301984/3 "2024-04-03T17:53:09Z")

</div>

After running a `du`, I don’t see anything out of the ordinary (the bulk of the data is in /var/docker and /var/lib, which is about what I’d expect). Do you have any advice for what might be worth checking out in those folders?

My swap also looks normal (and not really enough to move the needle).

---

<div class="post-metadata">

### Author: ![Ed\_S](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ed_s/32/134015_2.png) [@Ed\_S](https://meta.discourse.org/u/Ed_S)
#### Post date: [April 3, 2024, 8:37pm UTC](https://meta.discourse.org/t/disk-space-cleanup/301984/4 "2024-04-03T20:37:17Z")

</div>

I can help if you show the data!

---

<div class="post-metadata">

### Author: ![CT075](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ct075/32/375367_2.png) [@CT075](https://meta.discourse.org/u/CT075)
#### Post date: [April 3, 2024, 8:59pm UTC](https://meta.discourse.org/t/disk-space-cleanup/301984/5 "2024-04-03T20:59:57Z")

</div>

Of course, how silly of me.

The output of `du -cha --max-depth=2 /var | grep -E "M|G"`

```plaintext
2.1M /var/backups
12K /var/discourse/README.md
2.2M /var/discourse/.git
2.7M /var/discourse
54M /var/lib/mlocate
36M /var/lib/dpkg
190M /var/lib/apt
18G /var/lib/docker
18G /var/lib
3.4M /var/log/btmp
1.2M /var/log/auth.log.3.gz
4.1G /var/log/journal
1.2M /var/log/auth.log.2.gz
42M /var/log/btmp.1
1.6M /var/log/auth.log.4.gz
7.9M /var/log/auth.log.1
6.5M /var/log/auth.log
4.1G /var/log
1.2M /var/cache/man
312M /var/cache/apt
2.8M /var/cache/snapd
4.9M /var/cache/debconf
320M /var/cache
46G /var/docker/shared
46G /var/docker
68G /var
68G total

```

DIgging deeper into /var/docker/shared and /var/lib/docker:

```plaintext
15G /var/docker/shared/standalone/postgres_data
6.8G /var/docker/shared/standalone/backups
14G /var/docker/shared/standalone/uploads
43M /var/docker/shared/standalone/redis_data
69M /var/docker/shared/standalone/log
12G /var/docker/shared/standalone/postgres_data_old
14M /var/docker/shared/standalone/letsencrypt
46G /var/docker/shared/standalone
46G /var/docker/shared
46G total

```

```plaintext
17M /var/lib/docker/image/overlay2
17M /var/lib/docker/image
14G /var/lib/docker/overlay2/ed229eed209ffa6339adc9de9033c12487732c74572a3dc608eb32d720d1837c
1.2G /var/lib/docker/overlay2/7448f4eb6c5a9e09b0a5537aa454c30221ab95314418eac9078c7c774de784e2
2.4G /var/lib/docker/overlay2/8a7ca976e2c8b362302c2abb95d306520206bf3e6125672b160b19e150d1f914
88M /var/lib/docker/overlay2/c6cd5a3006efb2457f3bba70450a85c42f53bfc7cdc3416fb6cfb5990e2eed72
1.1G /var/lib/docker/overlay2/9f8a463bdc03f518d6f25a7c11873122bf858a266fd6ca40ea19dfb4a78e1f8d
18G /var/lib/docker/overlay2
18G /var/lib/docker
18G total

```

Offhand, `postgres_data_old` looks suspicious. Is that safe to clean up?

---

<div class="post-metadata">

### Author: ![Ed\_S](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ed_s/32/134015_2.png) [@Ed\_S](https://meta.discourse.org/u/Ed_S)
#### Post date: [April 3, 2024, 9:05pm UTC](https://meta.discourse.org/t/disk-space-cleanup/301984/6 "2024-04-03T21:05:44Z")

</div>

> [@CT075](#):
>
> Offhand, `postgres_data_old` looks suspicious. Is that safe to clean up?

Yes, it’s fine to delete `postgres_data_old`.

I find it difficult to read the output you pasted: I suggested particular forms of commands because I’ve found them useful.

---

<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: [May 3, 2024, 9:06pm UTC](https://meta.discourse.org/t/disk-space-cleanup/301984/7 "2024-05-03T21:06:21Z")

</div>

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