I opted to do this. My partitions were set up thus:
$ sudo lvs LV VG Attr LSize home t420 -wi-ao-- 438.10g root t420 -wi-ao-- 332.00m swap_1 t420 -wi-ao-- 15.50g <-- way too big! tmp t420 -wi-ao-- 369.00m <-- way too small! usr t420 -wi-ao-- 8.38g var t420 -wi-ao-- 2.79g
This was not working for me. Doing backups using the easy backintime was proving difficult, as backintime relied on more /tmp space than I had.
As I rarely touched swap space, I figured that 15.5G was probably a bit large for my needs. Thankfully, nabbing swap space and reusing it for the filesystem is easy as pie – and all achieved with no downtime.
Here’s the sequence I typed into a terminal. First, turn off swap:
$ sudo swapoff -a
Then resize the swap volume:
$ sudo lvresize -L 8GB /dev/t420/swap_1
Now re-format the swap partition before using it again:
$ sudo mkswap /dev/t420/swap_1
Then turn swap availability back on:
$ sudo swapon -a
And finally, resize the /tmp partition on-the-fly:
$ sudo lvextend -L +1G -r -v /dev/t420/tmp
Because the LVM tools have semi-awareness with respect to filesystems, the resizing of /tmp (using the -r switch) was achieved on-line – no need to log out, reboot or anything else. The verbose (-v) switch allowed me to see everything that was happening.
The new partition sizing is:
LV VG Attr LSize home t420 -wi-ao-- 438.10g root t420 -wi-ao-- 332.00m swap_1 t420 -wi-ao-- 8.00g tmp t420 -wi-ao-- 1.37g usr t420 -wi-ao-- 8.38g var t420 -wi-ao-- 2.79g
I also have 6.5G spare on the hard drive now, in case it’s needed by another logical volume.
LVM rocks for easy filesystem management! Try it out!