Skip to content

Commit

Permalink
Create 2023-07-01-pi-log.md
Browse files Browse the repository at this point in the history
  • Loading branch information
lightszentip committed Jul 1, 2023
1 parent 9e5fa56 commit 015714f
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions webpage/content/post/2023-07-01-pi-log.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---

layout: post
title: "PI - reduce size of log dir"
date: 2023-07-01 00:00:00 -0000
categories: pi
draft: false
summary: "How to reduce the size of log dir on pi"

---

# How to reduce the size of log dir on pi

To optimize log size and prolong the SD card's lifespan on your Raspberry Pi, you have several options. The most effective method, ensuring the SD card's longevity, is by making the following configurations in the /etc/fstab file:

```
tmpfs /var/log tmpfs defaults,noatime,nosuid,mode=0755,size=25M 0 0
```

This will keep log files in memory, significantly reducing write operations to the SD card and its storage usage.

However, this can cause certain applications to malfunction, as their folders cannot be created initially, and users lack the necessary permissions to do so.

To address this issue, you can resolve it by opening the file "/usr/lib/tmpfiles.d/var.conf" and adding the specific folders, for instance:

```
d /var/log/nginx 755 - - -
```

By following these steps, you can effectively optimize log size on your Raspberry Pi while maintaining application functionality.

Another solution is to change "q /var 0755" to 0777 to give all user the permission to create a log dir

0 comments on commit 015714f

Please sign in to comment.