Richard Martin's Blog

Resizing disks that are in use

by Richard Martin on Nov.17, 2010, under Linux admin, Xen

This was done for a Xen Server but it’s also CentOS 5.X relevant

This gives you a pretty good idea where I got it from: mine just makes more sense to me…..

http://www.howtoforge.com/logical-volume-manager-how-can-i-extend-a-volume-group

For our setup this should work: (as root)

[root@doyle ~]# df -h
 Filesystem            Size  Used Avail Use% Mounted on
 /dev/mapper/VolGroup00-LogVol00
 9.6G  8.3G  887M  91% /
 /dev/xvda1             99M   29M   66M  31% /boot
 tmpfs                 2.0G     0  2.0G   0% /dev/shm

[root@doyle ~]# fdisk /dev/xvda

Command (m for help): n
 Command action
 e   extended
 p   primary partition (1-4)
 p
 Partition number (1-4): 3
 First cylinder (2089-3263, default 2089):
 Using default value 2089
 Last cylinder or +size or +sizeM or +sizeK (2089-3263, default 3263):
 Using default value 3263

Command (m for help): p

Disk /dev/xvda: 26.8 GB, 26843545600 bytes
 255 heads, 63 sectors/track, 3263 cylinders
 Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System
 /dev/xvda1               1          13      104391   83  Linux
 /dev/xvda2              14        2088    16667437+  8e  Linux LVM
 /dev/xvda3            2089        3263     9438187+  83  Linux

Command (m for help): t
 Partition number (1-4): 3
 Hex code (type L to list codes): 8e
 Changed system type of partition 3 to 8e (Linux LVM)

Command (m for help): p

Disk /dev/xvda: 26.8 GB, 26843545600 bytes
 255 heads, 63 sectors/track, 3263 cylinders
 Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System
 /dev/xvda1               1          13      104391   83  Linux
 /dev/xvda2              14        2088    16667437+  8e  Linux LVM
 /dev/xvda3            2089        3263     9438187+  8e  Linux LVM

Command (m for help): w
 The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
 The kernel still uses the old table.
 The new table will be used at the next reboot.
 Syncing disks.

[root@doyle ~]# partprobe

[root@doyle ~]# pvcreate /dev/xvda3
 Physical volume "/dev/xvda3" successfully created

[root@doyle ~]# vgextend /dev/VolGroup00  /dev/xvda3
 Volume group "VolGroup00" successfully extended

[root@doyle ~]# vgdisplay -v
 Finding all volume groups
 Finding volume group "VolGroup00"
 --- Volume group ---
 VG Name               VolGroup00
 System ID
 Format                lvm2
 Metadata Areas        2
 Metadata Sequence No  4
 VG Access             read/write
 VG Status             resizable
 MAX LV                0
 Cur LV                2
 Open LV               2
 Max PV                0
 Cur PV                2
 Act PV                2
 VG Size               24.88 GB
 PE Size               32.00 MB
 Total PE              796
 Alloc PE / Size       508 / 15.88 GB
 Free  PE / Size       288 / 9.00 GB
 VG UUID               HrYjDo-9fiE-hgkm-2txv-xYNU-5IZ1-R0uv7T

--- Logical volume ---
 LV Name                /dev/VolGroup00/LogVol00
 VG Name                VolGroup00
 LV UUID                puFeFN-PgRp-J48y-ctl2-6fh6-L3G5-1YEnNY
 LV Write Access        read/write
 LV Status              available
 # open                 1
 LV Size                9.91 GB
 Current LE             317
 Segments               1
 Allocation             inherit
 Read ahead sectors     auto
 - currently set to     256
 Block device           253:0

--- Logical volume ---
 LV Name                /dev/VolGroup00/LogVol01
 VG Name                VolGroup00
 LV UUID                ybetsV-Rl1t-Ggu7-UuD8-xpiv-nZ7d-s1qamU
 LV Write Access        read/write
 LV Status              available
 # open                 1
 LV Size                5.97 GB
 Current LE             191
 Segments               1
 Allocation             inherit
 Read ahead sectors     auto
 - currently set to     256
 Block device           253:1

