Thursday, December 8, 2016

virtualbox

Boot From a USB Drive in VirtualBox

  1. From Host "Disk Management", find out the usb device's Disk number.
  2. From Admin Command Prompt Windows
    1. cd %programfiles%\Oracle\VirtualBox
    2. VBoxManage internalcommands createrawvmdk -filename C:\usb.vmdk -rawdisk \\.\PhysicalDrive#
      Replacing # with the number of the disk you found in step 1. Replace C:\usb.vmdk with any file path you want. This command creates a virtual machine disk (VMDK) file that points to the physical drive you select. When you load the VMDK file as a drive in VirtualBox, VirtualBox will actually access the physical device.
  3. Run Virtualbox as administrator, VirtualBox can only access raw disk devices with administrator privileges.
  4. Add the vmdk as existing virtual hard drive when create new VM, or from existing VM Settings->Storage

Resizing VirtualBox VM
  1. halt the VM
  2. clone .vmdk image to .vdi image (.vmdk image cannot resize)
    vboxmanage clonehd "virtualdisk.vmdk" "new-virtualdisk.vdi" --format vdi
  3. Resize the new .vdi image (30720 = 30GB)
    vboxmanage modifyhd "new-virtualdisk.vdi" --resize 30720
  4. (Optional) switch back to a .vmdk
    VBoxManage clonehd "cloned.vdi" "resized.vmdk" --format vmdk
  5. extend the partition using gparted .iso or use fdisk in the rescue mode
  6. boot to RHEL iso rescue mode
  7. vgscan; lvscan; lvm vgchange -a y
  8. fdisk -l
  9. lvextend -l +100%FREE /dev/mapper/rhel-root
  10. resize2fs /dev/mapper/rhel-root # for ext3 filesystem
    fsadm resize /dev/mapper/rhel-root # or xfs_growfs /vol for xfs filesystem
  11. reboot


1 comment:


  1. Awesome post presented by you..your writing style is fabulous and keep update with your blogs
    AWS Online Training

    ReplyDelete