[DEBUG] Linux resolve df command is stuck

Error phenomenon:

Input df command and the command is stuck
Can not us cd / command to access /(root) directory
Can not us ls / command to display /(root) directory

Analysis:

There may be some network storage disconnected

Solution:

Step One: Use mount command to check if there is any disconnected network storage here

# mount

(Add: At this moment, we can see at least one remote storage mount to local directory. If we cd to this directory, system command prompt will output target is busy)

Step Two: Use unmount command to unmount this disconnected network storage

# umount -f <nfs storage which is stuck>

Or:

# umount -l <nfs storage which is stuck>

Or:

# umount -f -l <nfs storage which is stuck>

[步骤] Linux journal 日志的永久存储

正文:

步骤一:理解 journal 日志存储机制

默认情况下,journal 的日志存储在 /run/log/journal,而 /run 目录只是一个临时目录。

将 Storage 参数设置为 persistent 后,journal 的日志将存储在 /var/log/journal,/var/log 则是一个永久的目录。

步骤二:将 journal 日志设置为永久存储

2.1 修改 /etc/systemd/journald.conf 文件

# vi /etc/systemd/journald.conf

将部分内容修改如下:

[Journal]
......
Storage=persistent
......

2.2 重启 systemd-journald 服务

# systemctl restart systemd-journald.service

参考文献:

https://linuxconfig.org/introduction-to-the-systemd-journal

[排错] Linux 解决出现 “Read-only file system” 的目录

报错代码

Read-only file system

可尝试的解决方法一:重新挂载此目录

# mount -o remount rw /run

(补充:这里以重新挂载 /run 目录并给此目录添加读和写权限为例)

可尝试的解决方法二:修复出现此问题的分区

可尝试的解决方法二:分析

非正常关机可能造成文件系统受损,系统重启后,受损的分区自动挂载后就会变成只读。此时修复这个分区则可能修复这个问题

可尝试的解决方法二:解决方法

# fsck.ext4 -y /dev/sda1

(补充:这里以修复分区格式为 ext4 的分区 /dev/sda1 为例)