Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am running VMWare ESXi with multiple virtual machines. One of which is running Debian 6.0.6 Squeeze (x86_64) and had a thin provisioned hard disk of 16GB. This has now become full, so I expanded the provisioned space to 20GB.

I went into the root console to expand the LVM to fill out the new space, but Debian hasn't noticed there is more space available -- even after a virtual machine reboot. fdisk has noticed a bigger hard disk to use, though lvresize will not.

The obligatory information:


df -H
Filesystem             Size   Used  Avail Use% Mounted on
/dev/mapper/hlds--ls-root 16G    16G   6.8M 100% /
tmpfs                  1.1G      0   1.1G   0% /lib/init/rw
udev                   1.1G   103k   1.1G   1% /dev
tmpfs                  1.1G      0   1.1G   0% /dev/shm
/dev/sda1              239M    17M   210M   8% /boot

fdisk -u -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 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: 0x000c1f94

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      499711      248832   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2          501758    33552383    16525313    5  Extended
/dev/sda5          501760    33552383    16525312   8e  Linux LVM

Disk /dev/dm-0: 16.2 GB, 16177430528 bytes
255 heads, 63 sectors/track, 1966 cylinders, total 31596544 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/dm-0 doesn't contain a valid partition table

Disk /dev/dm-1: 742 MB, 742391808 bytes
255 heads, 63 sectors/track, 90 cylinders, total 1449984 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/dm-1 doesn't contain a valid partition table

Not entirely sure why dm-0/dm-1 are there. This is a single disk system, though does still have the Debian 6.0.6 DVD mounted (4GB).

I see that I would need to expand /dev/sda2 first, then /dev/sda5. I am assuming though if lvresize can't spot free space safely, then using fdisk to delete/re-create the partitions would not be a good idea either.


pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda5
  VG Name               hlds-ls
  PV Size               15.76 GiB / not usable 2.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              4034
  Free PE               0
  Allocated PE          4034
  PV UUID               yUJaSH-2igx-6Yzt-0vba-Rg5b-3BSq-XfouDV

lvdisplay /dev/hlds-ls/root
  --- Logical volume ---
  LV Name                /dev/hlds-ls/root
  VG Name                hlds-ls
  LV UUID                svgWMF-kuUz-9Ip1-WGWc-cbkU-dy2m-QKfddW
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                15.07 GiB
  Current LE             3857
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:0

vgdisplay hlds-ls
  --- Volume group ---
  VG Name               hlds-ls
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               15.76 GiB
  PE Size               4.00 MiB
  Total PE              4034
  Alloc PE / Size       4034 / 15.76 GiB
  Free  PE / Size       0 / 0
  VG UUID               1KS0Br-quDG-5vxV-LYz3-ZTsS-2dmo-0micLM
share|improve this question
up vote 1 down vote accepted

You need to expand physical volume with pvresize and after that expand the logical volume using lvresize (or create new logical volume in that space).

share|improve this answer
    
pvresize claims there is no more space to use – Adambean Feb 27 '13 at 13:35
    
Sorted it: turns out I had to delete the extended partition in fdisk, make that bigger, then make a new logical partition with the exact same starting boundary. Then pvresize then lvresize recognized the new capacity. I don't think I should have used LVM in the first place tbh. – Adambean Feb 28 '13 at 8:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .