We’re all used to doing a disk check in Windows XP.  It’s easy.  Just double-click on “My Computer”, then select the drive you want to run the check on.  Right-click, Properties, Tools tab, then select “Check Now…” in the Error-checking section.  In almost every instance you’ll be told that the check will be done upon the next reboot.  Easy.

So how does one go about it on Linux?  Well… as you may have guessed, it’s not quite so straightforward.  Linux, by default, does actually have an intelligent disk-checking system already in place. By all accounts, you generally needn’t worry.  But if you have a reason to believe your disk may be slowly dying, and nothing is reporting in the SMART status of your drive, perhaps it’s worth checking the file system instead.

That’s where File System Check comes in (duh!).  Like all Linux tools, it’s painfully abbreviated to simply “fsck”.  Terse, to say the least.  Now the warning:

DO NOT.  I REPEAT, DO NOT EVER EVER EVER RUN THIS COMMAND WHILE YOUR DRIVE IS MOUNTED (I.E. IN USE).  I TAKE NO RESPONSIBILITY FOR ANY LOSS OF DATA THAT YOU MAY CAUSE BY FOLLOWING THESE INSTRUCTIONS.

To unmount your root (/) volume, follow these easy steps:

  1. Boot from a Live CD. Your root volume will not be mounted by default.
  2. Open a terminal and type:# dmesg | grep sda If you see output relating to your “SCSI” device, then this will identify that your hard disk, in all likelihood, contains your root partition. For example, amongst other output, I see this:
    sd 2:0:0:0: [sda] Assuming drive cache: write through
    sda: sda1 sda2
    sd 2:0:0:0: [sda] Attached SCSI disk

  3. In the example above, we see that SCSI disk 2 (2:0:0:0:) the Linux kernel registers it as the first logical drive (“sda”) in the system.  We can also see it has only 2 partitions, sda1 and sda2.  If this is the only physical drive in the machine, we should strongly suspect that it uses one partition as /boot (formatted with ext4) and the other as a Logical Volume containing both root (/) and swap. Furthermore, it’s foregone conculsion that the smallest partition will be /boot and the larger one will contain our swap and / partitions, so let’s proceed with accessing them.
  4. So, how do we access a “Logical Volume” within an equally mystical “Volume Group”?  Luckily, Linux LVM comes with a plethora of useful tools to make the job easy.

    # /sbin/vgscan
    Reading all physical volumes. This may take a while...
    Found volume group "VolGroup00" using metadata type lvm2
    Great. We have identified the volume group.  But before we can identify the logical volumes it contains, we need access it.
    # /sbin/vgchange -a y
    2 logical volume(s) in volume group "VolGroup00" now active

    Here, the -a flag indicates that we want to change the “active” status of the volume group, and the y means “yes”.
    # /sbin/lvdisplay
    --- Logical volume ---
    LV Name                /dev/VolGroup00/LogVol00
    VG Name                VolGroup00
    LV UUID                DG2WxJ-sKa5-20mg-NtjW-CsPW-t99V-Egqlja
    LV Write Access        read/write
    LV Status              available
    # open                 0
    LV Size                7.25 GB
    Current LE             232
    Segments               1
    Allocation             inherit
    Read ahead sectors     auto
    - currently set to     256
    Block device           253:2

    --- Logical volume ---
    LV Name                /dev/VolGroup00/LogVol01
    VG Name                VolGroup00
    LV UUID                HqKozT-16PQ-HUaT-Yyc7-lMCO-007m-Xcc2c8
    LV Write Access        read/write
    LV Status              available
    # open                 1
    LV Size                512.00 MB
    Current LE             16
    Segments               1
    Allocation             inherit
    Read ahead sectors     auto
    - currently set to     256
    Block device           253:3

    We can now see two partitions contained within the volume group. The first partition, although small by today’s standards, looks a lot larger than the second.  We can also see that each logical volume has a device node (/dev/VolGroup00/LogVol01, for example).

    As we want to perform the disk check without the parition being mounted, we do not issue any mount command here.  However, if you wanted to double-check that this is the partition to check, mount it and have a quick look around.  The following step is only offered to help in this case – skip this if you wish to perform a disk check.

    # mkdir /tmp/lv0

    For me, the first logical volume (the 7.5GB one) would be the one to test.
    # mount -t ext4 /dev/VolGroup00/LogVol00 /tmp/lv0
    # cd /tmp/lv0
    # ls
    bin  boot  dev  etc  home  lib  lib64  lost+found  media  mnt  opt  proc  root  sbin  selinux  srv  sys  tmp  usr  var

    Ok, that looks like the root partition, so let’s get out of it and unmount it before running the file system check on it.
    # cd /
    # umount /tmp/lv0

  5. An alternative to the above steps, if you have already booted into your main system, is to investigate /etc/fstab to see which is your / volume.  All you do is open a terminal and issue: # cat /etc/fstab On my CentOS 5 system, I see this:

    /dev/VolGroup00/LogVol00 /                      ext4    defaults        1 1
    LABEL=/boot1            /boot                   ext4    defaults        1 2
    tmpfs                   /dev/shm                tmpfs   defaults        0 0
    devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
    sysfs                   /sys                    sysfs   defaults        0 0
    proc                    /proc                   proc    defaults        0 0
    LABEL=SWAP-sdb1         swap                    swap    defaults        0 0

    So, /dev/VolGroup00/LogVol00 is my root volume.

