1

So on my Laptop I dual boot Arch Linux and Open BSD 6.9.

What I want to do is to within Arch Linux be able to boot my Open BSD partition using Virtal Box, use the BSD operating system normally in the virtual environment, and then have any changes made during my Virtual Box session to be saved to my disk partition for Open BSD.

So in effect when I actually physically boot into the Open BSD Partition all my 'Virtual Changes' are reflected.


I understand it is possible to do the booting part as described here: Use VirtualBox to boot a physical drive/partition

but at least as far as I can tell the changes are not saved to the physical disk, but instead to a .vmdk.

I have also read this answer: Moving an OS from a virtual box to the hard disk

that seems to suggest that one can make a conversion from a virtal image to a physical one.

A potential solution might be making some bash scripts that perform all this, but before I go down that route I would like to see if there is an integrated solution in Virtal Box proper.


My question is this possible and if so is it adviable? I imagine corrupting data is a big concern, and there are certain things like mounting the host disk parition in virtual environment which are a big no-no.

  • So.. this is not an answer to your question.. but why do you care if the boot of the virtual system is physical hardware or not? Whats the point in using virtualBox (which I am a big fan) if you intend on using the actual physical drives as your boot source? – Señor CMasMas Jun 28 '21 at 04:44
  • I can understand why you might wonder what is the point. For me I enjoy using Arch Linux as my daily driver. Its setup the way I like and it works. However, I am working on learning how to use Open BSD because I want to seriously get into development for it and use it for specific applications. Right now when I have down time I boot into Open BSD and hack around. But the process of rebooting while not exteremely laboroius is still not ideal. It would be cool if I could just quickly boot into Open BSD play around a bit and be able to close it again without ever leaving linux land. – CoderChristopher Jun 28 '21 at 16:04
  • In the long run I would like to move to Open BSD as my primary OS, so that is why I have it install on physical hardware. Also using it 'on the metal' is a better experience so I like having it around when I am more seriously working on it. So that is why I am trying to make physical solution work rather than just sticking with a pure virtualization. – CoderChristopher Jun 28 '21 at 16:06
  • You would be amazed to know how seamless it is to run a virtual machine these days. You will not know the difference once you full screen your virtual machine running inside of a vmdk. Sorry.. I don't know how to solve your problem.. but I do suggest it isn't a problem if you follow my advice. :) – Señor CMasMas Jun 29 '21 at 21:33
  • @SeñorCMasMas haha, fair enough. TBH virtual environments are not my primary technolgical domain (in case it was not obvious, lol) so if what I am asking seems obtuse and backwards... well it probably is. Judging by the fact I have not gotten a response yet suggests perhaps I am asking the wrong question. I mean if I don't get nor find a satisfactory response on it I will probably just suck it up and go with your suggestion. :) – CoderChristopher Jun 30 '21 at 02:18

1 Answers1

1

The answer that you need to follow wrt to VirtualBox being able to use physical disk partition is this one. I suggest you read manual for VirtualBox, chapter 9.7.1.2. Access to Individual Physical Hard Disk Partitions before following that answer.

If you correctly understand that chapter and execute the commands in accordance with your case, you should be able to access and modify whole harddisk or a specific partiton (-relative flag) with ease. I can tell you whatever you would do in the assigned physical partition from within the VirtualBox would make permanent changes. They are not temporary or in memory! I had installed my Arch Linux in a real partition by assigning the target physical partition to Virtualbox using relative flag so as to prevent myself from accidentally deleting or modifying partition table or other partitions when installing Arch Linux.

That said, I don't suggest you do such a thing at all. If your intention is to learn an OS, don't bother accessing physical partition through VirtualBox. Just take backup of your Open BSD files and save them in a virtual hard disk that you can use easily in VirtualBox. When you feel like committing fully to only using Open BSD on a physical partition then move the files from virtual hard drive back to the partition of your choice (you would have to reconfigure the bootloader though -- shouldn't be a problem).

This approach prevents you making silly mistakes with Virtualbox commands that can corrupt your partitions.

Firelord
  • 366
  • 1
  • 13
  • 1
    Thank you! I apperciate the straight forward answer and documentation reference so that I can do my own research. Though this is 'dangerous and ill advised' you still gave me the answer I was asking for first. I think I will go with your suggested answer, but having the 'real answer' is useful for my background knowledge and will likely help future persons who might need to employ the 'dangerous solution'. Also the details you provide/reference tell why it is dangerous rather just a non-useful answer of 'its a box full of snakes'. Overall, well played. – CoderChristopher Jul 07 '21 at 15:50
  • (sorry for the weird explicit style, I apperciate your answer, but also I am writing for the sake of others to understand why I think this is the correct way to answer questions of this nature to hopefully encourage others to answer in this style.) – CoderChristopher Jul 07 '21 at 15:51
  • No problem. I myself appreciate those answers where the answerer mentions why some approach is just bad or dangerous even if workable, instead of suggesting "don't go there. There be monsters!" – Firelord Jul 07 '21 at 15:58