1

I've inherited a VM image so not 100% sure how initial disks were set up.

I've attempted to extend my image by 10Gb following some basic instructions & adding a partition but can't seem to commit the final change for re-size using resize2fs or xfs_growfs to get this space.

There wasn't an initial Volume group.

Pretty much followed this thread set:

https://ma.ttias.be/increase-a-vmware-disk-size-vmdk-formatted-as-linux-lvm-without-rebooting/

https://ma.ttias.be/increase-expand-xfs-filesystem-in-red-hat-rhel-7-cento7/

I'm probably missing something - help appreciated! - extracts listed:

>resize2fs /dev/VolGroup1/lv1

resize2fs: Bad magic number in super-block while trying to open    /dev/VolGroup1/lv1
Couldn't find valid filesystem superblock.

>fdisk -l

Disk /dev/sda: 32.2 GB, 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
Disk label type: dos
Disk identifier: 0x0009cd2b

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      616447      307200   83  Linux
/dev/sda2          616448     4810751     2097152   82  Linux swap / Solaris
/dev/sda3         4810752    41943039    18566144   83  Linux
/dev/sda4        41943040    62914559    10485760   8e  Linux LVM

Disk /dev/mapper/docker-8:3-101670494-pool: 107.4 GB, 107374182400 bytes,             209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 65536 bytes / 65536 bytes

Disk /dev/mapper/VolGroup1-lv1: 10.7 GB, 10733223936 bytes, 20963328 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/sda4
  VG Name               VolGroup1
  PV Size               10.00 GiB / not usable 4.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              2559
  Free PE               0
  Allocated PE          2559
  PV UUID               cKHlxe-rqVT-XsnU-Brlv-yV6t-JhYJ-u48YGx


> vgdisplay

--- Volume group ---
  VG Name               VolGroup1
  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               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               10.00 GiB
  PE Size               4.00 MiB
  Total PE              2559
  Alloc PE / Size       2559 / 10.00 GiB
  Free  PE / Size       0 / 0   
  VG UUID               q4ntG1-r2Mf-Bvme-2djz-g42f-8J4s-eyB2Sd


> lvdisplay

 --- Logical volume ---
   LV Path                /dev/VolGroup1/lv1
   LV Name                lv1
   VG Name                VolGroup1
   LV UUID                qslLy5-C7vv-DSMR-m9Lr-zHFB-8IXf-g51jch
   LV Write Access        read/write
   LV Creation host, time localhost.localdomain, 2015-12-05 09:51:18 -0800
   LV Status              available
   # open                 0
   LV Size                10.00 GiB
   Current LE             2559
   Segments               1
   Allocation             inherit
   Read ahead sectors     auto
   - currently set to     8192
   Block device           253:1

> df -k
Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/sda3       18555904 18098240    457664  98% /
devtmpfs         1788224        0   1788224   0% /dev
tmpfs            1797156      148   1797008   1% /dev/shm
tmpfs            1797156     9092   1788064   1% /run
tmpfs            1797156        0   1797156   0% /sys/fs/cgroup
/dev/sda1         303788   154352    149436  51% /boot
/dev/sr0           54532    54532         0 100% /run/media/centos/CDROM
  • resize2fs is for extending ext partitions. You have LVM specific commands, including the possibility to add another partition to the volume. Nevertheless some reorganisation will be necessary as the primary partitions seem to be all exhausted. If the we are talking about 20-40GB, it might be easier to create a new VM and transfer by netcat+tar, rsync or backups the contents of this VM to other with a more carefully layout filesystem plan and then modify the fstab accordingly. – Rui F Ribeiro Dec 5 '15 at 23:32
  • I forgot to show the df -k initially, not sure if it assists. The 20GB space I initially created is virtually exhausted. Thanks for your suggestion - is there a reference or step by step on how to do the above? \ – N Piper Dec 6 '15 at 0:37
  • I usually do it as a pretty manual process without following a particular guide. If you also organize things properly in VMs the point of using LVM is moot, if you do not use LVM snapshots to work as you can grow the virtual disks anytime. I usually setup everything on a new server when I am having your kind of problems, stop all the processes in the source, and do a tar -cvf - | nc xxxx 4000 in the source side, and nc -l -p 4000 | tar -xvf in the dest side, stop the original, and then I modify the fstab and do a grub-update/grub-install, reboot and presto. – Rui F Ribeiro Dec 6 '15 at 1:04
  • To deal with LVM, the easiest way would be to create a new disk and do a vgextend with a new partition, but you seem to have exhausted that avenue with 4 root primary partitions. It is possible to grow LVM, with pvresize not so easy serverfault.com/questions/378086/… – Rui F Ribeiro Dec 6 '15 at 1:13
  • Nonsense. You can not add more partition in the actual disk, however you can create a new disk, and add new partition to your LVM group – Rui F Ribeiro Dec 6 '15 at 1:53

Your Answer

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

Browse other questions tagged or ask your own question.