After having a chat about what would be the best managed hosting would be with my friend at Bennet Office Technologies, I’ve just ordered a new Dynamic Cloud Server with 1&1 with a total of 800GB disk space. They rock, but they come with a minor inconvenience: due to the way these server instances are allocated, 1&1 do not automatically extend the partition for you – so you can’t actually start using the full amount you’ve ordered.
Here’s how to make use of the full disk space on a current file system:
df -h
shows all partitions we want to grow, in my case /var is mounted on /dev/mapper/vg00-var so that’s the one I want to grow
pvs
shows us how much free space is unallocated – in my case that’s 707.04 GB
lvextend -L +707G /dev/mapper/vg00-var
will increase our logical volume, leaving a few unused mega bytes lying around. Let’s see how many with
pvs
again shows us the remaining space in MB, in my case 44MB
lvextend -L +44M /dev/mapper/vg00-var
will bolt those on too. So far so good.
resize2fs /dev/mapper/vg00-var
works on LVM filesystems and will add the disk space to the partition we’ve mounted as /var. Don’t worry, this can take a moment or two.
df -h
confirms that we now have 739.04GB of space available on our server. Nice!
Don’t forget to detect the hardware changes in Plesk Health Monitor.
Further Reading
- 1&1 KB Article about how to do this on a Cloud Server: http://faq.1and1.co.uk/server/dynamic_cloud_server/1.html
- 1&1 KB Article about how to do this on a dedicated server: http://faq.1and1.co.uk/server/dynamic_cloud_server/linux_dcs/1.html
If you get an error messages and neither of these commands are found, make sure to install the lvm2 package: