Archive for category linux

PeppermintOS – A Lightweight Linux Distribution

📅 April 18, 2024
“Less is more.”

No, this is not referring to the command less (which is more, by the way) but to a lightweight, minimal Linux distribution named peppermintOS that is perfect for lower-powered hardware or virtual machines where performance matters more than bells and whistles.

Read the rest of this entry »

, ,

Leave a comment

LVM Part 4: RAID

📅 April 6, 2024
RAID (Redundant Array of Independent Disks) is available in Linux using mdadm, but did you know that RAID is also possible with LVM?

By default, LVM creates a linear logical volume, but we can create a RAID logical volume as well with RAID modes 0, 1, 4, 5, 6, and 10 (also known as 1+0).

How is RAID accomplished with LVM?

Read the rest of this entry »

, , ,

Leave a comment

LVM Part 3: Logical Volumes

📅 April 3, 2024
We have created physical volume building blocks. We assigned them to volume group storage pools. Now, it is time for the final piece of the LVM system: logical volumes.

The logical volume is the “thing” that we format, mount, and allow users to interact with. We can treat a logical volume just like any other NVMe, SSD, or HDD.

Read the rest of this entry »

, ,

Leave a comment

LVM Part 2: Volume Groups

📅 April 1, 2024
We have our physical volumes created, but what do we do with them?

Can we format them? Can we store data on them?

No, not yet. A physical volume merely specifies a drive or partition that is to be used with LVM. The next step is to assign physical volumes to volume groups, and this is were the fun and flexibility of LVM becomes apparent.

Read the rest of this entry »

, ,

Leave a comment

LVM Part 1: Physical Volumes

📅 March 31, 2024
Linux has a number of handy technologies built in that have existed for a long time but seem to receive little attention because they are taken for granted or simply not talked about.

One of these is logical volume management (LVM) that allows us to treat hard drive storage space in a way similar to RAM. Comparable to adding another memory stick to expand RAM, we can add more hard drives to expand hard drive storage space. Need more secondary storage? Just add another hard drive.

This simple concept is incredibly versatile and saves time by eliminating the need to backup and restore data following a new drive addition to a system. It requires some extra steps to set up and has a few specific terms to learn, but the benefits are worthwhile.

LVM consists of three layers to create a working storage system. In this part, we will focus on the physical drives themselves, called physical volumes. These can be mechanical hard drives, SSDs, SAS, or even super fast NVMe storage devices.

Read the rest of this entry »

, ,

Leave a comment

Bash: Typed Variables with declare

📅 March 23, 2024
Variables are untyped in Bash by default, but there might be times when we need to create variables that hold only specific data types or have specific purposes.

The declare command allows us to achieve this in order to add extra protections on variables, and there are a few different types allowed.

Need a variable that only stores lowercase strings? How about an integer only and reject all other values? Maybe you need an indexed or associative array? Perhaps you need to create a constant?

Read the rest of this entry »

,

Leave a comment

Bash: The let Keyword

📅 March 18, 2024
JavaScript has the let keyword that creates a variable with scope.

Bash has the let keyword too, but it serves a different purpose.

Read the rest of this entry »

,

Leave a comment

What is nohup?

📅 March 17, 2024
“Help! I need to keep a program running after closing the terminal.”

There can be times when we connect to a remote system via SSH, for example, and we need to run a lengthy process on the remote system. However, we also might need to log out or close the connection, but we want the process to continue running.

Normally, the process terminates when the terminal is closed.

nohup is a way to keep a remote process running even after the terminal is closed.

Read the rest of this entry »

,

Leave a comment

Redundant Synchronized Pi-Hole with keepalived and gravity-sync

📅 March 4, 2024
“Help! When Pi-Hole goes down, nobody can access the Internet!”

Pi-Hole is a superb network-wide ad blocker because it blocks connections to forbidden domain names listed in its blocklists when resolving DNS requests, but if Pi-Hole hangs up or is inadvertently turned off for whatever reason, then domain names cannot be resolved and it seems like the Internet is down.

To help protect against this and provide some form of resiliency, we can mirror two Pi-Hole instances so if one goes down, the backup will take over, and users can still access the Internet.

This is simpler than it sounds thanks to a service called keepalived. Let’s see how to set up two Pi-Hole instances using a virtual IP address (VIP) to provide high availability (HA).

Read the rest of this entry »

, ,

Leave a comment

Bash: Read JSON File to Add Many Users

📅 February 22, 2024
“Can Bash parse a JSON file?”

Yes, but not natively like Python can using the json module.

Parsing a JSON file from a Bash script usually involves writing custom code that parses strings and such, but there is a handy program call jq that handles the details of JSON parsing for use.

Suppose we want to add a batch of user accounts, each user with a unique password and assignment to a Linux specific group. This involves more user information that a simple username with a temporary common password. We can store this user information in a JSON file, and then let a Bash script process the user data from the file to create the users.

Here is one way to achieve this.

Read the rest of this entry »

, , ,

Leave a comment