Showing posts with label virtualbox. Show all posts
Showing posts with label virtualbox. Show all posts

Tuesday, August 11, 2015

Resize LVM Partition in Virtual Box


Here's a note on how to resize LVM partition in VirtualBox
1. VBoxManage modifyhd vdi_path --resize new_size_in_mb
2. Resize the disk.
    a. Run the VM
    b. Open terminal/console and execute command below
        + df
           Write down the logical mapping, in my case it is /dev/mapper/vg_iplus-lv_root
     
     
        + fdisk -l
           Write down the Device name, in my case /dev/sda2
     
 + fdisk /dev/sda
     The next steps will delete the partition to resize, recreate the partition and make it primary. Then resize the partition to the new size and write the changes.
 + Still in fdisk, delete the partition
     input: d
 + Still in fdisk, select the device to partition number. In my case it is 2 (/dev/sda2)
     input: 2
   

  + Still in fdisk, create new partition and select the same partition as in previous steps (e.g. 2)
     Input: n
     Input: 2


  + Set the size for the new partition, set it to occupy all available space (or as preferred)
      Input: enter (twice to set default size)


  + Commit the changes
     Input: w

   + Reboot server
      Command: reboot

   + Resize the physical volume
      Command: pvresize /dev/sda2
     /dev/sda2 refers to the partition changed previously

   + Verify the new size, make sure the new size is applied
       Command: pvscan

   + Extend the logical volume to take all free space
      Command: lvextend -l +100%FREE /dev/mapper/fedora-root

   + Resize the file system
      Command: resize2fs /dev/mapper/vg_iplus-lv_root

   + Verify the new changes
      Command: df

And we're done! :)


Reference:
https://blog.jyore.com/2013/06/virtualbox-increase-size-of-rhelfedoracentosscientificos-guest-file-system/

Friday, April 27, 2012

VirtualBox misc

A note for myself on my dealings with VirtualBox, refer to this link for complete command:
  • Changing the virtual harddisk UUID (.vdi)
    VBoxManage internalcommands sethduuid /VirtualMachine/virtualmachine.vdi
  • Resizing the virtual harddisk
    VBoxManage modifyhd virtualmachine.vdi --resize SIZE_MB
  • Disable time synchronization
    VBoxManage setextradata LHBU "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" "1"   
          You need to restart your vbox instance if it is running when you execute the command.
          Unrecommended workaround is:
          Guest Windows: go to Services, find VirtualBox Guest Additions service and stop it. You will find that time synch is no longer working, but I'm not sure whether other functionalities regarding virtual box - host integration are affected or no.
          Guest Linux:  /etc/init.d/vboxadd-timesync stop
          Disclaimer! Never tried the linux version, found it during googling.