Or, just use LVM


Or just use LVM which removes the error-prone and nail-biting fdisk step:

  • Unmount filesystem.
  • Extend the logical volume:
    $ sudo lvextend -L2G /dev/vgname/lvname
  • fsck the filesystem:
    $ sudo fsck.ext3 -f /dev/vgname/lvname
  • Extend the filesystem:
    $ sudo resize2fs /dev/vgname/lvname
  • Mount it again.

Note a couple of things:

  • At no point did you have to delete a partition and create it again.
  • There was no need to remember any strange numbers, only the final size you wanted it to go to. This size could also have been specified as an offset: -L+2G extends the existing LV by 2GiB.
  • There is no need to remove the ext3 journal: a clean and unmounted ext3 filesystem has no journal anyway, that’s why the fsck step is done. resize2fs will tell you to do fsck if you don’t do it yourself anyway.

Also bear in mind that any logical volume can be extended as long as there are free extents available in the volume group. Whereas without LVM, it is hard to extend a partition in the middle of the disk.

Just some of the reasons why I think almost every Linux machine should use LVM.

Finally, I have heard that with recent kernels and e2fsprogs the resize2fs can be done on a mounted fs. I have not tried this though.

The seedy side of the NHS

As you may be aware, I was quite ill the other week and ended up spending a night in hospital. Anyway, I’m fine now, but had a follow-up doctor’s appointment today.

One of the things I wanted from the doctor was a sick note for the two days I had off work last week due to my illness. Legally I know I don’t need a doctor’s note because you can self-certify for up to seven days. However, I’d already had some time off for man-flu type things and really wanted to make clear that I wasn’t taking the piss and had been seriously ill.

I explained all this to the doctor and he said, “well I didn’t see you at the time so it would have to be backdated. I can’t give you a backdated sick note on the NHS, but I’m happy to give you a private one. That will cost £10 though.” At this point I’d like to point out that I went to the doctor’s office directly from being discharged from hospital last week partly in order to get this sick note, but the receptionist wouldn’t let me see the doctor then as “sick notes are not emergencies,” instead booking me this appointment 8 days later.

So I go to pay the doctor and only have a £20 note. He rummages in his own wallet to hand me two well worn £5 notes. I don’t get a receipt. Then, “what would you like the note to say?” This experience is making me feel like scum to be honest, but it had to be done, so I went through my whole story again. He actually interrupts my story and says, “..okay that is enough, I will just put vomiting blood, severe pain, hospital attendance, not fit for work, okay?”

Nice doing business with you, doctor. :(

I’m sure there are people all over the country doing this sort of thing to be signed off work for weeks while they do cash in hand work.

Setting envelope sender when using Mail::Send

I just thought I would blog this so that people can find it in a search, as I could not when I tried.

I have a perl script on a machine that sends out transactional emails with the from address like billing@example.com. The machine it sends from is not example.com. Let’s call it admin.foobar.example.com. Since some misguided people think that sender verification callouts are a good idea, their MX hosts try to connect to admin.foobar to see if the billing address is there and accepting mails. This fails because admin.foobar does not run a public MTA and I do not want it to run one either.

It’s clear that the correct thing is for the script to be setting its envelope sender to billing@example.com since billing@example.com should be an email address that does actually work! How to do it with perl’s Mail::Send, however, is not so clear.

After trying to work this out myself for a few hours I asked dg, who is not just a perl monger but a veritable perl Tesco, making mere perl mongers compromise on their margins and putting many of them completely out of business. Every little helps.

Based on his reading of the source of Mail/Util.pm, he thought it might be accomplished by setting the MAILADDRESS environment variable. He was wrong however:

<dg> oh, that only works for SMTP
<dg> how crap

The next suggestion was a no-go also, but third time lucky:

<dg> actually, $msg->open("sendmail", "-f ...");

and that works. So there you go.

Thanks dg.

Vertical tab bar on Firefox 2.x

Having just upgraded my laptop to Ubuntu Edgy one of the things that took me longest to get working how I used to have (or at least how I like) has been the vertical tab bar in Firefox, since Edgy comes with Firefox 2 and the old hack for 1.x no longer works.

For years now I have used a vertical tab bar on Firefox. With the tabs going vertically down the left hand side of the browser window I can fit some 30 to 40 different tabs on one screen and have them all visible at once. Any site that I think I will use more than once I just leave lying around in a tab. It greatly reduces the amount of navigation I need to do.

So I wasn’t at all happy to find out that the hack I used to use no longer works. It took me about an hour of googling to find something that does work, by Johnathon Weare. Now I’ve got it set up I’m pleased to find it actually works a lot nicer than the old hack.

Nice work Johnathon, though your “2.0” name does not sit well with me!