Spamming Badgers

Today was a landmark for BloggingIT. I had my first proper spam comments on the site.

I woke up and thought that I’d check my email, and for some reason decided it might be smart to check out my blog’s admin page. I’m glad I did!

I found 7 new comments dotted around the site, not a single one happened to be about what was being posted, so I cleared out and decided that it’s time that I did something about it.

I’ve set up a WordPress account and have an API code to activate Akismet.

After long day’s work and a domestic call out, I’ve just sat down, and today alone Akismet has caught 147 spams!

I feel quite lucky that I happened to check this. I wouldn’t want the arduous task of having to clear out all of those spam comments!

Recovering bad discs in Linux – pt 2

So, maybe in part 1 the data recovery didn’t work for you?

Well, that’s OK because Linux is robust against bad discs in one form or another. The trick is to work out what that might be.

A good method is to use dd or dd_rescue. These tools create a forensic copy of your hard disk drive or partition so that you can mess around with it without affecting the original drive. This is also a benefit as generally a virtual disk will mount and work faster than a faulty disk drive.

To begin with, we need to create that copy of the partition that you need data from.

mkdir ~/myDisks
dd_rescue /dev/hda1 ~/myDisks/hda1.image

The reason that I’m using dd_rescue rather than dd is that seeing as you’re reading this guide, the drive probably has faulty areas of the disk. dd_rescue will work around those quite nicely.

I’m working on the premise that it’s a single partition that you need to recover. If not, you may want to look over at http://edseek.com/~jasonb/articles/linux_loopback.html#id2494145 to read up on ways to read parts of disk images and generally show off.

Right, so we have our image.

Let’s set up the mount point

mkdir /mnt/restore

And now mount the new partition image

mount -o loop ~/MyDisks/hda1.image /mnt/restore

The partition should now mount on the folder. To check if anything is there:

ls /mnt/restore/

You should see a familiar list of files (or if someone else’s drive, one that is not so familiar). You can now copy the files away and do whatever you need to do to the image.

Once finished, unmount the disk image

umount /mnt/restore

Setting up an Oki C5450 in linux with CUPS

I finally completed getting all of my printers working together nicely today.

It’s been a while, but I must admit that while I’m using the Windows XP virtual machine for my office work, the need to print in Linux is not that great.

Oddly, the HP psc 2510 was the first to behave itself. Using the HPLIP toolbox that comes with Ubuntu, I found myself scanning like a demon in no time. The toolbox also seems to scan much faster than the proprietary HP Windows-based driver (and as a bonus doesn’t insist on installing over 100MB of software on your computer).

Anyway, after sorting out some DNS issues I happened to be having, I found it was nice and easy to set up the printer. You’ll need to download the Oki driver from Oki.

  1. Open up your web browser
  2. In the address bar type in http://localhost:631
  3. Click ‘Add Printer’ and enter the name of the printer, and other bits that CUPS asks for. Click ‘Continue’
  4. In the ‘Device’ list, select ‘Internet printing protocol (ipp)’ and click ‘Continue’
  5. In the ‘Device URI’ textbox, enter http://printerip/ipp, replacing printerip with the name or IP address of your printer. Click ‘Continue’
  6. In the Make/Manufacturer, click ‘Browse’ and select the driver that you have downloaded. Click ‘Add Printer’
  7. Click on the printer name, and send a test print to the printer.

As long as all of the settings are correct, the Oki should spring into life.

The web configuration page outlines the valid ipp addresses, but here they are for completeness.

http://hostname/ipp
http://hostname:631/ipp
http://hostname/ipp/lp
http://hostname:631/ipp/lp

Remember to replace hostname with your printer’s network address.

Some windows lose opacity in Beryl

There’s a small incompatibility in Beryl which causes certain program windows to appear translucent or transparent.

A simple fix for this is to

  • Open up the Beryl Settings manager
  • Click Windows Management
  • Enable and select the WIndow Specific Settings option
  • Under the Rules tab, expand Disable ARGB Visual, and click Add (the + button).
  • Select Class Name in the list, click Grab and click on the window that is causing problems.
  • Click ‘OK’

You should see something appear in the Disable ARGB Visual list like

c:rdesktop:1

In this case, I was having trouble with the terminal server client programs running in more than 256 colours.

You may need to reload Beryl for this to apply properly.

Recovering a faulty hard disk drive in Linux – PT1

Today, I’ve been working on a server that doesn’t want to mount one of the partitions that has been formatted with reiserfs.

Using the fsck command doesn’t work because there are bad blocks on the drive, resulting in fsck vehemently refusing to cooperate.:

Cannot read the block (41713664): (Input/output error).

To get fsck to play with such a faulty device, you need to build a list of badblocks first, so that fsck can deal with them. If the disk is REALLY bad, then this will do no good at all – just dd_rescue that bad boy!

It’s never bad to backup before doing something like this anyway, so if you can – use dd_rescue to clone onto another disk. The likelihood is that you don’t have another disk and that’s why you’re reading this. If so, read on.

First of all, we need to be able to tell fsck which blocks on the disk are bad. To compile a list of badblocks, you’ll need to use the badblocks tool:

badblocks /dev/hda1 >>badblocks.txt

Obviously, change hda1 for the partition that is causing you trouble.

You may also need to specify a block size for the partition. The default is 4096, which is the standard size of reiserfs, but to be doubly sure, you can run the debugreiserfs command, and the output will show you the blocksize:

Blocksize: 4096

If the blocksize differs, run
badblocks -b 4096 /dev/hda1 >>badblocks.txt
replacing 4096 with your block size.

This may take some time. Grab a book, make a drink, have a snack.

Once the blocks have been read, enter less badblocks.txt to make sure that there is something in the file. You should see a series of numbers output to the screen. If that’s good, press ‘q’ to return to the shell.

Now to run fsck. We will need to account for the bad blocks, so you will need to include that badblocks file that you have just created:

fsck.reiserfs –fix-fixable -B badblocks.txt /dev/hda1. Once again, change the device from hda1 to what you are trying to recover. As long as the driver isn’t completely nerfed, the you might be able to run through the commands and recover the drive table.

If not, then I’ll have another article very soon.

The Saddest Thing I Saw Today…

… was in Asda.

I’ve heard of this being done before, but I never really could believe it.

There were signs on the entrance advising customers that if they told the meet-and-greet chap that they are single on Valentine’s Day, then they would be given a red balloon to walk around with.

If someone were plucky enough to have the courage to engage a ‘balloon carrier’ in conversation, you never know – it could lead to love!

I don’t know, though. Surely the red balloons would more likely be used for target practice?