linuxwebcluster.com

Growing a Logical Volume

I'm working in the same virtual machine as my last post, but now I'm out of space. My laptop is pretty full and when I get into virtualizing server farms, I usually have to create servers with small drives. Here's the easy way to add a disk to an LVM volume group and quickly handle your unfortunate situation... 

Assuming that you have a default installation of Centos / RHEL / Fedora that uses LVM2, this should work fine. First create the drive in VMWare (or add the physical disk, if doing this on a real machine). You should be able to see it in the output from 'fdisk -l', which in my case, tells me the system sees my new disk as /dev/sdb. 

1. Run fdisk and create a single partition, using the whole disk:   fdisk /dev/sdb
2. Create the physical volume:  pvcreate /dev/sdb1
3. Run vgscan to get the exact name of the volume group you want to grow. Here, it's "VolGroup00"
4. Add the new physical volume to your volume group:  vgextend VolGroup00 /dev/sdb1
5. Run lvscan to get the exact name of the logical volume you want to grow. By default: /dev/VolGroup00/LogVol00
6. Grow it to 100% of new capacity  :  lvextend -l +100%FREE /dev/VolGroup00/LogVol00
7. Resize the filesystem. If using the default ext3 filsystem, then simply: resize2fs /dev/VolGroup00/LogVol00

After a quick online resize operation, your shiny new space will be waiting! 

 

smbclient, quick and dirty

Every once in a while, even Linux sysadmins need to grab something from a Windows box. The fast way is to share the Windows folder containing the file(s) you need, install the samba-client package via yum (on Centos / RHEL / Fedora) like so:

yum -y install samba-client

And then get the files with a direct connection to the Windows share:

smbclient \\\\192.168.184.2\\share

Now it's just like ftp! An 'ls' will show you the contents or the remote directory, and 'get <filename>' will grab the file you wanted and transfer it to the current working directory on your Linux box. 
 

Mail in a hurry

I just created a Centos 5 virtual machine in VMware Server with absolutely no optional packages. I only had the first CD... So when I wanted to send an email from the command line, it had no mail server to help its way. The error was: -bash: mail: command not found 

The fastest way I could find was:
yum -y install sendmail mailx

About 60 seconds later I was sending outgoing mail like so:
echo test | mail -s "email subject" This e-mail address is being protected from spambots. You need JavaScript enabled to view it  
 

Top 10 Sys Admin Articles of 2008

 Top 10 Sys Admin Articles of 2008 by Linux Magazine:

http://www.linux-mag.com/id/7195

Includes:

#10

Solving Common Administration Problems with ZFS

One of the most interesting features in Solaris is its ZFS filesystem. Read on for a quick guide to ZFS administration.
link »

#9

Complete Kickstart: How to Save Time Installing Linux

If you have to perform a lot of Linux installs, there’s a fast and easy way to do so quickly and efficiently without having to babysit the installation process each time. By making use of Kickstart, you can save time and effort by setting up a Kickstart server and spend your time getting more useful work done.
link »

#8

Gandalf! Monitor Your Machines with Hobbit

Not quite a ring of power, but Hobbit can take some of the pain out of machine, network and services management.
link »

#7

Wine @ Work: Running MS Office and IE on Linux

Let the Bacchanalia begin! Getting your Windows apps installed and running on Linux the Wine way.
link »

#6

Thin Client Computing, Part One

Thin clients offer an approach to computing with a number of advantages over the more common desktop computer approach. Learn how to enable it.


#5

ZFS on FUSE

Although its features and terminology may seem strange if you’re used to more traditional Linux filesystems, ZFS offers a great deal of flexibility.
link »

#4

Communicating With the Other Half: NTFS Support in Linux

NTFS support has been slow in coming to Linux. But new drivers are now available that enable you to read from, and even to write to, NTFS partitions, including removable media formatted with NTFS. We show you how.
link »

#3

Easy Backups with AMANDA

Using Amanda allows you quickly and easily implement a robust Open Source backup solution to almost any device, or even multiple devices simultaneously.
link »

#2

Enhance Security with Port Knocking

The author of All I Really Need to Know I Learned in Kindergarten left out (at least) one important lesson: Secret knocks are really, really useful. As kids, we’d use secret knocks to keep undesirables (the kids we didn’t like) out of our clubs or rooms. As system administrators, we can use secret knocks to protect our systems from crackers.
link »

#1

Wizard Boot Camp, Part Six: Daemons & Subshells

More about processes and signals: writing daemons, suspending subshells.
link »
 

The "Mon" Monitoring System for Linux

When cluster building, one issue is how to implement health checking and monitoring. So many fine choices...

A partial list would include Ganglia, Nagios, Mon, KeepAlived, and cooking up something new that could be done from scratch. In the end, I picked Mon because it seemed so flexible... It could be bent to my will and made to perform anything my heart desired!    :-)  So here's a Mon howto based on what I learned. 

It's a great piece of software. The way it works is simple:
1. There is a "monitor" which does some kind of test and has exit code either 0 or 1 
2. There is an "alert" which gets called when the exit code is 1
3. There is a config file that specifies which monitors to run, how often, which alerts get called for each, and which nodes they apply to. 

The best part is that pretty much everything is written in scripting languages, and you can write your own alerts, monitors, whatever, in any language you want. They just have to exit 0 (successful) or 1 (failed). And the package comes with dozens of monitors and alerts for checking common things like http services, smtp, etc. 

Mon doesn't have all the bells and whistles of Nagios, but it's rock solid, simple, and very clean. It was the perfect tool for the job: checking on a few different ports and having a highly customizable response. It was almost too easy to write the bash scripts I wanted to be called when a Mon monitor failed a test.... And even better, Mon has alerts that will take the error and email it to you. 

Here's a snippet showing the relevent part of a mon.cf config file to make Mon tick:

hostgroup http_nodes 10.0.0.35
watch http_nodes
    service http_failures
        description Checks port 80 for http failures
        interval 60s   ## Run every 60 seconds
        randskew 5s  ## add / subtract a random skew on 60 seconds
        monitor http.monitor    ## this script connects to port 80 and exits 0 if http response code OK
        period hr {12am-11pm}   ## When to run. This means all the time: 12:00:00 through 11:59:59
        alert apache-restart.alert   ## This can be a simple script like:  '/etc/init.d/httpd restart'
        alert mail.alert This e-mail address is being protected from spambots. You need JavaScript enabled to view it  ## Email me and tell me about the failure
        numalerts 1   ## Alert only once. Subsequent failues are ignored until the monitor passes again, then this gets reset

Pretty cool little program! It's flexibility is key. In minutes, you can make it do anything.  
 
More Articles...


Page 3 of 4

Subscribe to the Linux Admins Blog and get new posts delivered by email!
Enter your email address:

Delivered by FeedBurner

Linux News


Tell the developers:

The type of clustering you are most likely to deploy is:
 
What Linux distro do you use for clusters?
 

Copyright 2010    RapidScale Clusters, LLC