Currently Browsing: sysadmin

Expanding LVM Partition on Ubuntu 8.04 LTS with VMWare

  • power off VM
  • edit settings in vmware client to expand hard drive to desired size (i went from 15G to 40G)
  • power on VM
  • parition the expanded area (/dev/sda3 in my case)
fdisk /dev/sda
  • Create a physical volume for LVM:
# pvcreate /dev/sda3
Physical volume “/dev/sda3″ successfully created
  • Add the new physical volume to the volume group:
 #vgextend vg0 /dev/sda3  
Volume group “vg0″ successfully extended
  • Extend the Logical Volume, you can find the amount of space with which you can expand by running the ‘vgdisplay’ command and use the value from “Free PE/Size”
# lvextend -L+24.99G /dev/vg0/lv0
  Rounding up size to full physical extent 24.99 GB
  Extending logical volume lv0 to 39.09 GB
  Logical volume lv0 successfully resized

Sourced some of the steps from

Ways to disable emailed output or mail alert by crontab

Prevent the sending of errors and output by crontab

For a entry-by-entry method to prevent the sending of errors and output, add any one of the following at the end of the line for each cron job to redirect output to /dev/null:
>/dev/null 2>&1.
&> /dev/null

as in

0 1 5 10 * /path/to/ >/dev/null 2>&1

or to enforce for all entries in the crontab, enter the following to the first line of your crontab:


Graphing wind speed and direction using rrdtool and XML Feeds

  • Create windspeed RRD data file:
rrdtool create sbwind.rrd \
 --start 1127253600 \
 DS:wind:GAUGE:600:U:U \
 DS:gust:GAUGE:600:U:U \
 RRA:MIN:0.5:1:600 \
 RRA:MIN:0.5:6:700 \
 RRA:MIN:0.5:24:775 \
 RRA:MIN:0.5:288:797 \
 RRA:AVERAGE:0.5:1:600 \
 RRA:AVERAGE:0.5:6:700 \
 RRA:AVERAGE:0.5:24:775 \
 RRA:AVERAGE:0.5:288:797 \
 RRA:MAX:0.5:1:600 \
 RRA:MAX:0.5:6:700 \
 RRA:MAX:0.5:24:775 \
  • Create wind direction RRD data file:
rrdtool create sbwinddir.rrd \
 --start 1127253600 \
 DS:wind_direction:GAUGE:600:0:360 \


// 2010-02-22 - testing simplexml

 - ellwood:
 - bel air:
 - mesa   :
 - cumbre :
 - airport:

// setup variables

$debug = 1;

$a = array();
$a['ellwood']  = '';
$a['belair']   = '';
$a['mesa']     = '';
$a['lacumbre'] = '';
$a['airport']  = '';

$wdir = "/var/www/";

