Safely remove SATA disk from a running Linux system

Stop using the disk for anything. Then unmounted any file systems on the disk.

sudo umount ...

Deactivate any LVM groups.

sudo vgchange -an

Prevent disk damage with stop system using disk.

echo 1 | sudo tee /sys/block/{disk}/device/delete

Once you’ve done that, it should be safe to unplug SATA disk from running system.

echo 1 | sudo tee /sys/block/{disk}/device/rescan

Update CentOS kernel for deploy Google BBR

BBR (Bottleneck Bandwidth and RTT) is a new congestion control algorithm which is contributed to the Linux kernel TCP stack by Google. With BBR in place, a Linux server can get significantly increased throughput and reduced latency for connections. Besides, it’s easy to deploy BBR because this algorithm requires only updates on the sender side, not in the network or on the receiver side.

Continue reading “Update CentOS kernel for deploy Google BBR”

Kernel tuning for linux server

Kernel sysctl configuration file for Linux

The following is suitable for dedicated web server, mail, file server etc.
place file in /etc/sysctl.d/60-zercle.conf
and run sysctl --system

Tuning Linux ZFS

Edit /etc/modprobe.d/zfs.conf

# Set use max memory at half of system memory (ex. 4GB/2)
options zfs zfs_arc_max=2147483648

# Increase scrub/resilver worker
options zfs zfs_vdev_scrub_min_active=24
options zfs zfs_vdev_scrub_max_active=64

# Increase sync write
options zfs zfs_vdev_sync_write_min_active=8
options zfs zfs_vdev_sync_write_max_active=32

# Increase sync reads
options zfs zfs_vdev_sync_read_min_active=8
options zfs zfs_vdev_sync_read_max_active=32

# Increase async reads
options zfs zfs_vdev_async_read_min_active=8
options zfs zfs_vdev_async_read_max_active=32

# Increase async write
options zfs zfs_vdev_async_write_min_active=8
options zfs zfs_vdev_async_write_max_active=32

Save and reboot system to active configuration

Mirror http(s) (s)ftp(s) with lftp

Install lftp

#!/usr/bin/env bash
apt update && apt -y full-upgrade
apt -y install lftp
exit 0

Mirror from remote to local

lftp -e "mirror -e -c -P=4 . /local/target-path; bye"


lftp remote_url/path -e [command]

mirror [option] source target

-e delete different files

-c continue transfer

-P=[number] number of parallel connections