May 24

Linux: Force a filesystem check (old and new way)


Systems with init.d:

1. touch /forcefsck
2. reboot 


Systems with systemd:

1. check the current tune2fs setting
sudo tune2fs -l /dev/nvme0n1p3 | grep 'Maximum mount'

2. Set tune2fs to check
sudo tune2fs -c 1 /dev/nvme0n1p3

3. reboot

On reboot the drive partition will be scanned

4. After loggin back in set the system back:
sudo tune2fs -c -1 /dev/nvme0n1p2
Category: Linux | Comments Off on Linux: Force a filesystem check (old and new way)
May 19

Linux: Clearing journalctl logs to free up space

One of the fastest ways to create some free space especially if you have ran our of drive space is to vacuum your journalctl logs.

Vacuum by time:
journalctl --vacuum-time=1d

Vaccum by log size (log size after the command has completed):
journalctl --vacuum-size=250M

Category: Linux | Comments Off on Linux: Clearing journalctl logs to free up space
April 19

Linux: Disable SSH connection timeout

You need to set the Client and the Server to stop the automatic timeout of SSH non active connections.

Client:
/etc/ssh/ssh_config

Add the following to the bottom of the file:
# Client keep alive
ServerAliveInterval 60

Server:
/etc/ssh/sshd_config

Add the following to the bottom of the file:
# Server Keep Alive
ClientAliveInterval 120
TCPKeepAlive yes
ClientAliveCountMax 720

systemctl restart sshd

Note:
120 X 720 = 86400 seconds or 24 hours

Category: Linux | Comments Off on Linux: Disable SSH connection timeout
April 18

Linux: After changing ulimit settings the proc limits do not match

When changing the ulimit settings in /etc/security/limits.conf or in /etc/security/limits.d/filename for a specific user, you will only see the correct change in /proc/[pid]/limits if you are looking as the user the limit was set for. Looking at this setting in /proc as root or su will display the settings for root not the user you set within the file.

The command:
ulimit -a username
is the best way to tell if the limits config file change is active.

Category: Linux | Comments Off on Linux: After changing ulimit settings the proc limits do not match