Monday, April 9th, 2007

Spammers ought to be shot

Last night I had the idea that it would be nice to login to one of my servers (beastie.thefraggle.com) and grab a look at the squid configuration I wrote a while back to load balance my website, there was a slight problem with that, however; The server was inaccesible.

I’ve now found out that thanks to spammers, exim was using up so much system resource that the server had started swapping, and even running out of swap space!

More…

Tags: , ,

Leave a comment » Filed under Linux by Chris Ganderton at 12:53.

back to top

Wednesday, April 4th, 2007

someone shoot scsi disks, plz

So restarting the server mentioned yesterday with replaced disk was ok, all I had to do was tell grub-install to recheck for bios devices, and to see the second scsi device, and then install the mbr to it:


grub-install --recheck
grub-install "(hd1)"

take the disk out, put the new disk in slot 0 and hey presto!

The most annoying thing is that I think there is likley a controller problem, so all this work may have been for little gain!!

Tags: , ,

Leave a comment » Filed under Linux by Chris Ganderton at 16:02.

back to top

Tuesday, April 3rd, 2007

cat can have some handy features too.

Another nifty thing I figured out a while ago, whilst having to upload a script written by one of the guys we support, in a windows editor, was how to check quickley and easily with cat(1)whether it had silly windows CR/LF’s :

cat -ev /path/to/file

Would output something like the following if the file had silly line endings…

This is some text written in windaz^M$
And another line edited in windaz, woo^M$

cat suffixes the end of line with a $ and shows any special characters that have been inserted, in our case here ^M is the windows special character for new line, so all you need to do is remove that, which is again pretty easy:

sed -i.bak -sed -e "s/r//g" /path/to/file

Should remove the windaz file endings from the file, copying the file with a .bak suffi as a backup.

Tags: , ,

Leave a comment » Filed under General Life, Linux by Chris Ganderton at 21:56.

back to top

Tuesday, April 3rd, 2007

sfdisk is quite handy

So today I had to basically clone a hard disk from a failing disk, to a new disk Sun had sent for one of the v20z’s at work… Haven’t not had to mess about with partition tables and other such things outside of the installer in linux for some time (last time I did this kind of messing about was with freebsd which uses slices->partitions, unlike linux and it’s mad idea of partitions and extended partitions), so I had to take stock for a short while while I figured out the best way to go ahead. Here’s what I started with :

/dev/sda - main scsi hard disk at scsi id 0
/dev/sdb - new replacement disk at scsi id 1

Saving and restorring the partition table to the sdb was as easy as:

sfdisk -d /dev/sda > /tmp/sda-parttable.out

and then:

cat /tmp/sda-parttable.out | sdisk /dev/sdb

I’d never realised sfdisk could do easy things like that, which saved me some time having to input partition boundries by hand :) What next was a bit of a pain was getting files over to the new filesystems (obviously once I had created new filesystems on them and mounted them somewhere easy to use - /mnt/newroot). I had looked at possibly using cpio to do this, and considered dd.

It seemed the best in the end, to create tar archives of the data, so that if I made a mess of the new disk I could at least quickly extract the backups again without too much faff, to do this I simply archived up each partition using something along the lines of:

tar --preserve --one-file-system -vcf /mnt/newroot/root.tar /

this archived the root into /mnt/newroot/root.tar, but diddn’t traverse into new directories, –one-file-system is a pretty handy feature of tar and I’m sure it’ll come in useful again sometime in the future. Tomorrow I’ll update with how easy it was to install the new mbr to sdb and how removing the origional disk and moving sdb to sda’s slot, goes :)

Tags: , ,

Leave a comment » Filed under Linux by Chris Ganderton at 21:41.

back to top


Credits and stuff

Copyright © [ t h e f r a g g l e . c o m ] | Powered by WP 2.3.1. | Tree by Headsetoptions and MandarinMusing a minimal theme based on HyperBallad Back to Content