0

I have a Debian Linux VM running (headless) on an Ubuntu box. I increased the size of the virtual disk with vboxmanage to 30G from its original 20G. I have tried many things, but I am still stuck with the LVM partition showing 20G.

I booted from an ISO and went into repair mode. I changed the partition table by deleting the sda2 & sda5 partitions and creating new ones with the new End sector. I can't extend the partition from here.

# df -h
Filesystem        Size  Used Avail Use% Mounted on
/dev/dm-0          19G   13G  5.5G  69% /
udev               10M     0   10M   0% /dev
tmpfs             1.6G  8.4M  1.6G   1% /run
tmpfs             4.0G     0  4.0G   0% /dev/shm
tmpfs             5.0M     0  5.0M   0% /run/lock
tmpfs             4.0G     0  4.0G   0% /sys/fs/cgroup
/dev/sda1         236M   33M  191M  15% /boot
192.168.10.177:/  8.2G  2.4G  5.4G  31% /mnt/nfs

# fdisk -l

Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 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
Disklabel type: dos
Disk identifier: 0xf5edb169

Device     Boot  Start      End  Sectors  Size Id Type
/dev/sda1  *      2048   499711   497664  243M 83 Linux
/dev/sda2       499712 62914559 62414848 29.8G  5 Extended
/dev/sda5       501760 62914559 62412800 29.8G 8e Linux LVM

Disk /dev/mapper/ArkSrvr--vg-root: 18.9 GiB, 20300431360 bytes, 39649280 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 /dev/mapper/ArkSrvr--vg-swap_1: 872 MiB, 914358272 bytes, 1785856 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


# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda5
  VG Name               ArkSrvr-vg
  PV Size               19.76 GiB / not usable 2.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              5058
  Free PE               0
  Allocated PE          5058
  PV UUID               yWin1N-w3A4-sIAR-O2q9-nqPp-ki4G-yPr7kr

# lvdisplay
  --- Logical volume ---
  LV Path                /dev/ArkSrvr-vg/root
  LV Name                root
  VG Name                ArkSrvr-vg
  LV UUID                6YHVao-5Pth-2gA7-w42j-wAW7-mc9W-sQcImK
  LV Write Access        read/write
  LV Creation host, time ArkSrvr, 2017-03-06 08:51:00 -0600
  LV Status              available
  # open                 1
  LV Size                18.91 GiB
  Current LE             4840
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:0

  --- Logical volume ---
  LV Path                /dev/ArkSrvr-vg/swap_1
  LV Name                swap_1
  VG Name                ArkSrvr-vg
  LV UUID                eElIsI-bGdy-Cuje-BacF-1zap-wzlS-ftD28h
  LV Write Access        read/write
  LV Creation host, time ArkSrvr, 2017-03-06 08:51:00 -0600
  LV Status              available
  # open                 2
  LV Size                872.00 MiB
  Current LE             218
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:1

# lvextend -L+10G /dev/ArkSrvr-vg/root
  Insufficient free space: 2560 extents needed, but only 0 available

# lvextend -l+100%FREE /dev/ArkSrvr-vg/root
  New size (4840 extents) matches existing size (4840 extents)
  Run `lvextend --help' for more information.

# resize2fs /dev/ArkSrvr-vg/root
resize2fs 1.42.12 (29-Aug-2014)
The filesystem is already 4956160 (4k) blocks long.  Nothing to do!

How do I get /dev/ArkSrvr-vg/root to increase to the 30G?

5

You missed a step.

What you have is a filesystem inside a logical volume inside a (set of 1) physical volume(s) inside a partition.

You have already extended the partition. The next step is to extend the physical volume:

pvresize /dev/sda5

You don't have to specify a size here: without size parameters, the PV will automatically take the maximum size allowed by the enclosing container, which in this case is the partition.

If this is successful, the pvdisplay command should show the Total PE increased, and Free PE no longer 0. So you'll have some free physical extents you'll be able to put to use.

The next step is to extend the logical volume and then the filesystem. Looks like you already know how to do that.

| improve this answer | |
  • Great explanation of terminology! – maliayas May 25 '19 at 20:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.