-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9e5fa56
commit 015714f
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |