4

I'm taking a college course on Unix, and as part of that, I am trying to use a live USB of Ubuntu on my computer. My computer runs 64-bit Windows 7. I used LinuxLive to install VirtualBox on a 16 GB flash drive. I had trouble installing 64-bit Ubuntu 15.04 using this, but was able to successfully install 32-bit 15.04. My ultimate goal: keep my Windows installation, and primarily run Ubuntu through the VM (possibly booting to it occasionally).

I've been using running the "Try Linux" option for the last couple weeks, but from what I've read, I think I can "install" Linux on my flash drive to keep my settings (and possibly make it run faster in the VM?). I found a couple walkthrough videos on YouTube, but the screens I see are a little different. After the "download updates" checkbox screen, I get a dropdown menu which asks to set the device boot loader. The only option is /dev/sda, and trying to add a different option doesn't seem to work.

I'm nearly a complete Unix n00b, and not ashamed to admit it. I get that /dev/sda is a drive, but which drive? Is it my computer's hard drive, my flash drive, or some virtual drive in the VM? If I install Ubuntu there, will it negatively impact my existing hard drive and Windows installation?

Chris
  • 43
  • 1
  • 3

2 Answers2

3

Virtual hard drives

While installing Ubuntu to a virtual machine such as Virtual Box you will have created a virtual hard drive for holding the virtualised OS and its data. For the host OS this virtual hard drive is just a file on the real hard drive but the guest operating system can use it as if it was a real drive to partition and to format it to the guest's needs. This will leave partitions and filesystem on the real drive untouched.

Windows devices

In Windows hard drives or their partitions are assigned with letters A: B: C:, ... irrespective of where that partitions reside. This is different in Unix and in Ubuntu.

Device files of Unix and Ubuntu

For each attached block devices (and also for each virtual hard drive in a VM) we will create a device file. Modern SCSI or SATA drives will be named as /dev/sd followed by a letter depending on the sequence they were registered. Hence the first registered drive's device file will be named /dev/sda, the second /dev/sdb, the third /dev/sdc, and so forth.

After we had added partitions on that drive they will consecutively be numbered /sda1, /sda2, /sda3, .... Therefore we can easily see on which hard drive a given partition sits.

Grub and the boot device

Now for installing the master boot loader (Grub) needed for booting Ubuntu we can further specify on which drive it should be installed. This only matters in case you have more than one drive attached to your computer (or your virtual machine).

In your case you likely had created only one virtual hard drive (though more are possible) which then was named /dev/sda. This drive is where you want to install Grub, and the OS.

Note that in a virtual machine this still is a virtual hard drive, not your bare metal drive where your host OS resides.

A word on dual boot

On a real computer where we may want to choose from more than one OS we may have to take care that the boot loader is really being placed onto the first bootable drive. It will replace any other (e.g. Windows) master boot record that was there before we started. Only then a dual-boot system with a choice of operating systems at boot would be possible. If for any reasons we do not want this we can tell Grub to install on another drive (or partition), if available.

Takkat
  • 142,284
0

I have a laptop that boots up into Windows 7. I often run Ubuntu inside a virtual machine on that laptop.

There are two key things that need to be downloaded and installed to get Ubuntu running inside a virtual machine:

  1. Download the Virtualbox application ".exe" installer into your Windows Downloads folder. Then install the VirtualBox application (or some other virtual machine) on the host OS -- in your and my case, we're installing "Virtualbox for Windows hosts" on a Window 7 host OS. Wikibooks: VirtualBox / Installation / Windows has more details.
  2. Download the Ubuntu ".iso" image file into your Windows Downloads folder. Then run VirtualBox, tell it to create a new virtual machine and boot that virtual machine from that ".iso" image, and inside that virtual machine install Ubuntu. Wikibooks: VirtualBox/Setting up an Ubuntu virtual machine has step-by-step instructions.

After you get Ubuntu installed and rebooted a few times, you can delete those downloaded files from your Windows Downloads folder.

I never needed a USB flash drive during the initial installation or while running Ubuntu as the guest operating system inside a virtual machine. Honestly, I have no idea what you mean by "I used LinuxLive to install VirtualBox on a 16 GB flash drive." I'm assuming there are a bunch of typos in that sentence. (I've seen people who wanted to completely erase the hard drive of some computer and install Linux on it. Making a "LiveUSB" bootable USB flash drive so they can "Try Ubuntu" is a good first step in that direction, but it sounds like that's not what you want to do). (I've seen people download the "VirtualBox for Ubuntu hosts", so they can run some other operating system inside a virtual machine on their Ubuntu host computer, but it sounds like that's not what you want to do).

Normally I see my normal Windows taskbar on the screen, and a big window with a title bar that shows the name of that virtual machine followed by "- Oracle VM VirtualBox". I run all kinds of Linux apps inside that window. Next to that big window, I see a separate little window with a title bar that shows "Oracle VM VirtualBox Manager". In that little window, I click on the name of the virtual machine, then I click on "Settings", then I click on Storage" to get the Storage Tree view. If you accepted all the defaults (such as by following the above step-by-step instructions), by default there's only one "disk" in that storage tree, and when I click on it I see that it is actually a file located in my "C:\Users\dc\VirtualBox VMs\" folder. That file is what the Ubuntu OS inside my virtual machine sees as the "/dev/sda" hard drive.

So what is /dev/sda?

When running Ubuntu, "/dev/sda" is what Ubuntu thinks is the computer's hard drive.

When I see people boot Ubuntu from their hard drive so it fills the entire screen (i.e., Ubuntu is actually running directly on the physical hardware), "/dev/sda" is the actual physical hard drive.

When I see people boot Ubuntu from a live USB flash drive so it fills the entire screen (i.e., Ubuntu is actually running directly on the physical hardware), they see both a "/dev/sda" and a "/dev/sdb". I can never remember which one is the actual physical hard drive and which one is the actual physical live USB flash drive. (Asking how you can tell one from the other would make an excellent separate question).

When Ubuntu is running inside a "...- Oracle VM VirtualBox" window, "/dev/sda" inside that window is whatever the virtual machine is using to simulate a virtual hard drive. What Ubuntu sees as "/dev/sda", when that Ubuntu is running inside a virtual machine on a Windows host, is usually a ".vdi" file in some folder on the C:\ hard drive somewhere. I hear that occasionally some people change those settings so that what Ubuntu sees as "/dev/sda", VirtualBox can remap to some physical hard drive or USB stick rather than the default ".vdi" file. You can find out exactly what that is on your system by checking the settings in the "Oracle VM VirtualBox Manager".