1

I want to have two version of Ubuntu on two separate hard drives on my computer. However, I don't want to set up a dual boot -- instead, I want to be able to switch live and on-the-fly between the two OSes.

Preferably, I would also like files to be synchronized between both instances of Ubuntu.

Is something like this even possible?

Kaz Wolfe
  • 34,122
  • 21
  • 114
  • 172
mamesaye
  • 153
  • 1
  • 6
  • 3
    I don't believe that you can accomplish this the way it sounds like you are envisioning it. You can however run multiple operating systems in Virtual Machines on the same system (even simultaneously provided you have sufficient resources) using hosting software like virtualbox – Elder Geek Mar 29 '17 at 18:19
  • 1
    Yeah, I agree with @ElderGeek. Running the install from the other drive with KVM/VirtualBox/VMware is the way to do this. You can certainly share files from one drive to another though without booting the other, it will show in File Manager. – Andrew Crouthamel Mar 29 '17 at 18:21
  • @ElderGeek You could accomplish this by using QEMU to passthrough a second GPU to a virtual machine in conjunction with a KVM switch... – You'reAGitForNotUsingGit Mar 29 '17 at 19:44
  • @AndroidDev I for one would be interested in seeing (and testing) that answer. Perhaps the OP and future readers would like more options as well. Why not write it up? – Elder Geek Mar 30 '17 at 13:22

1 Answers1

2

On two different drives? Not really. But, this technically doesn't mean it's impossible, just hard.

You seem to want something called a Virtual Machine for your testing version of Ubuntu. In short, this is a computer inside a computer, and the data can be stored (theoretically) anywhere. I would advise using a virtual machine image directly (as it can be imaged, backed up, deleted, and is a lot smaller than a full partition). However, if you really want your test OS to be installed on a real partition, you can.

Note: I will be using VirtualBox for this example. You can do this with almost any hypervisor, but I'm giving instructions with VirtualBox.

  1. Create a new VM in VirtualBox and set it up. Do not attach a hard drive to it during creation!
  2. Open a terminal and use lsblk to find the partition/disk you want to give to the VM. In my example, I will be assigning /dev/sdc to the virtual machine.
  3. Run the following command in a terminal:

    VBoxManage internalcommands createrawvmdk -filename "~/DevSDC.vmdk" -rawdisk /dev/sdc
    
  4. Move this .vmdk file from your home directory to wherever you want it to be.

  5. In VirtualBox settings, attach the .vmdk file you made to the virtual machine.
  6. Start the VM and install Ubuntu as normal.

You will be able to mount the other Ubuntu install partition from your host OS without a problem, and you can use VirtualBox's Shared Folders to copy information live. There isn't really a way you can expose your real machine's drive to the VM (and you shouldn't).

Also note that there's really no expectation that you'll actually be able to boot directly into your second hard drive/partition. While you may be able to, I'd be very impressed if it actually worked without some serious bugs/flaws.


Really, though, what you're wanting to do is pretty insane. Just use a regular virtual machine and a regular disk image file instead of jumping through the hoops. It'll be more stable and you'll be a lot less likely to accidentally break something important.

Kaz Wolfe
  • 34,122
  • 21
  • 114
  • 172