Skip to content

expand

Expanding & Resizing an LVS Partition / Group on Ubuntu 14.04 LTS

I have a server dedicated to the purpose of hosting an ownCloud instance. OwnCloud 8 to be exact. It’s an Ubuntu 14.04 LTS virtual machine, on an ESXi 5 hypervisor. This is my own server, and not any sort of revenue generating customer service. It has become a “Dropbox” replacement for myself, and a few select friends and family. Recently, I found the original 1TB I allocated to be filling up quickly. So, I started doing some google searches to see how I could go about resizing, or expanding, an LVM group (like a partition). I found an enormous wealth of information, much of it conflicting. As I started going through a guide, that closely matched my configuration (everything was the same, actually, except the size of the disk), I instantly faced problems with commands not working. It was frustrating. Eventually I navigated through it and successfully expanded the Logical Volume. I figured I would go ahead and document my troubles so that I can make others lives a little easier.

Firstly, you need to run a couple commands to see what you’re working with. These commands are df and fdisk -l. You should see something like this:

[email protected]:~$ df
Filesystem                  1K-blocks     Used Available Use% Mounted on
/dev/mapper/cloud--vg-root 1048254140 65112056 929870740   7% /
none                                4        0         4   0% /sys/fs/cgroup
udev                          4077252        4   4077248   1% /dev
tmpfs                          817700      524    817176   1% /run
none                             5120        0      5120   0% /run/lock
none                          4088496        0   4088496   0% /run/shm
none                           102400        0    102400   0% /run/user
/dev/sda1                      240972    67164    161367  30% /boot


[email protected]:~$ sudo fdisk -l
[sudo] password for mike:

Disk /dev/sda: 1099.5 GB, 1099511627776 bytes
255 heads, 63 sectors/track, 133674 cylinders, total 2147483648 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c9595

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      499711      248832   83  Linux
/dev/sda2          501758  2147481599  1073489921    5  Extended
/dev/sda5          501760  2147481599  1073489920   8e  Linux LVM

Disk /dev/mapper/cloud--vg-root: 1090.7 GB, 1090661646336 bytes
255 heads, 63 sectors/track, 132598 cylinders, total 2130198528 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/cloud--vg-root doesn't contain a valid partition table

Disk /dev/mapper/cloud--vg-swap_1: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders, total 16777216 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Click here to see the entire post!!