# The files in /var/lib/docker/overlay2/ have grown large, causing Anthias not to start (HDD capacity is running low)

**URL:** <https://forums.screenly.io/t/the-files-in-var-lib-docker-overlay2-have-grown-large-causing-anthias-not-to-start-hdd-capacity-is-running-low/1644>\
**Category:** Anthias\
**Created:** [October 29, 2024, 3:01am UTC](https://forums.screenly.io/t/the-files-in-var-lib-docker-overlay2-have-grown-large-causing-anthias-not-to-start-hdd-capacity-is-running-low/1644 "2024-10-29T03:01:00Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![koukkou](https://avatars.discourse-cdn.com/v4/letter/k/6f9a4e/32.png) [@koukkou](https://forums.screenly.io/u/koukkou)\
**Post date:** [October 29, 2024, 3:01am UTC](https://forums.screenly.io/t/the-files-in-var-lib-docker-overlay2-have-grown-large-causing-anthias-not-to-start-hdd-capacity-is-running-low/1644/1 "2024-10-29T03:01:00Z")

</div>

The HDD capacity on my Raspberry Pi 4 is running low, and Anthias is not starting up.

Please refer to the following for details about the environment.

Raspberry Pi Model ・・・ Raspberry Pi 4 Model B Rev 1.5  
Anthias Version・・・experimental@7f04d72  
HDD capacity・・・32GB

As a result of the investigation, a single file within the directory below had grown to 24GB

root@raspberrypi:/var/lib/docker# du -sh /var/lib/docker/overlay2/\*  
20K /var/lib/docker/overlay2/028f08e57221cd8570ea375cbfa52b4a81c030b8ab919a97096f66f7f4c6e397  
808M /var/lib/docker/overlay2/0503221c4f147c7ac48a2836bd93e1299c98d2213b6418a38278bf07b9629750  
24G /var/lib/docker/overlay2/0e688e127544bd1e5f2b9f2fda7ef1e7cd5c1ab00efdae2929e0ee1796915da5  
20K /var/lib/docker/overlay2/0e8fa204b894fa5931954985b6dffc6e1a012826bd48c1132b989b87a71a9ee8  
・  
・  
・

After deleting this 24GB file , the issue was resolved.

While this situation seems abnormal, I would like to know the reason behind it.  
Additionally, if anyone knows how to prevent this issue from occurring again, I would appreciate your advice."

I look forward to your response.Thank you.

---

<div class="post-metadata">

**Author:** ![nicomiguelino](https://avatars.discourse-cdn.com/v4/letter/n/e56c9b/32.png) [@nicomiguelino](https://forums.screenly.io/u/nicomiguelino)\
**Post date:** [October 29, 2024, 5:58pm UTC](https://forums.screenly.io/t/the-files-in-var-lib-docker-overlay2-have-grown-large-causing-anthias-not-to-start-hdd-capacity-is-running-low/1644/2 "2024-10-29T17:58:10Z")

</div>

I’m very sorry to hear that. Artifacts like container logs, among many others, [are not cleaned up by default](https://www.reddit.com/r/docker/comments/1dk2q36/varlibdockeroverlay2_taking_up_huge_amounts_of/?rdt=59474).

If you’re running Anthias on a device running Raspberry Pi OS Lite (which is essentially Debian) or Debian, you can SSH to the device and run the following:

```bash
docker system prune -f # Prefix `sudo` if you're having permission-related issues.

```

For reference, we also support cleaning up of Docker artifacts (uused containers and images, for instance) when the [install/upgrade script is executed](https://github.com/Screenly/Anthias/blob/70afe9ba49d42f8a050cce2faaf2a963cd4a8bb7/bin/install.sh#L217), but feel free to run the `prune` command whenever you need it.

I hope it helps.

---

<div class="post-metadata">

**Author:** ![koukkou](https://avatars.discourse-cdn.com/v4/letter/k/6f9a4e/32.png) [@koukkou](https://forums.screenly.io/u/koukkou)\
**Post date:** [October 30, 2024, 1:16am UTC](https://forums.screenly.io/t/the-files-in-var-lib-docker-overlay2-have-grown-large-causing-anthias-not-to-start-hdd-capacity-is-running-low/1644/3 "2024-10-30T01:16:56Z")

</div>

Thank you for your prompt response.

Would running the command `docker system prune -f` daily via cron, for example, have any impact on Anthias?

---

<div class="post-metadata">

**Author:** ![nicomiguelino](https://avatars.discourse-cdn.com/v4/letter/n/e56c9b/32.png) [@nicomiguelino](https://forums.screenly.io/u/nicomiguelino)\
**Post date:** [October 30, 2024, 4:48am UTC](https://forums.screenly.io/t/the-files-in-var-lib-docker-overlay2-have-grown-large-causing-anthias-not-to-start-hdd-capacity-is-running-low/1644/4 "2024-10-30T04:48:34Z")

</div>

I haven’t tested it yet, but it shouldn’t affect Anthias. For good measures, you can go to the web UI, click _ **Settings** _, then click _ **Get Backup** _, which you can recover later if data (assets and assets metadata) gets lost.

---

<div class="post-metadata">

**Author:** ![koukkou](https://avatars.discourse-cdn.com/v4/letter/k/6f9a4e/32.png) [@koukkou](https://forums.screenly.io/u/koukkou)\
**Post date:** [October 30, 2024, 9:41am UTC](https://forums.screenly.io/t/the-files-in-var-lib-docker-overlay2-have-grown-large-causing-anthias-not-to-start-hdd-capacity-is-running-low/1644/5 "2024-10-30T09:41:05Z")

</div>

Thank you for your response. I tried the command, and it seems that some files were deleted. However, the files in `/var/lib/docker/overlay2/` were not removed.

To delete the files in `/var/lib/docker/overlay2/`, do I need to stop docker, delete them with `rm -rf`, and then restart docker?

---

<div class="post-metadata">

**Author:** ![nicomiguelino](https://avatars.discourse-cdn.com/v4/letter/n/e56c9b/32.png) [@nicomiguelino](https://forums.screenly.io/u/nicomiguelino)\
**Post date:** [October 30, 2024, 1:04pm UTC](https://forums.screenly.io/t/the-files-in-var-lib-docker-overlay2-have-grown-large-causing-anthias-not-to-start-hdd-capacity-is-running-low/1644/6 "2024-10-30T13:04:59Z")

</div>

@koukkou, are the assets and the assets metadata wiped off as well?

I havent tried removing `/var/lib/docker/overlay2` yet, you can backup the assets data first and try that one.

Yes. feel free to create a _ **cron** _ job for running `docker system prune -f` and `sudo rm -rf /var/lib/docker/overlay2`.

---

<div class="post-metadata">

**Author:** ![koukkou](https://avatars.discourse-cdn.com/v4/letter/k/6f9a4e/32.png) [@koukkou](https://forums.screenly.io/u/koukkou)\
**Post date:** [October 31, 2024, 12:51am UTC](https://forums.screenly.io/t/the-files-in-var-lib-docker-overlay2-have-grown-large-causing-anthias-not-to-start-hdd-capacity-is-running-low/1644/7 "2024-10-31T00:51:37Z")

</div>

@nicomiguelino, thank you for your question. When I deleted the previous 24GB file, the assets and metadata were not removed, and there were no issues.

I’d like to delete everything under `/var/lib/docker/overlay2/*`, but I’m hesitant as I’m concerned about the potential impact.

To avoid any issues with Anthias, I feel it’s better to delete only when oversized files appear. However, I would like to delete everything under `/var/lib/docker/overlay2/*` if it’s safe, but I’m unsure.

I’m commenting here in case you might have some insights.

---

<div class="post-metadata">

**Author:** ![nicomiguelino](https://avatars.discourse-cdn.com/v4/letter/n/e56c9b/32.png) [@nicomiguelino](https://forums.screenly.io/u/nicomiguelino)\
**Post date:** [October 31, 2024, 1:22am UTC](https://forums.screenly.io/t/the-files-in-var-lib-docker-overlay2-have-grown-large-causing-anthias-not-to-start-hdd-capacity-is-running-low/1644/8 "2024-10-31T01:22:05Z")

</div>

Hello, @koukkou. Thank you for sharing your thoughts. I haven’t tested that one yet, but feel free to experiment given that you have backup and such.

---

<div class="post-metadata">

**Author:** ![koukkou](https://avatars.discourse-cdn.com/v4/letter/k/6f9a4e/32.png) [@koukkou](https://forums.screenly.io/u/koukkou)\
**Post date:** [November 5, 2024, 8:52am UTC](https://forums.screenly.io/t/the-files-in-var-lib-docker-overlay2-have-grown-large-causing-anthias-not-to-start-hdd-capacity-is-running-low/1644/9 "2024-11-05T08:52:47Z")

</div>

@nicomiguelino,Thank you.  
It’s difficult to test because it’s a production environment, but I’ll try to do what I can. If you can confirm that deleting everything under `/overlay2/` will not cause any issues, I would appreciate it if you could let me know.

---

<div class="post-metadata">

**Author:** ![nicomiguelino](https://avatars.discourse-cdn.com/v4/letter/n/e56c9b/32.png) [@nicomiguelino](https://forums.screenly.io/u/nicomiguelino)\
**Post date:** [November 5, 2024, 2:59pm UTC](https://forums.screenly.io/t/the-files-in-var-lib-docker-overlay2-have-grown-large-causing-anthias-not-to-start-hdd-capacity-is-running-low/1644/10 "2024-11-05T14:59:18Z")

</div>

@koukkou,

_ **TL;DR:** _ Please don’t remove the entire `/var/lib/docker/overlay2` directory.

I tried removing the `overlay2/` directory just now. After that, I cannot restart the Docker containers successfully. I keep getting error messages that `/var/lib/docker/overlay2/<hex_value>` cannot be found. Removing it made my Pi 4 unusable.

---

<div class="post-metadata">

**Author:** ![koukkou](https://avatars.discourse-cdn.com/v4/letter/k/6f9a4e/32.png) [@koukkou](https://forums.screenly.io/u/koukkou)\
**Post date:** [November 7, 2024, 10:06am UTC](https://forums.screenly.io/t/the-files-in-var-lib-docker-overlay2-have-grown-large-causing-anthias-not-to-start-hdd-capacity-is-running-low/1644/11 "2024-11-07T10:06:41Z")

</div>

@nicomiguelino,Deleting entire directories feels way too risky. I’ll be careful! Thanks so much!

---

<div class="post-metadata">

**Author:** ![koukkou](https://avatars.discourse-cdn.com/v4/letter/k/6f9a4e/32.png) [@koukkou](https://forums.screenly.io/u/koukkou)\
**Post date:** [November 27, 2024, 2:51am UTC](https://forums.screenly.io/t/the-files-in-var-lib-docker-overlay2-have-grown-large-causing-anthias-not-to-start-hdd-capacity-is-running-low/1644/13 "2024-11-27T02:51:54Z")

</div>

@nicomiguelino  
Here’s the continuation of the report:

The `overlay2` directory started to grow in size, so after stopping Docker, I manually deleted about four files. However, this caused Anthias on port 80 to fail to start. It seems that manual deletion carries a significant risk.

It seems that the best approach is to handle the issue while Docker is still running, using the following command:

$ docker system prune --volumes -f

It’s still uncertain whether this will fully resolve the issue, but I’ll try operating with this approach for now.

---

<div class="post-metadata">

**Author:** ![nicomiguelino](https://avatars.discourse-cdn.com/v4/letter/n/e56c9b/32.png) [@nicomiguelino](https://forums.screenly.io/u/nicomiguelino)\
**Post date:** [November 27, 2024, 3:01am UTC](https://forums.screenly.io/t/the-files-in-var-lib-docker-overlay2-have-grown-large-causing-anthias-not-to-start-hdd-capacity-is-running-low/1644/14 "2024-11-27T03:01:58Z")

</div>

@koukkou, given that approach you can also do and download backups regularly.
