All hardware eventually fails. This is one of the painful side effects of entropy in our universe. For most of the types of hardware used in modern infrastructure, the loss of a single component usually incurs some amount of downtime. Other than the time taken to swap out something like a bad CPU or stick of RAM, sysadmins or users rarely see many long term ill-effects. But unless an admin takes particular care with storage, data loss from disk failures can have immediate and lasting consequences.
Continue reading “RAID Types – Explained”Category: Unix
Unix
Manipulating text with sed
The sed
utility can be used to print the contents of a
file, substitute a line (or multiple lines), and then save the file. In
contrast to grep
, sed
can substitute a line or multiple lines in a file and perform an in-place update of that file.
The simplest sed
invocation when substituting foo
for bar
is:
$ sed 's/foo/bar/' inputfile
Continue reading “Manipulating text with sed” The /etc/passwd File
There are several different authentication schemes that can be used on Linux systems. The most commonly used and standard scheme is to perform authentication against the /etc/passwd
and /etc/shadow
files.
/etc/passwd
is a plain text-based database that contains information for all user accounts on the system. It is owned by root and has 644 permissions. The file can only be modified by root or users with sudo privileges and readable by all system users.
Modifying the /etc/passwd
file by hand should be avoided unless you know what you are doing. Always use a command that is designed for the purpose. For example, to modify a user account, use the usermod
command, and to add a new user account use the useradd
command.
The /etc/shadow File
There are several different authentication schemes that can be used on Linux systems. The most commonly used and standard scheme is to perform authentication against the /etc/passwd
and /etc/shadow
files.
/etc/shadow
is a text file that contains information about the system’s users’ passwords. It is owned by user root and group shadow, and has 640 permissions.
Using lsof to Recover Deleted Files
If an open file is deleted accidentally, it is possible to use lsof to recreate a copy of the file; provided this is done before the file is closed by the application holding it open.
If you have inadvertently removed a file from the filesystem it is still recoverable if the application using the file it still running. This is because the inode is still open and therefore the data blocks are still on the disk until the application closes the file or exits.
Continue reading “Using lsof to Recover Deleted Files”Ansible Part I: Installation and Setup
This is the part one of the four part series on the basics of how to use Ansible. There will be a gradual introduction from basic to intermediate examples how to install, setup and use Ansible. As well as the how to create ansible playbooks and roles. Let’s get started with Part One: Installation and Setup.
Continue reading “Ansible Part I: Installation and Setup”The Linux Filesystem Explained
Have you ever wondered what all the folders on the root (/) directory of the Linux filesystem are for? Which file goes into which directories and why are they saved in those directories? On this post, we’ll check out each folder and what purpose or function they serve for the operating system itself. Continue reading “The Linux Filesystem Explained”
Comparing files using the diff command
The diff
command outputs the differences between two files, line by line. For files that are identical it produces no output, for binary files only reports if they are different or not.
The set of differences produced by diff
is often called a diff
or patch
, and this output can be used later on by the patch command to change other files. Continue reading “Comparing files using the diff command”