Boot vagrant box on an external drive (usb) with virtual box - macos

I have Virtual box and a customized vagrant box. The thing is that my own laptop (Macbook) has only about 10 Gb of free space. So I bought a 128Gb USB Stick. Now I need to figure out a way to boot up vagrant boxes on this usb stick instead of the default hard drive of my laptop.
Almost all google articles explain how to boot up from the usb. But this is not what I exactly want. Have you ever been through such a situation?
any help would be appreciated!

you can do 3 things :
move your vagrant home directory with all the box on the USB stick (if you have many boxes, it will save some space)
you need to set $VAGRANT_HOME environment variable
move your VirtualBox VM to the USB stick; Open VirtualBox preferences panel and select the new default location folder for VMs. You would need to remove/re-add the VMs in VirtualBox after you moved all files to the external hard drive
You can use Linked Clones
By default new machines are created by importing the base box. For large boxes this produces a large overhead in terms of time (the import operation) and space (the new machine contains a copy of the base box's image). Using linked clones can drastically reduce this overhead.
Linked clones are based on a master VM, which is generated by importing the base box only once the first time it is required. For the linked clones only differencing disk images are created where the parent disk image belongs to the master VM.
It will not help for existing vagrant VM but for your new project, it will help to save space

Related

How to access files stored in Virtual Machine from Host

I have a Mac OS X (10.11) virtual machine. But it has stopped working. It just about finishes loading the virtual machine and then just freezes on a black screen. Anyway, I wanna know if there is a way for me to recover the files on that virtual machine (Specifically Xcode files). They were not part of the shared folders so I'm not sure how to access them from the host (which is a windows 10).
One way to do this is to do the following:
Create another virtual machine with Ubuntu
Attached the virtual disk image (.vdi) or whichever format you chose to store the OSX image as a second HDD to the Ubuntu VM.
Follow these instructions to enable HFS+ read write in the Ubuntu virual image.
Another way to do it would be to use something like Arsenal Image mounter which supports direct mounting of a bunch of virtual image formats including VDI, VHD etc.

where does VirtualBox create partitions on mac for fedora installation?

I have downloaded the fedora iso image and trying to install it using virtual box on my mac. I dedicated a space of 40GB for my hard drive. Now I get this pop up message, I am worried if it will delete my data on hard-drive. I have enough free-space left on my hard-drive. but I don't want this partion to erase my exisiting data.
where is the partition created on file system.(ATA VBOX HARDDISK). Here is the screenshot:
Creating a virtual hard-disk in the host operating system (In virtualBox) will not overwrite any files on your hard drive. It will only utilize unused space on your disk. Overwriting the hard-disk in the guest operating system will not delete any files in the host, but it will overwrite/wipe files in the virtual hard disk (guest OS files).

Cant boot VHD created by Disk2VHD

I first created system images using Windows backup then realized that those VHD files cannot be booted using Virtual PC.
So I found the utility Disk2VHD and spent a few hours making a new VHD and tried booting it with Virtual PC but it too cannot boot.
It is giving the error:
PXE-E53: no boot filename received
I followed some instructions found online on going into the Virtual PC settings and ensuring I have the right vhd set up which I do, I also have integration features unavailable.
I then went into the Virtual PC's BIOS and in The Boot menu and it says under Hard Disk Drives [Virtual HD] and in the boot priorities the 1st boot device is the Hard Drive.
This VHD is created from my C: which is my main Windows install (Windows 7 Pro 64-bit)
The whole goal of this is I want to format my drive and install new Windows but I wanted to be able to make a bootable image I could go into later to recover things as needed and see how stuff was setup if I forgot.
When you converted it over, did you check in the checkbox which allows the file to be used in Virtual PC? I forget what it's called but in there is a checkbox you have to click in before you convert it over.
Also make sure the drive isn't bigger than 127GB or Virtual PC won't recognize it.

Boot a native OS on a hard disk as a virtual machine

I'm searching for a solution to boot a native OS on a hard disk as a virtual machine.
It's like what VMware Fusion did on a Mac which boots Windows in Boot Camp as a virtual machine.
In detail, I have Windows installed on /dev/sda2 and Ubuntu 11.10 on /dev/sda5.
Is there anyway to use a virtual machine software to boot the Windows on /dev/sda2 as a virtual machine while I'm using Ubuntu?
Yes, I did this long ago following this guide:
https://lists.ubuntu.com/archives/ubuntu-us-nm/2008-February/000521.html
of course, always backup and be careful!
Essentially:
Used a USB 3.5 HD enclosure and connect the XP drive to it.
If the drive was shutdown uncleanly you may need to manually
mount it with the following command.
sudo mount ntfs-3g /dev/whereyourdriveis /mount/somemountpoint -o
force
Once the drive is mounted under linux contiunue to step 2.
Launch VMWare.
Go to File -> New -> New Virtual Machine.
Select "Custom"
Select Next
Select your operating system (i.e. Win XP)
Select Next
Give it a name like "WindowsXP"
Select Next
Specify processor One or Two
Select Next
Choose public or private (on a single-user machine this doesn't
matter)
Select Next
Select the memory to devote to the virtual machine. 512 MB is a
pretty useful number.
Select your network connection
Select Next.
Leave SCSI set to BusLogic
Select Next
Select Use Physical Disk
Select Next
Select Use Entire Drive
Select Next
Specify the place to save the VM
At this point you're done Select Power On to boot the Physical drive
in VMWare!
More Info: I should add, I have successfully done this, but I also had success using this method years even years before. So there are at least two known and tested ways for accomplishing this that I can tell you.
You can do this via VirtualBox raw disk access.
(http://www.virtualbox.org/manual/ch09.html)
It basically creates a "virtual" disk file that points to the actual partition and loads it as a disk drive in the VM. I've installed Linux guest in VB on Windows host in such a way, and the installation can boot from the VM or by itself.
As answered, this also can be done in VirtualBox, this is the way that works for me
Always, make sure that you are running as Administrator(Windows) or Sudo(Linux), any changes that you do will write to the REAL disk, so be carefull
In Windows
C:\Program Files\Oracle\VirtualBox>VBoxManage.exe internalcommands createrawvmdk -filename "E:\virtualbox\linuxhd.vmdk" -rawdisk "\\.\PhysicalDrive1"
RAW host disk access VMDK file E:\virtualbox\linuxhd.vmdk created successfully.
In Linux
$ VBoxManage internalcommands createrawvmdk -filename "~/linuxhd.vmdk" -rawdisk "/dev/sda"
It will create a file with something around 1kb that is a link to the physical hard drive.
Then create a Virtual Machine as ever you do.
If you want to map only a partition
At Windows
\\.\Physicaldrive1 -partitions 1
(Disk start with 0, partitions
with 1)
At Linux (Much more intuitive)
/dev/sda1
/dev/sda2
etc.
Eventually you can get resolution issues
Eventually you can get resolution issues even after install vboxadditions, in my experience the problem is your /etc/X11/xorg.conf it is configured to your specific real hardware specs(I have a offboard GPU for example), least in my case I solve it simply removing this file (xorg auto configure at boot, only will not work if you set some specific setting), so run:
sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.original && sudo rm /etc/X11/xorg.conf
Reference
http://www.virtualbox.org/manual/ch09.html#rawdisk
https://forums.virtualbox.org/viewtopic.php?f=6&t=36694
https://romaimperator.com/?p=29

How to convert Cloudera Hadoop "vbox" VMDK to VirtualBox VDI

Hi guys : I am trying to run the Cloudera Hadoop VM in Virtual box.
First, I noted that the download is a .vmdk file. Of course, this suffix is for VMWare, so that was a bit odd.
Luckily, I found a tutorial on how to convert the cloudera vmdk into a virtual box file here : http://www.ubuntugeek.com/howto-convert-vmware-image-to-virtualbox-image.html. However, when I tried to convert the vmdk file to a virtual box file by using convertdd, and ultimately got a message that "Failed to write to disk image "cdh.vdi" VERR_DISK_FULL"
So my question is , how do you run the Cloudera Hadoop VM in vbox ? I found a site http://www.facebook.com/note.php?note_id=108313592002 here, but it does not appear to work (this site suggests loading the VMDK image as a new hard disk, but "new" hard disks are not enabled in my fresh virtual box install). I only get "remove" and "refresh" options in my VBox disk manager.
OUTPUT FROM VBOX CONVERTING TO CDH
~/Development$ VBoxManage convertdd /tmp/vh.bin cdh.vdi
Converting from raw image file="/tmp/vh.bin" to file="cdh.vdi"...
Creating dynamic image with size 5475663872 bytes (5222MB)...
VBoxManage: error: Failed to write to disk image "cdh.vdi": VERR_DISK_FULL
:~/Development$ ls
VBox supports VMDK since v2.0 AFAIR.
VBox UI of Virtual Media Manager changed in 4.0 version, so there is no direct option of adding hard disk in Virtual Media Manager (there used to be one -- strange decision in my opinion).
Although, you can create a new virtual machine in Virtualbox, and in the stage of choosing disk, choose existing one (VMDK) so you don't need to convert VMDK to VDI (there is a dropdown, but besides, also a button to choose a hard disk file not listed yet in Virtual Media Manager.
Here is a guide from Cloudera themselves: http://www.cloudera.com/blog/2009/07/cloudera-training-vm-virtualbox/
I created a new VM using Red Hat 64b. Chose existing drive and opened the vmdk file. Gave it 2G Ram and it started up fine.

Resources