--- Physical volumes ---
 PV Name               /dev/xvda2
 PV UUID               kS8J7f-up3K-Y8N9-1d53-VFBA-eNsb-8gnj0M
 PV Status             allocatable
 Total PE / Free PE    508 / 0

PV Name               /dev/xvda3
 PV UUID               NhWEmp-Msle-UIYa-vSSZ-l67U-oCNk-oWC0pu
 PV Status             allocatable
 Total PE / Free PE    288 / 288

[root@doyle ~]# lvextend -l+288 /dev/VolGroup00/LogVol00

[root@doyle ~]# resize2fs /dev/VolGroup00/LogVol00

[root@doyle ~]# df -h
 Filesystem            Size  Used Avail Use% Mounted on
 /dev/mapper/VolGroup00-LogVol00
 19G  8.3G  9.2G  48% /
 /dev/xvda1             99M   29M   66M  31% /boot
 tmpfs                 2.0G     0  2.0G   0% /dev/shm

Done :) 
Leave a Comment : more...

Easy GIS MapServer install

by Richard Martin on Sep.16, 2010, under GIS

PostGIS

# RPM directory to postgres 8.4.4: rpm -Uvh  http://yum.pgsqlrpms.org/reporpms/8.4/pgdg-centos-8.4-2.noarch.rpm

# yum list | grep postgresql

# yum install postgresql postgresql-server

# service postgresql start (initdb if data upgrade required)

# yum install postgresql-devel.x86_64

# yum install libxml2-devel

# yum install gcc-c++

wget  http://download.osgeo.org/geos/geos-3.2.0.tar.bz2
tar -xvf geos-3.2.0.tar.bz2
cd geos-3.2.0
./configure
make & make install
make check
ldconfig

wget  http://download.osgeo.org/proj/proj-4.6.1.tar.gz
tar -xvf proj-4.6.1.tar.gz
cd proj-4.6.1
./configure
make
make install
ldconfig

wget  http://download.osgeo.org/gdal/gdal-1.7.2.tar.gz
tar -xvf gdal-1.7.2.tar.gz
cd gdal-1.7.2
./configure
make & make install
make check
ldconfig

tar xvfz postgis-1.5.1.tar.gz
cd postgis-1.5.1
./configure
make
make install

ldd -d /usr/lib64/pgsql/postgis-1.5.so (check links)
ln -s /usr/local/lib/libproj.so /usr/lib64/libproj.so.0 (i needed this as there was no link)

createdb gis
createlang plpgsql gis
psql -d gis -f postgis/postgis.sql
psql -d gis -f docs/postgis_comments.sql
psql -d gis -f spatial_ref_sys.sql

Mapserver

http://mapserver.org/installation/unix.html – install important libraries

Another source recommends at least these:
httpd
httpd-devel
byacc
flex
php
php-devel
postgresql
postgresql-contrib
postgresql-server
postgresql-devel
python
python-devel
gcc-c++
curl
curl-devel
gd
gd-devel
php-gd
php-dbase

./configure \
–with-proj \
–with-geos \
–with-ogr \
–with-gdal \
–with-postgis \
–with-curl-config \
–with-httpd=/usr/sbin/httpd \
–with-php=/usr/include/php

2 Comments more...

XenServer Virtualisation

by Richard Martin on Sep.16, 2010, under Linux admin, Xen

Just get the free one – unless you want high availability…. which is nice if you need it – which we do…..  Shared storage is a must – we use some expensive dell stuff but any have decent iSCSI will do – and openfiler is quite nice….. make sure you bond your NIC’s and dedicate a NIC to the management port and one or two for iSCSI…. and a couple of pfSense firewall appliances using CARP in the LAN and WAN works beautifully for redundancy (if you use multiple switches) …..  Buy some pro support form pfSense – well worth it – they are VERY helpful….  add in a few servers and you have a serious cluster…. throw in PostgreSQL-XC and you’re away on some serious redundant kit for not very much….

