Sucsessful upgrade from Debian 5 (lenny) to 6 (squeeze) and extending LVM volume with new Hard disk.

Well, last night I bravely attempted an upgrade of Debian lenny to squeeze which I would like to report overall was a breeze.

I won’t be posting a guide but I would like to point any readers attempting the same to a very useful blog post which helped me though the process.

Following the steps detailed here was a greate help.

I have to state that apart from a few packages installed from source that my Debian install wasn’t too far from the original, with the only external repository added to my source list being the tor repository located here, (deb lenny main), which for the purpose of the upgrade I comented out.

I don’t run debian natively, instead preferinmg to run it inside vmware on top of OS X with SSH and Xforwarding enabled to integrate the two nicely although I pretty much always have both running. I only have to sully myself with Windows while at work now thankfully.

Despite for the main part the upgrade going smoothly  I did run out of space on my root partition before the ‘apt-get dist upgrade’ stage.  Luckily apt flaged this before downloading the packages and due to VMware and LVM the proccess of adding extra space was not taxing.

I simply added a new SCSI drive from the VMWare settings, rebooted Debian to make sure it was seen, although I beleive even this step may have been unecisary due to the nature of SCSI in Linux.

Once rebooted I ssh’d back on to the machine, ran ‘su’ to give me root privileges and did the following;

Please note you could potentially loose all your data performing an operation like this. Always make sure to back up before doing something like this. I cannot guarantee that this will work. Despite having been successful for me any major alteration to your disk or partitions could have catastrophic effects.

debian:/# cfdisk /dev/sdc

(replace sdc with the appropriate name of your new disk, create a partition of type ‘Linux’ with the size you wish. In my case I used the entire disk )

debian:/# lvmdiskscan

(to check that lvm2 is seeing the disk and partition)

debian:/# pvcreate /dev/sdc1

(to add the partition to LVM)

debian:/# vgextend debnet /dev/sdc1

(debnet being the name of my LVM VG. Replace this with the correct name for your setup)

debian:/# lvm lvextend -l +100%FREE /dev/debnet/root (extend the LVM partition called ‘root’ to use 100% of free space)

debian:/# resize2fs -p /dev/mapper/debnet-root

(resize my ext3 partion contained in ‘debian-root’ to use the extra space)

That’s it. My root partition had now been extended to use the extra hard disk. LVM saves the day again and potentially this could have all been done without a reboot.

At this point I continued with the install and am now happily running Squeeze.