So, now that that’s out of the way, what next?  Well, assuming you now know which is your root partition, the most sensible thing to do would be to boot from a Live CD of some distribution (Ubuntu, Fedora, etc) if you haven’t done so, and then perform the disk check from that.

Once in the LiveCD desktop, we’ll need to fire up a Terminal window.
If you know your filesystem type, e.g. if it’s Ext4, which is the default on the most common distributions, you can run a modified version of the fsck command specifically for that file system.  Here’s what I run for a thorough disk check:


# fsck.ext4 -c -D -f -P -v /dev/
VolGroup00/LogVol00
Alternatively, if your partition structure is slightly older and only contains physical paritions (not Logical Volumes), it may just be a case of finding the partition directly – by checking /etc/fstab on the system when running. In that case, your command may look more like this (when / is unmounted!!):
# fsck.ext4 -c -D -f -P -v /dev/sda2


Here’s what the flags do:
-c  – forces a bad block scan.  Although bad blocks are remapped dynamically by the file system, if the file system or its journal are corrupt, this may not work correctly.
-D  – performs a directory check and optimisation.  Doesn’t hurt, and can speed up directory listings of a large number of files.
-f  – forces the check itself to actually run.  As mentioned previously, the file system maintains itself quite well, and if you don’t force the check, fsck may look at the last check interval and decide a check is not required.
-P  – perform all file system fixes automatically.  This is usually a safe flag, but if your file system is potentially very corrupt, this may not be advisable.  In this situation, contact an expert – or restore your back-up… ;-)
-v   – verbose output. See what’s going on.
/dev/VolGroup00/LogVol00 or /dev/sda2 – this is the partition I want to perform the disk check on.

This little guide doesn’t explain how to perform a check on an encrypted logical volume… That one’s coming. :-)

Updated from post originally put here: http://onecool1.wordpress.com/2008/09/19/how-to-do-a-disk-check-in-linux/

Fedora 16 is here.  With all GNU/Linux distributions, newer versions generally mean better hardware support, usability and so on.  Unfortunately, for users of netbooks, laptops and basically any hardware that contains Realtek’s 8192e wireless chip, things can still be problematic.

I posted, previously, a rather kludgy solution to fixing this in Fedora 14.  Then 15 came along, and the fix I was using then no longer worked.  This is because my previous solution installed the Linux kernel staging drivers for a kernel version very similar to that running in Fedora 14 (but actually built for Ubuntu).

Now that we are 2 versions of Fedora down the road (12 months, then), is the situation better for the humble RTL8192e_PCI ?  Sadly, no.  The main problem is that the 8192e driver is still in the Linux driver staging tree rather than in the main code line.  In the respected opinion of the Linux kernel developers and testers, this means the code isn’t good enough to be enabled by default.  Quite when it will be “ready” to hit the trunk, I’m not sure. 

In the meantime, this means you have to install the kernel’s development modules (staging drivers).

This is quite simple in Fedora:

  1. Enable the RPMFusion repository by following instructions here:
    http://rpmfusion.org/Configuration
  2. Then, as root, install the kmod-staging package:
    # yum install kmod-staging

