Boot From a USB Drive in VirtualBox
- From Host "Disk Management", find out the usb device's Disk number.
- From Admin Command Prompt Windows
- cd %programfiles%\Oracle\VirtualBox
- 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. - Run Virtualbox as administrator, VirtualBox can only access raw disk devices with administrator privileges.
- Add the vmdk as existing virtual hard drive when create new VM, or from existing VM
Settings->Storage
Resizing VirtualBox VM
- halt the VM
- clone .vmdk image to .vdi image (.vmdk image cannot resize)
vboxmanage clonehd "virtualdisk.vmdk" "new-virtualdisk.vdi" --format vdi - Resize the new .vdi image (30720 = 30GB)
vboxmanage modifyhd "new-virtualdisk.vdi" --resize 30720 - (Optional) switch back to a .vmdk
VBoxManage clonehd "cloned.vdi" "resized.vmdk" --format vmdk - extend the partition using gparted .iso or use fdisk in the rescue mode
- boot to RHEL iso rescue mode
- vgscan; lvscan; lvm vgchange -a y
- fdisk -l
- lvextend -l +100%FREE /dev/mapper/rhel-root
- resize2fs /dev/mapper/rhel-root # for ext3 filesystem
fsadm resize /dev/mapper/rhel-root # or xfs_growfs /vol for xfs filesystem - reboot