I have Debian on Virtualbox. How can I install in on my pc for real?

0

I have Debian installed on Virtual Box (win 10) with all the packages i need. How can I make an installable file so I can install it (using a flash memory) beside win 10?

Ehsan

Posted 2017-04-29T08:40:15.997

Reputation: 1

First of all, welcome to Super User! That being said, please allow me to pass along one friendly piece of advice: we see a lot of questions posted from people who encounter problems with their Windows/Linux dual-boot configuration. However, we almost never hear about any issues from people who utilize Linux within a free hypervisor (either VirtualBox or Hyper-V) inside Windows 10. Just something to think about before you make that change. – Run5k – 2017-04-29T12:34:41.530

Answers

1

You can use the dd utility to do this from inside the virtual machine. dd if=$INPUT of=$OUTPUT (make sure to run this with admin rights!). For $INPUT, use your virtual disk's device path (ie /dev/sdX). You can use lsblk to ascertain this. For $OUTPUT, use the device path of your flashdrive. Once this is done, you might need to repair the bootloader and/or edit the fstab. However, it might also boot just fine.

Note that this will delete all information on your flashdrive.

Note that you may run into problems when trying to boot from the flashdrive on other computers (due to differing drivers or an old BIOS (in the case of GPT or UEFI)). Using the bootloader's fallback option may allow you to work around failures due to lack of drivers.

Note that if your virtual disk is larger than your flashdrive, you will have to resize your partitions until they would fit on the flashdrive.

Note that if your virtual drive is not the same size as your flashdrive (it almost certainly isn't), you will have to correct the partition table. If I remember correctly, simply opening the disk in gparted is enough to get this fixed -- but perhaps not.
A safer strategy is to clone (using dd) individual partitions instead of the entire disk. If you do it this way, you should first manually recreate the input drive's partition scheme on the output drive, using fdisk/gdisk/etc. Also, make sure that the new partitions are in the same order (this isn't completely necessary, but there's a good chance you could break something if you don't), and make sure that they are the same types (t in gdisk) and have the same flags (use gparted for this), or else you won't be able to boot.

Be aware that this is kind of inevitably pretty hacky. But I've been able to pull it off even on Windows installations, so it is definitely doable. Make sure to set aside a day or so, so that you have time to properly mess around with this.

If/when you succeed in doing this, make sure to remove the VirtualBox Guest Additions (if you installed them) from the flashdrive copy of Debian.

Also, make sure to re-enlarge the partitions on the flashdrive after you finish cloning; else, you won't be using the entire thing.

Miles B Huff

Posted 2017-04-29T08:40:15.997

Reputation: 11