0

Using -modifyhd the storage on a vmdk was increased from 20 to 50GB. However the Centos client does not take advantage of it.

A prior question doubling virtual disk size does not change fdisk -l report does not address this directly because they had snapshots. As shown in screenshot no snapshots exist /are active in this case.

Here are details from guest-os

fdisk -l

[root@localhost ~]# fdisk -l

Disk /dev/sda: 56.3 GB, 56308531200 bytes
255 heads, 63 sectors/track, 6845 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b625d

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        2611    20458496   8e  Linux LVM

Disk /dev/mapper/VolGroup-lv_root: 14.6 GB, 14638120960 bytes
255 heads, 63 sectors/track, 1779 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/VolGroup-lv_root doesn't contain a valid partition table

Disk /dev/mapper/VolGroup-lv_swap: 6308 MB, 6308233216 bytes
255 heads, 63 sectors/track, 766 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/VolGroup-lv_swap doesn't contain a valid partition table

pvdisplay

[root@localhost ~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               VolGroup
  PV Size               19.51 GiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              4994
  Free PE               0
  Allocated PE          4994
  PV UUID               68d5TH-51cq-VbiL-D0ki-Bz9E-BZj3-DqVNRd

df -k

[root@localhost ~]# df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup-lv_root
                      14070560  12795616    560192  96% /
tmpfs                  4168992        76   4168916   1% /dev/shm
/dev/sda1               495844     54226    416018  12% /boot
/dev/sr0                 58236     58236         0 100% /media/VBOXADDITIONS_4.2.16_86992

Mounts

[root@localhost ~]# mount
/dev/mapper/VolGroup-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/sr0 on /media/VBOXADDITIONS_4.2.16_86992 type iso9660 (ro,nosuid,nodev,uhelper=udisks,uid=500,gid=500,iocharset=utf8,mode=0400,dmode=0500)

Device: disk by id

[root@localhost ~]# ll /dev/disk/by-id
total 0
drwxr-xr-x 6 root root 120 Sep 29 07:11 ..
drwxr-xr-x 2 root root 240 Sep 29 07:11 .
lrwxrwxrwx 1 root root  10 Sep 29 07:11 dm-uuid-LVM-ZNoRaHmQP5Q0vOttkofYrMdrBe1ouy9gT5SiHgxSwJJcKcK25RRTAERfIffUtgBe -> ../../dm-0
lrwxrwxrwx 1 root root  10 Sep 29 07:11 dm-name-VolGroup-lv_root -> ../../dm-0
lrwxrwxrwx 1 root root  10 Sep 29 07:11 dm-uuid-LVM-ZNoRaHmQP5Q0vOttkofYrMdrBe1ouy9gO5Nd7kMVEqxxpnSc455XW5SGmOQeoaEZ -> ../../dm-1
lrwxrwxrwx 1 root root  10 Sep 29 07:11 dm-name-VolGroup-lv_swap -> ../../dm-1
lrwxrwxrwx 1 root root   9 Sep 29 07:11 scsi-SATA_VBOX_HARDDISK_VB34dd657d-2336283c -> ../../sda
lrwxrwxrwx 1 root root   9 Sep 29 07:11 ata-VBOX_HARDDISK_VB34dd657d-2336283c -> ../../sda
lrwxrwxrwx 1 root root  10 Sep 29 07:11 scsi-SATA_VBOX_HARDDISK_VB34dd657d-2336283c-part2 -> ../../sda2
lrwxrwxrwx 1 root root  10 Sep 29 07:11 ata-VBOX_HARDDISK_VB34dd657d-2336283c-part2 -> ../../sda2
lrwxrwxrwx 1 root root  10 Sep 29 07:11 scsi-SATA_VBOX_HARDDISK_VB34dd657d-2336283c-part1 -> ../../sda1
lrwxrwxrwx 1 root root  10 Sep 29 07:11 ata-VBOX_HARDDISK_VB34dd657d-2336283c-part1 -> ../../sda1

VBox storage details

Evidence that NO snapshots exist for this vmdk

6
  • Post what you see from the guest OS.
    – Fiisch
    Sep 29, 2013 at 14:04
  • @Fiisch Added in mount, dev/disk-by-id, and df -k Sep 29, 2013 at 14:19
  • Df writes available size on the partition. You have to resize the partition to make the space usable. CentOS by default creates LVM above the disk, check output of pvdisplay if there is a free space on the disk itself.
    – Fiisch
    Sep 29, 2013 at 14:38
  • @Fiisch added output of pvdisplay. does NOT see the 50GB. Sep 29, 2013 at 19:39
  • ok, could you also post output of fdisk -l please? the space on hdd should be detected upon the pc start. also, you can try to invoke recsan manually using like: echo "- - -" > /sys/class/scsi_host/host0/scan
    – Fiisch
    Sep 29, 2013 at 19:57

3 Answers 3

1

You will have to resize the partitions from within the VM. You should use a live distro on a usb stick to do that, just like the VM were a physical machine. Put the stick in, start the VM instructing it to boot from the stick, resize the partition. The fact that you are using LVM changes nothing in this plan.

3
  • This may be required, was just hoping an easier way might be available. I do not have live USB stick. Suppose it's about an hour of work to set up but under time pressure. Sep 29, 2013 at 19:56
  • It will be required. Doing this is writing like 10 commands and waiting for them to finish. At first, however, you need tho know and see the free space on disk.
    – Fiisch
    Sep 29, 2013 at 19:58
  • Thanks. Added the fdisk -l output. AFA usb stick i will pick this up another day (deliverable..) . I have upvoted in the meantime . Sep 29, 2013 at 20:55
0

Instead of creating a liveCD USB boot, I went directly to gparted. I was able to create a new primary partition of 30GB.

Now what did not go so smoothly was getting the new partition to be recognized. gparted reported that the /dev/sda was busy. Even after reboot same thing.

But command line mkfs DID work

mkfs.ext4 /dev/sda3

Let us mount the drive:

[root@localhost ~]# mount /dev/sda3 /d -o noatime

Take a look around:

[root@localhost ~]# mount
/dev/mapper/VolGroup-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/sr0 on /media/VBOXADDITIONS_4.2.18_88780 type iso9660 (ro,nosuid,nodev,uhelper=udisks,uid=500,gid=500,iocharset=utf8,mode=0400,dmode=0500)
/dev/sda3 on /d type ext4 (rw,noatime)

To be sure let us create a small file

[root@localhost ~]# echo "gparted, mkfs, and mount successful" >> /d/foo [root@localhost ~]# cat /d/foo

gparted, mkfs, and mount successful
3
  • Good job you:) For the remark I'll just add how to incorporate new space into existing lv_root volume. You can do everything while partitions are in use. First, use pvresize /dev/sda2 to enlarge the physical volume OR personally I would just create new one by running fdisk /dev/sda, creating new 8e - linux lvm partition and the calling pvcreate on it. This using vgresize incorporated into vg_root volume group. Finally running lvextend -L+<number>G to enlarge LV and the resize2fs on the filesystem itself. Thus you gain the enlarged partition instead creating new - separated - one.
    – Fiisch
    Oct 1, 2013 at 17:44
  • @Fiisch That is v useful. I may not be able to test now, but if you would like to move your comment to an answer feel free to do so. I am absolutely not attached (and in fact do not prefer) to grant the answer to myself. Oct 1, 2013 at 18:06
  • Thanks. I'll probably do it, in time. What I've written is too vague to be a proper answer.
    – Fiisch
    Oct 1, 2013 at 18:39
0

Here are the steps to resize your VM mapped drives, without gparted, liveCD or messing with your files: https://unix.stackexchange.com/a/659099/352647

You must log in to answer this question.

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