Feb 062013
 

If you have previously used Linux’s volume manager (LVM) to set up disk storage, you may want to know about how to grow a filesystem safely.

Which is probably the big feature of any decent volume manager because accurately predicting the size of filesystems is a black art, and the only alternative – to make the root filesystem contain all of the storage is a dumb idea.

It’s actually really easy and can be done non-disruptively. It is done in two parts – effectively growing the “disk” device and then growing the filesystem itself.

Extending The Volume

First identify the volume you need to extend. You can of course simply run lvscan which will show a list of the volumes, and if you have named them sensibly will allow you to pick out the volume to extend. But the simplest way is simply to run df to look at the filesystem you want to extend :-

/dev/mapper/ssd-opt         7.9G  5.5G  2.1G  73% /opt

The device (in the first column) is what we extend. Now to decide how much to grow the volume by; just for the case of this example, we’ll assume that 2Gbytes is a sensible amount to grow the volume by. The command needed is :-

lvextend --size +2G /dev/mapper/ssd-opt

And that’s it. No need to shut down the server, dismount the filesystem, etc. Of course we haven’t quite finished yet.

Growing The Filesystem

What we have done at this point is the equivalent of making the disk bigger. We also need to tell the filesystem it is sitting on a bigger disk, and to do so we need to know the type of the filesystem. The canonical place for checking that is the file /etc/fstab (actually it’s the filesystem itself but that is going too far) :-

# grep opt /etc/fstab
/dev/mapper/ssd-opt	/opt		ext4	noatime		0 3

It is probable that you are looking at growing an ext3, ext4, or xfs filesystem. If not you will have to look up the details yourself.

Growing ext3, or ext4 Filesystems

This is done with the resize2fs command :-

resize2fs /dev/mapper/ssd-opt

Several points :-

  1. Yes it can be done “online” whilst the filesystem is mounted (and applications are busy using it).
  2. You need to specify the device containing the filesystem to grow and not the mount point.
  3. There is no need to specify the size … the size will be determined from the size of the device underneath the filesystem.

Growing xfs Filesystems

This is done with the xfs_growfs command :-

# xfs_growfs /opt

Several points :-

  1. Yes, it can be done “online”. In fact you have to do it with the filesystem mounted.
  2. You need to specify the mountpoint of the filesystem and not the device. Irritatingly different from the above!
  3. There is no need to specify the size.

How Reliable Is This?

Very.

There is always the chance that something could go wrong especially if you are operating “at the edge” (say you have a filesystem that is unusually large – several petabytes). But I’ve done online filesystem resizing for years in countless circumstances without an issue.

I’ll quite happily do it on the most important systems during working hours without losing a moment’s thought. However I do work in a place that takes backups seriously!

Feb 052013
 

So we’ve seen in the last few minutes that as expected a whole bunch of Tories have voted against the proposal to legalise gay marriage. Frankly nobody expected the “hang ’em high and whip ’em” branch of the Tories to vote for gay marriage.

Of course the media and the anti-Tories are gleefully announcing that the Tories are split down the middle and that this might just be the beginning of the end. Of what I’m not sure.

Much as I would like to see the Tories self-destruct, it is very unlikely to happen. This was a free vote – where MPs were encouraged to vote with the conscience rather than according to the party whip. Whilst it is entirely possible that a party who wants to get something through that will be unpopular with their own members, will resort to a free vote, it is a move to be encouraged.

After all, it would be nice to see MPs always voting with their conscience!

Feb 032013
 

It is all too easy to just condemn those vile dregs of humanity who work for the gutter press, and pander to the lowest tastes of people in the name of “news”. They are, after all responsible for the low opinion everyone has of journalists which must be galling to those who actually deserve the title “journalist”.

But we must also remember that despite how unlikely it seems, these dregs actually believe that they are real journalists. This makes them dangerously deluded.

In a less enlightened society, we could amuse ourselves by watching the antics of such creatures – as indeed was done in the past with those poor unfortunates who populated places such as Bedlam, but whether we do that or try to treat them, we do need to keep society safe from their destructive activities.

By all means provide them with a safe community where they can carry on with their “journalistic” activities without harming the real world. And eventually once they have been cured of the delusion that they are real journalists, they can be released into the communities as hack writers of romantic fiction and the like.

Feb 032013
 

For years people have been talking about how a European-like café society would be a good thing to change the English drinking culture.

Perhaps. But have you noticed just how many bars, coffee shops, and restaurants are already sticking tables and chairs outside ? Which is all very well, except when they don’t use their own property but start blocking the public thorough-fair.

Now I don’t object to tables and chairs outside – I’m very partial to sitting down in a shady spot outside with a good book and watching the world walk past; if that shady spot happens to have waitress service with endless refills of coffee, so much the better. But there’s a right way and a wrong way to do this.

And the wrong way is to put the tables and chairs right outside the shop door and so force pedestrians walking past to make a detour. This is annoying enough on it’s own, but gets a whole lot more annoying when you are forced into the street and dodge the traffic, or forced into the centre of a pedestrian precinct out of the shelter of the shops – and so get drenched.

Do it properly, or not at all!

Feb 012013
 

For writing rancid rhino shit :-

http://www.dailymail.co.uk/health/article-1250532/Being-vegetarian-does-harm-environment-eating-meat.html#axzz2JfmFq6AN

There’s two false assumptions in that article casting aspersions on the green credentials of switching to a veggy diet :-

  1. That meat eaters only ever eat British raised meat products.
  2. That vegetarians can’t eat a meal without resorting to a “meat substitute” … by which they mean vegetarian sausages, burgers, etc.

Of course vegetarians eat meat substitutes on occasions – I’ve eaten them at least ten times in the last year.

And given that meat eaters cannot be sure they’re not eating something with horses in it, I somehow doubt they can be sure they’ve only eaten British raised livestock.