Howto: vmware resize disk (lvm/ext4)

Very short version:

  1. echo 1 > /sys/class/scsi_disk/2\:0\:0\:0/device/rescan
  2. Resize disk in vmware
  3. fdisk /dev/sda2
  4. p, d, 2, n, p, 2 , 258, t, 2, 8e, w
  5. reboot/rescan
  6. pvresize /dev/sda2
  7. lvextend -l +100%FREE /dev/mapper/VG-lv_data
  8. df -h && echo “Be happy”

Using parted:

  1. resize disk, reboot
  2. parted, p (should give larger disk,ย  remember partition start for lvm part)
  3. u s (set units to sectors)
  4. rm 2
  5. mkpart, primary, ext2, start sectors same as before, end a fewย  sectors less thatn disk size
  6. p, verify start is still correct
  7. toggle 2 lvm
  8. u gb, p ( see a larger lvm part)
  9. reboot for partition table change, this will also tell you if you did resizing correctly ;) . Just hope it comes back haha.
  10. pvresize /dev/sda2
  11. vgdisplay | grep Free

In short:ย  extend+reboot; parted;u s;p;rm 2; mkpart; primary; enter; START; END; toggle 2 lvm; reboot; pvresize /dev/sda2; vgdisplay|grep Free

Then making new lv’s:

  1. lvcreate -n lv_tmp VG
  2. mkfs.ext4 /dev/mapper/VG-lv_tmp
  3. echo ‘/dev/mapper/VG-lv_tmp /tmp ext4 defaults 1 2’ >> /etc/fstab
  4. mount -a
  5. reboot maybe
  6. Transfer stuff ( yum clean all ; find /var/tmp/yum* -delete )