// loop through the locations and update the graphs
foreach ($a as $location => $value) {

 $xml_url = $value;

 $wind_data = simplexml_load_file($xml_url);

 //$wind_data = $xml;

 $wind_mph      = $wind_data->wind_mph;
 $wind_gust_mph = $wind_data->wind_gust_mph;
 if ($wind_gust_mph == "0")
 $wind_gust_mph = $wind_mph;
 $wind_direction      = $wind_data->wind_direction;
 $wind_degrees  = $wind_data->wind_degrees;
 $wind_string   = $wind_data->wind_string;

 //$update_rrd_data_cmd = "/usr/bin/rrdtool update ${wdir}/${location}.rrd \"N:${wind_mph}:${wind_gust_mph}\"";
 //$update_rrd_data = `$update_rrd_data_cmd`;

 $update_dir_data_cmd = "/usr/bin/rrdtool update ${wdir}/${location}_dir.rrd \"N:${wind_degrees}\"";
 $update_dir_data = `$update_dir_data_cmd`;

 $update_graph_cmd = "/usr/bin/rrdtool graph ${wdir}/${location}_d.png \
 -M -v mph -t ${location}-'${wind_string}' -w 320 --height=120 --alt-autoscale-max --lower-limit=0 -s 09:00 -e 20:00 \
DEF:a=${wdir}/${location}_dir.rrd:wind_direction:AVERAGE  \
DEF:b=${wdir}/${location}_dir.rrd:wind_direction:AVERAGE \
DEF:c=${wdir}/${location}_dir.rrd:wind_direction:AVERAGE  \
DEF:d=${wdir}/${location}_dir.rrd:wind_direction:AVERAGE \
DEF:e=${wdir}/${location}_dir.rrd:wind_direction:AVERAGE \
DEF:f=${wdir}/${location}_dir.rrd:wind_direction:AVERAGE \
DEF:g=${wdir}/${location}_dir.rrd:wind_direction:AVERAGE \
DEF:h=${wdir}/${location}_dir.rrd:wind_direction:AVERAGE \
DEF:i=${wdir}/${location}_dir.rrd:wind_direction:AVERAGE  \
DEF:j=${wdir}/${location}.rrd:wind:AVERAGE \
DEF:ba=${wdir}/${location}.rrd:gust:AVERAGE \
DEF:bb=${wdir}/${location}.rrd:wind:AVERAGE \
CDEF:cdefa=i,0,GE,i,22.5,GE,UNKN,INF,IF,UNKN,IF  \
CDEF:cdefb=i,22.6,GE,i,67.5,GE,UNKN,INF,IF,UNKN,IF  \
CDEF:cdefc=i,67.6,GE,i,112.5,GE,UNKN,INF,IF,UNKN,IF \
CDEF:cdefd=i,112.6,GE,i,157.5,GE,UNKN,INF,IF,UNKN,IF \
CDEF:cdefe=i,157.6,GE,i,202.5,GE,UNKN,INF,IF,UNKN,IF \
CDEF:cdeff=i,202.6,GE,i,247.5,GE,UNKN,INF,IF,UNKN,IF \
CDEF:cdefg=i,247.6,GE,i,292.5,GE,UNKN,INF,IF,UNKN,IF  \
CDEF:cdefh=i,292.6,GE,i,337.5,GE,UNKN,INF,IF,UNKN,IF  \
CDEF:cdefi=i,337.6,GT,i,360.99,GT,UNKN,INF,IF,UNKN,IF \
AREA:cdefa#8D85F3:\"North\" \
AREA:cdefb#9FA4EE:\"North East\"  \
AREA:cdefc#F9FD5F:\"East\" \
AREA:cdefd#EACC00:\"South East\\n\"  \
AREA:cdefe#EAAF00:\"South\"  \
AREA:cdeff#EA8F00:\"South West\"  \
AREA:cdefg#00CF00:\"West\" \
AREA:cdefh#6557D0:\"North West\\n\" \
AREA:cdefi#8D85F3:\"\" \
GPRINT:i:LAST:\"Current Direction in Degrees\:%8.2lf %s\\n\" \
AREA:bb#C0C0C0:\"\" \
LINE2:ba#562B29:\"\" \

 $update_graph = `$update_graph_cmd`;

 if ( $debug ) {
 echo "<p>\n";
 echo "<h2> location = ${location}</h2>\n";
 echo "<h3> url = ${value}</h3>\n";
 echo "<img src=${location}_d.png><br>\n";
 echo "<pre>\n";
 echo $update_dir_data_cmd . "<br>";
 echo $update_graph_cmd . "<br>";
 echo "</pre></p><hr>\n";



$base_path = "/sbwindi/";
<!-- render the page for iphones well -->
<meta name="viewport" content="width=device-width,minimum-scale=1.0, initial-scale=1" />
<title>iphone bel air knolls wind graph</title>
@media screen and (max-device-width: 480px){
/*--- iPhone only CSS here ---*/
 /* font-family:Helvetica, Arial, Verdana, sans-serif; */

#menubar ul {
 list-style: none;
 padding: 0;
 margin: 0;
#menubar li {
 float: left;
 margin: 0 0em;

#menubar li a {
 background: url(css-nav.gif) #fff bottom left repeat-x;
 height: 2em;
 line-height: 2em;
 float: left;
 width: 3.9em;
 display: block;
 border: 0.1em solid #dcdce9;
 color: #0d2474;
 text-decoration: none;
 text-align: center;

#content {

<div id="header">
 <div id="menubar">
 <li><a href="<?=$_SERVER[PHP_SELF]?>?l=airport">airport</a></li>
 <li><a href="<?=$_SERVER[PHP_SELF]?>?l=ellwood">ellwood</a></li>
 <li><a href="<?=$_SERVER[PHP_SELF]?>?l=belair">belair</a></li>
 <li><a href="<?=$_SERVER[PHP_SELF]?>?l=lacumbre">lacumbre</a></li>
 <li><a href="<?=$_SERVER[PHP_SELF]?>?l=mesa">mesa</a></li>
<div id="content" align="left">

function display_wind_graphs($location)
 echo "<br><br>\n";
 echo "<img src=\"/sbwindi/xml/${location}_d.png\" width=\"320\" alt=\"${location}\">";
 echo "<br>\n";
 echo "<img src=\"/sbwindi/xml/${location}_h.png\" width=\"320\" alt=\"${location}\">";

 $location = $_GET["l"];
 switch ($location) {
 case "airport":
 $loc_name = "Airport";
 //echo '<a href=""><img src="" width="250" height="150" border="0" alt="Weather Underground PWS MKSBA" /></a>';
 case "mesa":
 $loc_name = "Mesa";
 //echo '<a href=""><img src="" width="250" height="150" border="0" alt="Weather Underground PWS MAS714" /></a>';
 case "ellwood":
 $loc_name = "Mesa";
 //echo '<a href=""><img src="" width="250" height="150" border="0" alt="Weather Underground PWS MSBELL" /></a>';
 case "lacumbre":
 //echo '<a href=""><img src="" width="250" height="150" border="0" alt="Weather Underground PWS MAS303" /></a>';
 case "belair":
 //echo '<a href=""><img src="" width="250" height="150" border="0" alt="Weather Underground PWS KCASANTA122" /></a>';


vmware esxi – install from a USB drive

after accidentally ordering a dell poweredge r510 server without a cdrom i was desperate to install vmware esxi 4, a bit of googling found:

1. Format USB drive with FAT32 (I needed a 512MB USB drive formated FAT to get it to work on 1 server)
2. Extract VMware iso to USB drive
3. Extract Syslinux onto C: drive
4. Navigate to syslinux-3.72\win32 and run the following command
syslinux.exe -s -m -f -a e: (e: was my usb drive)
5. This will create a file called ldlinux.sys (hidden file so you need to view hidden to see it)
6. Navigate to the USB drive and rename isolinux.cfg to syslinux.cfg. You do not need to change anything in this file. The config file boots the mboot.c32 kernel that is included with the esxi install.
7. Make sure your server is set to boot from USB and you are good to go.

ubuntu in the cloud

ubuntu 9.10 server install screenshot


« Previous Entries Next Entries »

Powered by WordPress | Designed by Elegant Themes