I’ve decided to go “old school” with some of my free time this year.  For some time, I’ve had (in storage) an Amiga A4000T computer – the top spec with Cyberstorm PPC card, CyberVision graphics card, some SCSI disks, 128MB (remember when you could run an O/S in that??) and so on.

Although the Amiga was always designed to work with analogue video standards (NTSC / PAL), the prevalence of VGA monitors in the 1990s meant that the old “miggy” had to adapt.  One of the great features of the CyberVision card was that it could redirect video from the integral AGA graphics chipset and display Workbench (or anything, it would seem) through the video card instead.  This was no small feat of engineering and, in my opinion, is partly what made computing in the 1990s so interesting; ingenuity, innovation, invention.

Above, AmigaForever© screenshot showcasing OS 3.1.

Left: The Amiga’s Kickstart, prompting for a boot disk.  

My 4000T has seen better days, granted.  Certainly as far as the operating system install and configuration is concerned – the video above shows that I can look forward to the pleasure of installing OS 3.9.  Or perhaps I might investigate OS4 which will harness my PowerPC chip, thanks to the hard work at Hyperion Entertainment.
Whichever, I am still surprised that for a 15 year old machine everything seems so, well, reliable!  The fact that the phase5/DCE CyberStorm/Vision hardware is operational, and the system starts up acceptably, is really testimony of the longevity of ancient hardware.
I’m really looking forward to exploring this machine again, and seeing what has recently been uploaded to Aminet.
Old habits die hard.  Happy New Year 🙂

This problem has been reported for other systems – Jayway covers 64-bit Ubuntu, which is where I derived most of the info I needed (thanks guys!).

If you are developing Android apps using Eclipse, especially on 64-bit Fedora 16, then you too may have come across the error message:

Failed to get the adb version: Cannot run program "/home/[user]/[path]/android/[sdk]/tools/adb": java.io.IOException: error=2, No such file or directory

I did.

To fix it, you need to install 32-bit compatibility libraries.  On Ubuntu (and probably Debian) you can use the getlibs tools.  For Fedora users, it requires installing a few bits and pieces.  Easily accomplished with this:

su -
yum install libstdc++.i686 ncurses-libs.i686
 compat-libstdc++-33.i686

Yum will pull in the necessary dependencies.

Restart Eclipse and the error should disappear.

ThinkPad T420.  Shiny and new.

It is with incredible reserve that I discuss my new Lenovo ThinkPad T420, such is my excitement.  As a natural born geek, software developer and sysadmin, there is something about a ThinkPad which is “just right”.

The lure of a ThinkPad is unquestionable.  It’s the promise of your best bit of code ever.  It’s the idea that it’ll be with you for years; your faithful companion.  It’s the reassurance of industry-leading build quality and top-spec engineering, using high quality components.  But it’s more than that too.  It’s an identity, a bit like that of Apple users – but thankfully in more self-respecting way.  You have a ThinkPad, you join an elite.  It’s everything you want.

You want this so badly that it comes as a bit of a surprise when all is not quite what it seems.

Branded accessories – one of those indulgences.

Better the devil?

As Lenovo only offer such spiffing hardware bundled with a throwaway operating system, you must suffer the wasted hours and ridiculous horseplay that ensues from such choices being made for you.  We are all too familiar with this scenario… so, I’ll continue!

