0

I don't know too much about hardware or operating systems... I have a 5TB removable hard drive and want to install Linux on this removable hard drive through VirtualBox. When installing VirtualBox, I set the path to my hard drive, but this won't make VirtualBox to install virtual machines on that hard drive. Instead, when I tried to create a virtual machine, it will still use my local machine's RAM and the virtual machine will still be created locally...

I have also checked many online tutorial, such as how to reboot VirtualBox to hard drive, many tutorials were showing to change settings about storage or USB. I tried but all failed. The virtual machine is still installed on my local machine and uses my local resources, or the created virtual machine failed to open.

My question is, is there any way to install a virtual machine on removable drive where I can install Linux and they all use the memory of my hard drive? Even if not to use virtualbox but something else will be good. I'm using Windows 10.

1

Yes, VirtualBox will use your system's RAM for speed. Hard drives and SSDs don't really have RAM available for you to use and using the hard drive storage as if it were RAM is much, much slower than using your system's RAM.

If you want to, you can add to the actual RAM in your computer by buying some and installing it, though get some help from a knowledgeable person so that you get the right kind of RAM, so that it ends up adding up to a larger amount of usable RAM, and so that it's installed correctly.

As far as storing the virtual machine and its virtual hard drive on your external hard drive, it takes a bit of time to set up and then it's easy to use. If you encounter problems, please let me know in the comments to this answer.

Creating a diskless virtual machine

  1. Using Windows, erase everything on the external disk by formatting it normally with exFAT or NTFS or something like that that Windows (not Linux but Windows) can read.
  2. In VirtualBox, create a new virtual machine without creating a virtual hard drive.
  3. In VirtualBox, right click on your virtual machine and select Settings….
  4. Configure the new virtual machine, except for the virtual hard drive.
  5. Click OK to save the configuration.

Now we have an otherwise-configured diskless virtual machine to work with.

Moving the diskless virtual machine to your external hard drive

  1. Quit all running VirtualBox virtual machines.
  2. Quit VirtualBox itself.
  3. Open %HOMEDRIVE%%HOMEPATH%\VirtualBox VMs (usually C:\Users\username\VirtualBox VMs).
  4. Move the folder for the virtual machine you just created to your external hard drive.
  5. Defragment the external hard drive, which shouldn't take long as there are only a few small files on it.
  6. Find out how much free space still remains on your external hard drive in megabytes. Subtract 256 megabytes or so. This is how big your virtual hard drive should be if you aren't putting anything else on the external hard drive.
  7. Start VirtualBox.
  8. In VirtualBox (not the external hard drive), remove the virtual machine you just created by selecting it, opening the Machine menu, and choosing Remove….
  9. Add the virtual machine that's on your external hard drive by opening the Machine menu and choosing Add…. Open the .vbox file in the folder you moved to your external hard drive.

Now VirtualBox knows about your diskless virtual machine and it's stored on your external hard drive.

Creating a virtual hard drive on your external hard drive

  1. Quit all running VirtualBox virtual machines.
  2. Quit VirtualBox itself.
  3. Open a Windows command prompt.
  4. Replacing the parts in square brackets, run (all one line):

    VBoxManage createhd --filename "[External drive letter]:\[Virtual machine name]\[Virtual machine name].vdi" --size [size from earlier] --format VDI --variant Fixed

    For example, if your external hard drive is drive E and the virtual machine name is Ubuntu 18.04 and the remaining space we found above minus 256 megabytes (or, optionally, the space you want to use for the virtual hard drive) is 4,800,000 megabytes, you would run (all one line):

    VBoxManage createhd --filename "E:\Ubuntu 18.04\Ubuntu 18.04.vdi" --size 4800000 --format VDI --variant Fixed

  5. Close the command prompt.

Now there's a virtual hard drive on your external hard drive ready for attachment to your virtual machine.

Attaching the virtual hard drive to the virtual machine

  1. In VirtualBox, right click on your virtual machine and select Settings….
  2. Click on Storage on the left.
  3. On the right should be a SATA controller. Click on it.
  4. Click on the add hard disk icon that appears to the right of the SATA controller.
  5. Click on Choose existing disk.
  6. Choose the .vdi file in the virtual machine folder on your external hard drive.
  7. Click OK in the main settings window to accept the new settings.

Now your virtual machine is ready for the Ubuntu .iso file to be inserted into its virtual DVD drive.

Starting an installation of Ubuntu

  1. In VirtualBox, right click on your virtual machine and select Settings….
  2. Click on Storage on the left.
  3. On the right should be an IDE controller. Click on it.
  4. If there isn't an empty DVD drive just under the IDE controller, click on the add DVD drive icon that appears, and choose Leave empty.
  5. Click on the empty DVD drive just under the IDE controller.
  6. On the far right of the settings window, click on the DVD icon.
  7. Choose your desired Ubuntu installer .iso file.
  8. Click OK in the main settings window to accept the new settings.
  9. Start the virtual machine.

When installing, make sure to use the whole (virtual) hard drive for Ubuntu.

Note that if VirtualBox starts up with your external hard drive disconnected, it won't be able to find your virtual machine because it's not accessible from your machine any more. That's not anything to worry about. If you want to use a different virtual machine, just go ahead.

If you want to use the virtual machine on your external hard drive, click on the virtual machine on the left of the VirtualBox window and you'll notice a Refresh button on the right. Attach the external hard drive to your computer, wait a few seconds, and click that Refresh button.

  • Amazing! It works, I finally installed Linux on my removable hard drive and it works! Thank you very much!! – Cherry Wu Oct 8 '18 at 14:55
  • One minor thing to add, if you don't have VBoxManage set at path, you can follow the instruction here: build-business-websites.co.uk/add-vboxmanage-to-path, so that you can run above VBoxManage command. – Cherry Wu Oct 8 '18 at 14:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.