Andy Fore | arfore dot com

So one of the things that you probably ought not do is to link directly to a script on github or another development service, especially not directly to someone’s webiste.

In our internal corporate employee site, the devs have used a jQuery Easing plugin by George Smith Graphic Design in the UK.  Apparently they missed the notice on his plugin website about using a real CDN instead of hotlinking to the script on his site.

And even though they ignored that, you would think they would have seen the banner that comes up on the internal site itself.

use_cdn-150x150-4918931

So you have a RedHat/CentOS host that has just been handed off to you.  The host has been configured by the previous admin to mount some storage from a SAN. How do you find out what is mapped where?

Normally to determine what is mapped where and the relevant usage you could use:

This would give you something like the following output:

Filesystem Size Used Avail Use% Mounted on
/dev/sda3 233G 98G 124G 45% /
/dev/sda1 251M 46M 193M 20% /boot
tmpfs 48G 0 48G 0% /dev/shm
/dev/mapper/datasan_vg-datasan_lv 1.0T 218G 807G 22% /datasan
/dev/mapper/pglog_vg-pglog_lv 300G 193G 108G 65% /pglog
10.30.197.250:/vol/onesc_pglog/pg_dumps 238G 223G 15G 94% /backups/pg_dumps
10.30.197.250:/vol/onesc_pglog/pitr_backup 238G 223G 15G 94% /backups/pitr_backup

That’s all well and good. It shows you that you have two logical volumes datasan and pglog that are mounted on the root, but what if you needed to know more about those volumes?

To get more info on the volume groups, use the vgdisplay command:

— Volume group — VG Name pglog_vg System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 11 VG Access read/write VG Status resizable Clustered yes Shared no MAX LV 0 Cur LV 1 Open LV 1 Max PV 0 Cur PV 1 Act PV 1 VG Size 299.99 GB PE Size 4.00 MB Total PE 76798 Alloc PE / Size 76797 / 299.99 GB Free PE / Size 1 / 4.00 MB

VG UUID SrVfEk-e5fx-0x0i-WhXb-uqsM-Uh5S-FDcNeP

— Logical volume — LV Name /dev/pglog_vg/pglog_lv VG Name pglog_vg LV UUID wZBCcO-jGWW-LdkQ-Mbhl-Et8a-1sqC-5Ednj5 LV Write Access read/write LV Status available # open 1 LV Size 299.99 GB Current LE 76797 Segments 1 Allocation inherit Read ahead sectors auto – currently set to 256

— Segments — Logical extent 0 to 76796: Type linear Physical volume /dev/mpath/pglogp1

Physical extents 0 to 76796

Now that you know the physical volume(s) in the logical volume you can find out some details on the physical volume itself:

— Physical volume — PV Name /dev/mpath/pglogp1 VG Name pglog_vg PV Size 300.00 GB / not usable 4.03 MB Allocatable yes PE Size (KByte) 4096 Total PE 76798 Free PE 1 Allocated PE 76797

PV UUID CwxWYc-SjKX-KvPj-vJoq-i4dZ-2jzm-rHGNd1

One of the pains that come with kernel updates in Linux is the necessity to rebuild vendor kernel modules or custom written kernel modules.

As time goes by many vendors are adding support for the Dynamic Kernel Module Support (DKMS) framework.  Recent releases of both the ATI Catalyst and the NVIDIA drivers support DKMS at some level.  VMWare is currently exploring this and you can turn it on (if you have DKMS support installed) however, it is still marked as experimental.

On my production servers we don’t encourage widespread use of experimental features so this has not been enabled with the VMWare Tools installation.  Unfortunately this means that during the patching process it is possible to lose network connectivity due to the need to rebuild the VMWare Tools configuration after a kernel update.

I found one solution to this on the LinuxDynasty site.  The problem with this particular method is that the file that is being checked for “not_configured” only gets written in a small set of circumstances.  In my case, the VM was partially configured, so this file wasn’t written.

Here is my alteration of the solution linked to above.

Update the code in the vmware-tools startup script

In the following file:

Add the following line after the vmblockfusemntpt variable declaration

rebuild_tools=”/etc/vmware-tools/rebuild_needed”

Then add the following line in the end of the start case for the service (around line 1370)

Add the check code to the rc.local startup script

In the file

Add the following to the end of the file

 rkernel=`uname -r`
if [ -e /etc/vmware-tools/rebuild_needed ]; then
echo “vmware-tools not configured for running kernel $rkernel”
echo “running vmware-config-tools.pl”
/usr/bin/vmware-config-tools.pl -d
echo “vmware-tools now compiled for running kernel $rkernel”
echo “restarting vmware-tools”
/etc/init.d/vmware-tools restart
echo “vmware-tools restarted”
echo “restarting networking”
/etc/init.d/network restart
echo “network restarted”
rm /etc/vmware-tools/rebuild_needed
exit 0
fi

Now the next time you reboot your Linux box after updating the kernel, the vmware tools will be properly reconfigured and the appropriate services restarted automatically.

Like many system admins, I don’t want to install any applications that I don’t absolutely have to have on a regular basis.  In many cases this includes the graphical internet application group.

Today I found a need to copy and paste from an eLinks browser session.  It turns out that in the regular terminal in CentOS GNOME, you can’t just select and copy because of the way that eLinks renders the page content.

In order to copy and paste from an eLinks browser into, say, gEdit, you have to hold down the SHIFT key while using the mouse to select the text.

This also applies in a text-only (no X11) setup, assuming that you have gdm installed and running.  Unfortunately, eLinks doesn’t support selecting content with only the keyboard.

Today when I needed to copy some text on my CentOS server, I ended up grabbing a bunch of whitespace at the end of each line.  Normally this wouldn’t be a problem, since I would have copied from a regular browser.  In this case I was copying from with eLinks since I don’t have a graphical browser installed yet.

Sure, I could have just navigated to the end of each line and then used shift + C to delete, but I this was a 25 line block of text and that would have been too tedious.

Here’s the quick search and replace syntax to handle this for you:

%d bloggers like this: