Tag archives: linux

Thursday, 19th April 2012 - 12:54:30

bin/bash

I have been messing around with the home server. A disk has died.

Handy summary of all the mdraid devices in your machine:

driveinfo.sh:
#!/bin/bash
for q in `find /dev/ -name md\* | sort`; do echo $q:; mdadm --detail $q | grep -E "/dev/s|Array Size|Raid Level"; echo; done > driveinfo.txt;
grep "/dev/sd" driveinfo.txt | awk '{print $7}' | xargs hdparm -i | grep -E 'dev|Model' | awk '{print $1" "$6}' >> driveinfo.txt;
mail -s "mdraid info" [your email] < driveinfo.txt

This machine is a modifed intel server. Because it does not have the hotswap chassis installed with nice numbering and fixed IDs, its hard to keep track of the drives (there are 10). The idea of this is to send the info across via email so that I can look at it on my mobile or other computer while the server is down.

Wednesday, 15 February 2012

IMG_0546.JPG

I have landed a job in internet land! I will be looking after office pcs and their users doing desktop support as well as looking after a few linux boxes serving VPS.

Monday, 7th November 2011 - 08:49:43

Fedora Logo

During the weekend I upgraded Fedora on my laptop from Fedora 13 to Fedora 15 using the preupgrade utility. This initially took a lot of messing around. The main problem of capacity in the /boot partition was self-inflicted. When I created the partition layout for the system, I only allowed 100MB. This meant that there wasn't enough room to install the upgrade installer boot files to that partition.

Resizing the /boot partition, which was ext3, took a number of steps.

First, it was necessary to convert to ext2. All the utilities required can be found on Hiren's Boot CD by booting into small linux, knoppix would also be a good choice. First, tune2fs is used to convert from ext3 to ext2 by removing the jounal (-O ^has_journal). Once that is done, some space must be made to expand the boot partition. In my layout I removed the swap partition which is directly after to /boot. The friendliest way to do non-straight forward manipulation (i.e. resizing) of the partition table is with gparted. Start gparted and delete the swap partition, then resize the /boot partition to 250 meg. The next thing to do is resize the actual file system to occupy all of the partition. resize2fs is used to expand and shrink ext2 filesystems.

The other important thing I should mention: remove all your custom repos where possible i.e. Adobe et al. Otherwise preupgrade will go hunting for preupgrade packages at those repos (and fail).

Once all that was sorted, preupgrade was left to run overnight downloading about 2.6 gig of rpms.

In the morning I was presented with a reboot button. Once rebooted, the real work starts. Updating 2000 odd packages. This ran for most of the morning but once complete, it worked well with no major problems yet.

Sunday 12th June 2011 - 21:07:51

Chip

I have successfully revived the new laptop. Unfortunately, the spare lid and panel I received (for a different model) has a different mounting system, a straight panel/inverter swap was out of the question. Where the original panel is more inset to the lid with the mounting tabs on the glass side with standoffs extending from the back of the lid, the the new panel is flat on the rear of the lid with mounting tabs on the backlight side.

After assessment and a bit of testing I decided to fit the whole spare back lid to the laptop. Some modification was required. I had to modify the hinge mounting plates to fit the hole arrangement in the laptop and remove some of the plastic molding in places.

The machine was left running with a small stick of RAM running memtest with the screen on. Later in the day I returned and found it had passed successfully several times. I then removed the harddrive and RAM from my old laptop and fitted it to the new laptop.

If I had been running Windows on the original laptop, this probably would have posed a problem, thankfully I have Fedora 13 on it. The old laptop is intel based, the new AMD based. All that was required initially was to switch xorg over to the VESA driver temporarily until the machine came up on the new laptop and had the propriety ATI binary drivers installed. It "just works". Nice.

Tuesday 6th April 2010 - 08:00:37

Chip

Easter long weekend was good. I made some wood bits and pieces and cleaned up a little in the house. Saturday I went and saw Mum and Dad for tea. Sunday I went and saw Brad - we sat around with some other geeks and talked computers/messed about with computers. Monday was for vegetation.

Monday 24th August 2009 - 07:56:49

Chip

Off to work as usual. Hope I get a seat. I'm keen to do some more work on my invoice parser/query tool.

It's a tool used to parse ACCPAC for DOS invoices and stick their contents in a database in a sensible schema that I can report on. Once I can reproduce an invoice, the most basic function - I can move to phase 2, integrating parsing of the payments report and collating that with the invoices in several management reports. This involves porting one of my previous scripts from PHP/MySQL to Python/Postgres. Phase 3 is integration of internet orders data into the bargain. (Python, PHP, Javascript)

Once at work, I'm on a customer job. Writing a database synchronisation script thats designed to replicate a MySQL database into Postgres based around a FIFO table in the MySQL DB. FIFO Records are created by triggers in the MySQL database. The script needs some smarts because of the convoluted way that the developers of the software based around this database do updates. Apparently they didn't know about update - or weren't prepared to plumb in the necessary mechanics to allow the software to decided that it's updating. Their solution: DELETE the record and INSERT every time... Joy.

brewbox (fridge control server) seems to be working away happily - although I haven't connected the controller yet. I need to test the compressor lag routine in the control script. I want to make sure it works before I plug the fridge into it, in case I damage the fridges compressor by turning it on straight after it's been turned off.

Sunday 23rd August 2009 - 13:59:37

Chip

It's a nice warm day today. The kids are out terrorising each other in the yard. I cut some pine earlier for another project and Liam is riding around on his bike (his truck) with the pine and a selection of tools in the back. I'm in the shed resurrecting an old 1U server for my fermentation controller project.

 

