From 015714f7714661a042ad8ea0261e3d68c311cf5d Mon Sep 17 00:00:00 2001 From: Tobi Date: Sat, 1 Jul 2023 11:45:58 +0200 Subject: [PATCH] Create 2023-07-01-pi-log.md --- webpage/content/post/2023-07-01-pi-log.md | 32 +++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 webpage/content/post/2023-07-01-pi-log.md diff --git a/webpage/content/post/2023-07-01-pi-log.md b/webpage/content/post/2023-07-01-pi-log.md new file mode 100644 index 0000000..15eeee4 --- /dev/null +++ b/webpage/content/post/2023-07-01-pi-log.md @@ -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