Here is my experience, abridged:

  • Unbox, connect battery, plug in power, switch on.  It switches itself off.  And then back on – phew! 
  • Windows 7 starts up and completes its install process.  You are prompted to answer a few questions along the way:

  • Do you wish to use Norton to protect your PC?  I choose No.  
  • It prompts again: “Are you really, really sure you don’t want to use Norton???”.  I really, really confirm that yes, I don’t want to use Norton, thanks all the same.  
  • Further into the installer, you are prompted to accept the Windows EULA (end user licence agreement).  At the same point, you are also prompted to accept the Lenovo warranty terms.  You cannot proceed if you choose only one.  I imagine that this is another Microsoft “initiative”, a bit like Restricted Boot, which attempts to force people (through fear, usually) into sticking with Windows.
  • Finally, it finishes setting up Win7 and loads up the desktop.  On the offchance that there is a warranty issue, I decide to make a backup using Windows Backup.  Unbelievably, the Windows partition (C drive) contains 26.39GB of data.  WHAT??!!  This is a freshly installed operating system.  How on earth can it consist of so much… bloat?!  There is also a system partition (1.6GB, of which 900MB or so is used) and a Lenovo recovery partition (17GB, of which 9GB is used).  So, I have 36GB of disk space used up for a fresh install of Win7, plus some Lenovo utilities and Google Chrome (installed by default – the only good software choice made by Lenovo so far).   Hesitantly, I begin the backup process to Verbatim DVD+R discs.
  • 3 hours later, now on the 4th disc, the back-up process fails.  The error given is unspecific.  I now have a collection of 4 shiny new drinks coasters.
  • I dig into the Lenovo software and find that I can install “Rescue and Recovery” software, presumably from the Lenovo recovery partition into Win7.  I install it, which takes about 4-5 mins on this core i7 2640 machine.
  • Oh, wait a sec, what’s that?  Some pop-up just appeared above the clock in the right hand corner.  Something about Norton doing something, was that?  Oh, it’s gone.  So, despite being really, really clear that I did NOT want Norton installed on my machine, er, there it is.  Installed on my machine.  Poor Lenovo, poor.  And it gets better.
  • Creating recovery media fails.  Classic.
  • I fire up R and R and find the option: Create Recovery Media.  This looks more promising.  I fire it up, stick in a DVD+R (still have 6 left, hopefully that’s enough..).  It starts off, “extracting files”.  And then stops, and fails.  Apparently, in this instance, I may be able to expect Lenovo to ship me out some recovery CDs.






  • Not to be

    So far, any reasonable, sane person would not feel very confident using Win7 on this machine.  The dream probably wouldn’t be shattered, but clearly the software configuration is dysfunctional, ignoring user preferences and showing some worrying reliability issues out of the box.

    Luckily, being part of an elite means that you don’t follow the masses.  The throwaway software, bundled with the machine, is designed for people who don’t, won’t or can’t think.  It’s also designed for those who blythely accept it, probably “because it’s safer”.  Well, luckily for Windows users it must be a lot safer now that Norton is installed, regardless of your wishes!  Phew!

    To be

    Fedora 16 live CD, running on this T420.

    The alternative, as always, is to not accept what you are given.  Instead, seek a better solution that you can feel confident in.  For this ThinkPad T420, the better solution is GNU/Linux, Fedora 16 flavour.

    Here is how easy Fedora is:

    • You download a live CD, burn it to disc and restart the computer.
    • The CD boots up into a “live desktop” (this doesn’t affect any data on the hard drive).
    • From the live desktop, you run software (e.g. Firefox) as if it were installed on your computer.  On the ThinkPad, all hardware is automatically recognised and usable immediately.
    • From the live desktop, you have the option to install this software to your hard disc.  How refreshing: choice.

    But don’t take my word for it, try it yourself.

    If, that is, you have the mind to.

    Tux, as originally drawn by Larry Ewing 
    Tux – your faithful free-software friend

    It might seem a long way off, but Saturday 5 April 2014 represents your best, last opportunity to ditch that ageing Windows XP and upgrade to a modern, capable, free and secure operating system: GNU/Linux.

    Microsoft are dropping support of Windows XP on Tuesday 8 April 2014.  After then, the numerous security issues that XP will face will go un-patched.  Anti-virus vendors, firewall software writers… basically everyone in the proprietary software world will no longer support Windows XP.

    In the meantime, Microsoft is doing its best to urge businesses to migrate to a newer version of Windows(1).  Note that the term used is “migrate”, not “upgrade”.

    It is claimed(2) that Windows 7 has overtaken XP as the most widely used Microsoft desktop operating system.  Whether this is credible or not, Microsoft is not one to pass up an opportunity to tell companies on XP not to wait for Windows 8(3).

    This is perhaps the best advice they have given:  there are so many freely available secure operating systems available right now, which will run eficiently on current PC hardware, that there really is little point waiting for anything.  There is, of course, an enormouse number of free applications to run on them too, of which here is a highlight.

    Of course, you would wait until Saturday 5 April 2014 to update your computer software but, actually, why wait at all?  You can install Linux alongside Windows to dip your toes in before committing fully.  All you need to do is visit one of these and follow the installation documentation:

    Don’t worry – Microsoft is far more afraid of you getting your feet wet than you are.   If you have any questions, there are loads of resources available to help.  Try a Linux User Group (usalug.com / lug.org.uk), or maybe start on a forum (www.linuxforums.org, www.linuxquestions.org, www.linux.com/community/forums).  Of course, as a business user you may want to opt for enterprise support.  You can find that here: Red Hat Enterprise Linux – and here: Ubuntu for Business.

    Choosing to upgrade from a proprietary operating system to a free operating system can seem hazardous, but rest assured – you are not the first to try!  Millions have gone before you, and millions will come after.  With open source software, there is strength in numbers and these numbers increase daily.

    Come and join in – and try not to have a lot of fun! 😉

    Enhanced by Zemanta

    Scammers rely on your ignorance in order to fool you into clicking on their link and typically entering your bank details.

    Don’t let them! 

    DISCLAIMER:  DO NOT TRY TO VISIT THE EXAMPLE SCAM LINK GIVEN IN THIS POST.  YOU ALONE ARE RESPONSIBLE FOR YOUR ACTIONS.

    When you receive a link in an email, you should analyse that link to determine the authenticity and legitimacy of that link, before you click on it.

    I was recently forwarded a scam email to analyse.  If you have recently received a suspicious email with a link, here’s how to analyse that link.

    Firstly, hover the mouse pointer over that link.  At the bottom of your email window (commonly called the status bar), you should see a web address appear.

    In this example, a link was received purporting to be from the UK bank Cahoot.  But the link address is suspicious – so let’s analyse it…

    http://ip270-c6.gi.digl.pl:8887/securebank.cahoot.com/servlet/com.aquariussecurity.bks.security.authentication.servlet.LoginEntryServletBKS/

    … the bit in bold is what you’re interested in.  The rest is not really of interest.  However, when you come to inspect a link in the future, it’s worth knowing the following:

    How to analyse a link in Thunderbird
    (click for larger image)
    • http://

      This means the protocol that your browser will use.  A secure, encrypted browser connection begins https:// ; therefore, the link above will be unencrypted (not secure) between your computer and the server.  This is a tell-tale sign that it’s trouble.

    • ip270-c6.gl.digl.pl

      This is the domain name, like “bbc.co.uk“, “fedoraproject.org” and “google.com“.  This is the most important bit.  The best way to read this is actually from right to left.  The most right hand part, “pl“, is the top-level domain (TLD).  pl is the TLD for Poland.  tw is the TLD for Taiwan.  ru = Russia.  And so on.  For reference, you can find a list of TLDs here: http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains

      The next two bits should really indicate the organisation of the originating email.  digl is meaningless; it’s been made up by a scammer to probably infer “digital” or something like that.  Likewise, gl is also meaningless.

      A meaningful alternative would be cahoot.co.uk, as it is registered with a UK TLD and represents the claimed originator of the message.

    • :8887

      The last bit of this link is what’s called a port number.  The (optional) use of this by scammers is again a visual distraction which makes it harder to read the real web address.  Apart from the fact that no bank would ever request your details by email anyway, if they were credible they most certainly wouldn’t use a web address with a non-standard port number.

      The best thing to do when reading an address is to ignore the port number but be aware of the fact that it’s been used. 

    For more information, check out this PDF on avoiding email scams.

    And for those who were paying attention and spotted the deliberate mistake, well done! 🙂

    Enhanced by Zemanta

    Mozilla Firefox word mark. Guestimated clear s...
    Image via Wikipedia

    Stupid Firefox 7!  It doesn’t recognise my plug-ins!  But they did work in FF3.5.  What gives?!!!

    Ok, perhaps I’m overreacting.  In fact, I am.  Sorry.

    I use #CentOS for my daily work which includes the rather antiquated Firefox v3.5.  Ouch.  As a web developer, it’s good to test on legacy browsers but it’s also important to use the latest – so I updated to the latest Firefox (v7, at time of writing).

    Because my desktop machine (HP Opteron ML115) has 6GB of RAM, I typically use the x86_64 (64-bit) edition of #Firefox.  However, unlike Firefox v3.5, v7 doesn’t seem to pick up my plug-ins automatically from /usr/lib64/mozilla/plugins.

    To fix this, I had to open a shell and navigate into my home directory‘s mozilla plugins directory (I didn’t even know this existed until now!).

    cd ~/mozilla/plugins
    Then, just fix up all the missing symlinks:

    ln -s /usr/lib64/mozilla/plugins/* .

    No problemo!  They’re now all back again at about:plugins  🙂

    Enhanced by Zemanta