I've chosen this old dual P3 server because it pulls under 100 Watts - but still has enterprise server goodies, SCSI hot-swap, ECC RAM (because you need that in a fridge controller). The other reason I chose this server (an NEC 8500 120ra-1) is because it has serial and parallel facilities. The parallel was actually a nice find - I was going to use a USB converter, but I found an entry in the BIOS for parallel configuration. So I took a closer look and found a weird header on the mainboard - I plugged in a DB-25 ribbon cable and tested it with a live CD. Good news! The parallel header-ribbon to DB-25 actually came as surplus electronics in my electronics class in highschool! I was lucky that I still had it.

 

I replaced the CD with a DVD drive and attempted to install CentOS 5.2. Unfortunately the DVD drive is bad, so I downloaded the net install cd image for Centos 5.3 and re-installed the original CD-ROM drive. Looks like the net install is going to take a few hours.

Friday 5th September 2008 - 20:13:20

Chip

I took the day off today. I had acrued extra hours last week.

We bought Liam a little Roary the Racing Car toy that came with a DVD. That DVD has been on repeat for hours!

I bottled my APA (American Pale Ale) - It should taste really good. It's still a bit cloudy though. I started off a Pilsner as well. It's bubbling away nicely now.

I came across a weird file on the server. 78 PETA Bytes! Yes. 78PB. 87,806,822,618,104,772. Pretty impressive since the partition is only 800GB.

Friday 5th September 2008 - 19:48:42

Chip

Inode 30375975, i_size is 87806822618104772, should be 24576. Fix<y>? yes

Saturday 30th August 2008 - 19:02:16

Chip

Oh Yeah! New Drives and New U320 Cable.

Target 0 Negotiation Settings
User: 320.000MB/s transfers (160.000MHz RDSTRM|DT|IU|QAS, 16bit)
Goal: 320.000MB/s transfers (160.000MHz RDSTRM|DT|IU|QAS, 16bit)
Curr: 320.000MB/s transfers (160.000MHz RDSTRM|DT|IU|QAS, 16bit)
Channel A Target 0 Lun 0 Settings
Commands Queued 40885
Commands Active 0
Command Openings 4
Max Tagged Openings 4
Device Queue Frozen Count 0
Target 1 Negotiation Settings
User: 320.000MB/s transfers (160.000MHz RDSTRM|DT|IU|QAS, 16bit)
Goal: 320.000MB/s transfers (160.000MHz RDSTRM|DT|IU|QAS, 16bit)
Curr: 320.000MB/s transfers (160.000MHz RDSTRM|DT|IU|QAS, 16bit)
Channel A Target 1 Lun 0 Settings
Commands Queued 43304
Commands Active 0
Command Openings 4
Max Tagged Openings 4
Device Queue Frozen Count 0

1TB Mirror of j0r

# mdadm --detail /dev/md5
/dev/md5:
Version : 00.90.03
Creation Time : Sat Aug 30 19:10:28 2008
Raid Level : raid1
Array Size : 976759936 (931.51 GiB 1000.20 GB)
Used Dev Size : 976759936 (931.51 GiB 1000.20 GB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 5
Persistence : Superblock is persistent

Update Time : Sat Aug 30 19:10:28 2008
State : clean, resyncing
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0

Rebuild Status : 10% complete

UUID : a09dbd93:faf5d9d1:abf542e5:d7389fec
Events : 0.1

Number Major Minor RaidDevice State
0 8 81 0 active sync /dev/sdf1
1 8 97 1 active sync /dev/sdg1

Friday 29th August 2008 - 21:52:47

Chip

So, what am I supposed to do when I fill 1TB of drives? Yell

...

That's right! Get more. Laughing 2TB more. Well 1. It's going to be mirrored.

I've also got myself a new U320 cable so that I don't have to stretch it over the top of the CPUs. In fact. I think I will move the U320 boot mirror to another lower bay. Photos Later.

I'm currently brewing an APA with a 3Kg ESB APA kit, a BMBS Lager & Draught infusion pack and extra cascade. I'm also using US-05 yeast which is better for APAs. Should be yummy. The last one was!

diff Saves the Day!

Chip

A customer had changed their code before it was under version control. So, it was different to the snapshot of it that I had.

This nifty command saved me

Skips all the ".svn is only in svn/blah/"

diff -r --brief current svn | grep -v "\.svn"

Converting FLV (Flash Video) to MPEG

Chip
ffmpeg -i video.flv -ab 56 -ar 22050 -b 500 -s 320x240 test.mpg

One line Seach and Destroy

Chip

Find and remove in one line. HTML files for example. This prevents bash (or the rm it calls) from bailing when it finds a file with a space in it.

find -type f -name "*.ht*" | while read file; do rm "$file"; done

Web Permissions

Chip

This is my little permissions fix script. Its great for folders that apache serves from.

#/bin/bash
if [[ "$1" == "" ]]
then
echo "Fix Web Permissions Script - Tim 10/09/2007"
echo "Recursively changes permissions on folders 775 and files 664"
echo "Usage: fixperms &lt;user:group&gt; &lt;folder&gt;"
else
chown -R $1 $2
find $2 \( -type d -execdir chmod 775 '{}' + \) , \( -type f -execdir chmod 664 '{}' + \)
fi

Continuous Tail Script

Chip

This is my continuous tail script. It's good to have running on another screen while you are working on PHP code. You can ct the apache error_log and watch the log as the page is accessed. Streamlines the whole debugging thing.

#/bin/sh
if [[ "$1" == "" ]]
then
echo "Continuous Tail Script (50 Lines, 5s Interval). Tim 10/09/2007"
echo "Usage: ct [file]"
else
clear
tail -n 50 -s 5 -f $1
fi