Category: Reliable Penguin

Add Storage To LVM/XFS Partition

Let’s assume that you have XFS formatted partition hosted on LVM named “/dev/vg1/gfs1” where “vg1” is the “volume group” and “gfs1” is the “logical volume”. You want to add an additional drive named “dev/xvdc” to the partition to increase storage. Here are the steps: 1. Partition the new drive with fdisk

2. Setup /dev/xvdc1 as an LVM physical volume:

3. Add /dev/xvdc1 to the LVM volume group:

You can show volume group detail to see the newly available storage:

Notice that “Free PE” is 100GB which is the size of our new /dev/xvdc drive. 4. Extend logical volume to use newly available storage:

5. Grow the XFS filesystem on “gfs1”:

And that’s it ..

Of course there are lots of possible variations on the process. For example maybe you don’t want to allocate all of the free space to one single logical volume

Read More »

GoAccess Web Log Analyzer

Here’s a great webserver log analysis tool. It’s lightweight, fast and runs from the command line on Linux: http://goaccess.prosoftcorp.com/ Just download, build and run with something like:

I also like generating an HTML report with something like:

Read More »

Monitor Web Site Files With Auditd

The Linux Auditing System and auditd are a great way to monitor who and when changes are made to the files in your website.  To install and configure follow these steps: 1. Install auditd and related utilities:

2. Make sure auditd is running:

3. Edit /etc/audit/auditd.conf and change:

This sets any action emails to go to your preferred address. 4. Edit /etc/audit/audit.rules and add a line like this to the bottom:

So if you website is located at:

Then a command like:

would setup auditing of write and attribute change requests. Events matching this rule would be tagged with the “mysite” key.

Audit logs go to:

               

Read More »

Prepend Text To Start Of Every Line

Prepend the text “foo” to the start of every line in file. With sed:

With perl:

Taken from: Prepend ## to every line in a text file

Read More »

Fix Completion In Shell On Ubuntu

Sometimes with a new user on Ubuntu I find that filename auto-completion is missing in the shell. I found two issues that cause this: 1. Ubuntu sets new users to /bin/sh which is a very limited shell. So first step is to change the user to /bin/bash:

2. The /etc/bash.bashrc has filename completion disabled by default. Edit this file and un-comment the appropriate lines. Here’s what it looked like on one server:

So I changed to:

Upon login the new user should now have filename completion features. Also note that by default “vi” is handicapped. Here’s how to upgrade to a full feature set: http://blogs.reliablepenguin.com/2013/10/25/fix-vi-ubuntu

Read More »

Categories

Get a free consultation from Reliable Penguin

Submit the form—or for immediate service call 866-649-7984.