Leave a Comment :, , more...

Xen installation

by Richard Martin on Aug.01, 2009, under Linux admin, Xen

On a PowerEdge 2950 as root:

yum install xen

install a remote Centos 5.3 image from my local mirror…

virt-install

eh… that’s it.  Rather simple.  See here for proof….

Now for Windows Server 2003….. :)  Perhaps a longer post is looming…

Leave a Comment more...

Replicating PostgreSQL – the easy way – with rubyrep

by Richard Martin on Aug.01, 2009, under Linux admin, PostgreSQL

I’m a great fan of Bucardo for PostgreSQL replication…. it’s stable but quite hard to use…. if you want fire and (not) forget replication try RubyRep…. awesome.  The documentation is perfect but to make it even easier, if you are testing and messing around… uninstall, then re-scan, then replicate otherwise you might get some bizarre replication errors, or foreign key contraint issues etc… anything odd, just un-install, then re-scan and replicate.  It really is full proof… well it worked for me!

For the cut & paste brigade: (RTFM)

rubyrep generate myrubyrep.conf

rubyrep scan -c myrubyrep.conf

nohup rubyrep replicate -c myrubyrep.conf &

Remember the nohup and the &, to background it, unless you’re actually at the console of the production server – which you probably aren’t….  In fact stick the nohup and & on the scan command too as that could take a few hours on a big DB…

Then tail -f nohup.out to watch the (lack) of output, output is normally bad – loss of connection:

2009-07-31T22:22:13+01:00 Exception caught: no connection to ‘right’ database

and what not… but rubyrep will just keep going once the connection comes back up.  Perfect!

3 Comments : more...

Installing Xen 3.4 on a Dell PowerEdge 2950

by Richard Martin on Jul.17, 2009, under Linux admin, Xen

Here goes, will it work with CentOS 5.3 and Windows Server 2003 guests?  This is what I did and the general setup….

Leave a Comment : more...

trac – wiki bug tracker

by Richard Martin on Jun.17, 2009, under PostgreSQL

If you live in the UK and like ‘proper’ dates use this:

PythonOption TracLocale en_GB

in your httpd.conf (between the locations)

Leave a Comment more...

Mac Mini Media Centre

by Richard Martin on May.31, 2009, under Mac OSX

Does it work? Oh yeah….. after much reading and then buying one I found out nothing seems to work that well. However, Plex makes the world perfect so forget the rest and get Plex for the best media centre you can get.

My setup:

Sony 46″ TV 1080p running from my Mac Mini 2.26GHz Intel Core 2 Duo processor via the DVI to HDMI cable. I use EyeTV from Elgato to watch live DVB broadcasts and Plex for all my movies, DVD’s mkv’s, avi’s – you name it. Remote Buddy makes the setup complete for the Apple Remote.  No hassle no messing, just out of the box – as it shoud be.  No skipping, no shudder, perfect sound – and a very quiet (silent) HTPC solution.

Leave a Comment :, more...

Clear DNS cache on Mac Leopard 10.5.7 OS X

by Richard Martin on May.28, 2009, under Linux admin

If you mess with your DNS and need to reload the latest DNS entries clear your DNS cache with:

dscacheutil -flushcache

2 Comments : more...

Mapserver on CentOS install guide

by Richard Martin on Jan.16, 2009, under GIS

I’ve been promising myself I’d sort this out for the greater good but over a year…. so here goes….

If you are even more lazy than me then install HostGIS – Gregor will save the day…. it’s the best install of GIS stuff I’ve ever seen….

But onto CentOS and Mapserver etc…..

Leave a Comment : more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...