Wednesday, 11 July 2012

Updating Debian Squeeze on PogoPlug

There's a nasty little bug in Debian Squeeze which means that if you update the kernel, IPv6 stops working.  The reason this is so annoying for me is that if the networking doesn't work, I can't get into the PogoPlug at all (there is no direct access, not even a serial console).  It's effectively bricked.

The answer is to run flash-kernel after running apt-get upgrade.  This updates the /boot/uImage and /boot/uInitrd files.  The bug is that this isn't run automatically.

The actual answer for me was to restore from a last known good backup from a couple of weeks agoI attempted to look at the flash-kernel script and create these files by hand but it didn't work.

Friday, 22 June 2012

Check a Linux hard disk - command line

Although checking a ext2/3 disk from the command line is easy, there is surprisingly little concise info out there.  Here's what I did when faced with a disk that kept going into read-only mode (which is usually a sign that something is wrong):

sudo fsck -V -C /dev/sdc1 -- -y -f

I had originally thought that calling e2fsck was correct but fsck is a wrapper which calls the correct version for the file system.  It defaults to ext2.

The options I used are:
-V
Verbose
-C
Gives a progress bar
-y
Answers "yes" to all interactive questions
-f
Forces a check even if one has been done recently.
-c
Uses the badblocks utility to check for bad blocks (duh) and feeds this information into fsck in order to mark those blocks off. From what I read, you are better off specifying this parameter to fsck than running badblocks separately because it will work out block sizes for you this way.

Note that some of the options follow the device name.  These options are passed to the underlying program (e.g. fsck.ext2) without verification.