May 072015
 

In this particular case I had to add a swap partition to existing Ubuntu system.

insta-07

Shrink LVM

df -h
umount /var/www/owncloud/data
resize2fs /dev/mapper/vg0-owncloud 15G
lvresize -L 15G /dev/mapper/vg0-owncloud
lvdisplay /dev/mapper/vg0-owncloud
e2fsck /dev/mapper/vg0-owncloud
mount -a
mount
df -h

create new LVM (swap)

# vgdisplay
--- Volume group ---
VG Name vg0
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size 20.00 GiB
PE Size 4.00 MiB
Total PE 5119
Alloc PE / Size 3840 / 15.00 GiB
Free PE / Size 1279 / 5.00 GiB
VG UUID q6lkE0-H33z-fWX6-5l4H-Kidx-iLKf-NdZJYq

Note Free PE and then

lvcreate vg0 -l 1279 -n swap
mkswap -f /dev/mapper/vg0-swap
echo "/dev/mapper/vg0-swap none swap sw 0 0" >> /etc/fstab
swapon /dev/mapper/vg0-swap 

Check with say “free -m” to see if new swap space is now being seen by kernel.