How to boot from a USB drive in VirtualBox?
The question is simple and straight forward:
How to boot from an USB drive in VirtualBox?
EDIT:
I have attached usb
to VirtualBox as shown in the screenshot.
But it is not possible to boot from an USB drive even when attached (reference).
So I would like to know if there is any other possiblity to boot from an USB drive?
virtualbox live-usb
add a comment |
The question is simple and straight forward:
How to boot from an USB drive in VirtualBox?
EDIT:
I have attached usb
to VirtualBox as shown in the screenshot.
But it is not possible to boot from an USB drive even when attached (reference).
So I would like to know if there is any other possiblity to boot from an USB drive?
virtualbox live-usb
You can just open your USB, compress everything into an ISO file and boot it normally.
– dat tutbrus
Nov 4 '15 at 11:14
@Ravan - not to forget often users do not attach in gparted the property "boot" to the usb-stick. This is in menu 'partition' of gparted and there you can edit the flag resp. the label of the usb-stick and activate the parameter "boot".
– dschinn1001
Nov 13 '15 at 13:20
add a comment |
The question is simple and straight forward:
How to boot from an USB drive in VirtualBox?
EDIT:
I have attached usb
to VirtualBox as shown in the screenshot.
But it is not possible to boot from an USB drive even when attached (reference).
So I would like to know if there is any other possiblity to boot from an USB drive?
virtualbox live-usb
The question is simple and straight forward:
How to boot from an USB drive in VirtualBox?
EDIT:
I have attached usb
to VirtualBox as shown in the screenshot.
But it is not possible to boot from an USB drive even when attached (reference).
So I would like to know if there is any other possiblity to boot from an USB drive?
virtualbox live-usb
virtualbox live-usb
edited Nov 6 '15 at 15:48
cl-netbox
26k573114
26k573114
asked Nov 4 '15 at 5:16
RavanRavan
5,778154577
5,778154577
You can just open your USB, compress everything into an ISO file and boot it normally.
– dat tutbrus
Nov 4 '15 at 11:14
@Ravan - not to forget often users do not attach in gparted the property "boot" to the usb-stick. This is in menu 'partition' of gparted and there you can edit the flag resp. the label of the usb-stick and activate the parameter "boot".
– dschinn1001
Nov 13 '15 at 13:20
add a comment |
You can just open your USB, compress everything into an ISO file and boot it normally.
– dat tutbrus
Nov 4 '15 at 11:14
@Ravan - not to forget often users do not attach in gparted the property "boot" to the usb-stick. This is in menu 'partition' of gparted and there you can edit the flag resp. the label of the usb-stick and activate the parameter "boot".
– dschinn1001
Nov 13 '15 at 13:20
You can just open your USB, compress everything into an ISO file and boot it normally.
– dat tutbrus
Nov 4 '15 at 11:14
You can just open your USB, compress everything into an ISO file and boot it normally.
– dat tutbrus
Nov 4 '15 at 11:14
@Ravan - not to forget often users do not attach in gparted the property "boot" to the usb-stick. This is in menu 'partition' of gparted and there you can edit the flag resp. the label of the usb-stick and activate the parameter "boot".
– dschinn1001
Nov 13 '15 at 13:20
@Ravan - not to forget often users do not attach in gparted the property "boot" to the usb-stick. This is in menu 'partition' of gparted and there you can edit the flag resp. the label of the usb-stick and activate the parameter "boot".
– dschinn1001
Nov 13 '15 at 13:20
add a comment |
6 Answers
6
active
oldest
votes
VirtualBox itself does not support booting from a USB device. In order to boot from a USB device, another bootloader is required. The steps below provide one possible way to accomplish this:
- Download Plop Boot Manager (currently v5.0.15)
- Extract the file
plpbt.iso
from the ZIP archive and save it somewhere.
Open the settings for the virtual machine and attach the ISO file:
Add a filter for the USB device:
Boot the VM and select the "USB" option in the menu:
If all went well, the machine should now boot from the USB device.
1
This is definitely an easier answer than mine. I like it! I wish I could upvote more. =)
– Terrance
Nov 4 '15 at 18:08
3
This answer should include that you have to be part of the vboxusers group.
– musiKk
Jan 15 '16 at 16:53
6
It does not work for me. When I select usb I wait forever with his screen. Any idea? postimg.org/image/dv8w83pi3
– John
Feb 11 '16 at 17:19
6
I wanted to add that Plop Boot Manager only officially supports EHCI. If you're like me, and you're trying to use a USB 3.0 drive with Plop Boot Manager, it won't work. You could try to use the method mentioned in the other post, but VirtualBox also doesn't seem very fond of working with raw vmdks from USB 3.0 devices. If you only have USB 3 ports on your computer, you can order a USB 2.0 hub and connect the drive through that. It will behave essentially like a USB 2.0 drive.
– fakedad
Mar 21 '16 at 0:02
3
If you combine this solution with the VMDK one, you can get native USB performance. Otherwise this only works with USB 1.1.
– Will Bickford
Aug 16 '16 at 16:56
|
show 5 more comments
EDIT: 7 Mar 2018
Something to note here. Leaving the USB drive in the computer when you reboot can change the /dev/sd
drive letter designation causing the raw usb.vmdk
file to point to the incorrect drive so it does not boot in VirtualBox. As a test I left one in my system. It was /dev/sdi
before I rebooted, after reboot it was /dev/sdc
. When you reboot your computer for any changes please remove the USB drive prior to rebooting. I am looking into if the raw disk can be created from the UUID of the drive instead as that will not change.
Since VirtualBox does not boot to USB drives, you can create a .vmdk
file that points to your USB drive for booting to it.
NOTE: You MUST add your user account to the vboxusers
group for VirtualBox to see your USB. You MUST also add your account to the disk
group as well, or you cannot add the .vmdk
file to your Virtual Machine. Added instructions below in EDIT. This also does not copy the USB drive to the hard drive and uses the USB directly. This can be helpful if there is persistence on the USB that you want to keep. Not every situation is the same so this may not work for every case.
First, you need to have your USB you created in your system, and determine what the physical drive is. We are going to assume that your drive is mounted as /dev/sdb1
. So, the physical drive would be /dev/sdb
.
Next, type in the following from a terminal window to create the .vmdk
file that points to the USB drive:
sudo vboxmanage internalcommands createrawvmdk -filename ~/usb.vmdk -rawdisk /dev/sdb
Or
sudo VBoxManage internalcommands createrawvmdk -filename ~/usb.vmdk -rawdisk /dev/sdb
Then you should see something similar to this:
RAW host disk access VMDK file /home/ravan/usb.vmdk created successfully.
Note: Some people have had issues of ownership of the newly created file. Take ownership of the new file:
sudo chown $USER:$USER ~/usb.vmdk
Then all you should have to do is to add the .vmdk
file to your VirtualBox Virtual Machine and make sure that you can boot to it.
EDIT:
To add your user to the vboxusers
group, run the following command:
sudo usermod -a -G vboxusers username
To add your user to the disk
group, run the following command:
Note: Adding your user to the disk group can be dangerous and a security risk. It is as dangerous as having sudo access to write to a raw disk.
sudo usermod -a -G disk username
Then you MUST REBOOT your system in order for the changes to take effect.
Before reboot:
After reboot:
Hope this helps!
1
I got this error: VBoxManage: error: VMDK: could not open raw disk file '/dev/sdc' VBoxManage: error: Error code VERR_WRITE_PROTECT at /build/virtualbox-VDAABr/virtualbox-4.3.36-dfsg/src/VBox/Storage/VMDK.cpp(3390) in function int vmdkCreateRawImage(PVMDKIMAGE, PVBOXHDDRAW, uint64_t) VBoxManage: error: Cannot create the raw disk VMDK: VERR_WRITE_PROTECT VBoxManage: error: The raw disk vmdk file was not created
– John
Feb 11 '16 at 17:33
@John Did you add your account to thedisk
group then logout and back in or reboot after you added the group?
– Terrance
Feb 11 '16 at 17:36
Yes I reboot it and event if I run it as root result is same...
– John
Feb 11 '16 at 17:54
2
works well for me. Remarks: do not need to reboot, just to logout/login. Once in the disk group, one should not need to use sudo.
– Karl Forner
Apr 21 '17 at 9:08
1
I followed the instructions, but when trying to boot Windows 10 from usb-drive in virtualbox it says "FATAL: Could not read from the boot medium! System halted.". Any suggestions? Thank you for your help!
– Arch Linux Tux
Nov 18 '17 at 19:28
|
show 9 more comments
I came to this post just few days ago. I don't want to use Plop Boot Manager, because my USB stick is already bootable.
So I tried to point the USB stick to a VMDK disk (as in Terrance answer) by creating vboxmanage internalcommands createrawvmdk -filename ~/usb.vmdk -rawdisk /dev/sdb
Unfortunately, this refused to work... I chmod
and chown
the usb.vmdk
disk, and so I was able to attach it to a VM but it simply didn't work.
Finally, I tried another solution and this one has worked flawlessly. Here it is (thanks to Gean Santos for the research):
- Insert USB stick and identify it (mine is
/dev/sdb
, running Sabayon Linux);
Create a
.vmdk
disk by converting the raw device (i.e. the USB stick) to a VirtualBox disk
sudo VBoxManage convertfromraw /dev/sdb ./usb.vmdk --format vmdk
Now you have a
usb.vmdk
disk created from your bootable USB stick. I tried alsodd
the USB stick to an image file and create the.vmdk
disk from the image file. It works, as well as.vdi
disks created the former way (or from the image file)
Now, give permissions to the created disk in order VirtualBox can access the file. It just means change the file owner to an user that are in vboxusers group. If your VirtualBox install is running OK, than this owner would be, probably, you:
sudo chown `whoami`:`whoami` ./usb.vmdk
Now, you just have to attach the
usb.vmdk
disk to a Virtual Machine. But it must be attached to an IDE controller. I triedSATA
with no success.
At this point, you're OK.
Just boot the new VM, press F12
and choose the bootable drive.
Enjoy!
Does this work with USB 3.0 (cf. comments here askubuntu.com/questions/693719/…) ?
– nutty about natty
Jul 4 '17 at 18:54
add a comment |
The easiest solution is to copy the contents of the USB key into an iso file (well, next time I'll just download the iso on the right machine, no USB key needed in the first place)
dd if=/dev/sdc of=myusbkey.iso
And then add this .iso as an optical drive in the VirtualBox settings, under Storage, Controller: IDE (or SATA, I guess).
No need to make a .vmdk file, VirtualBox supports .iso files.
This answer should be at the top.
– McMutton
Mar 13 '18 at 10:20
I agree :-) But that requires more upvotes, still ;)
– David Faure
Mar 23 '18 at 13:11
The thing here is if you have a partition with a bootable image of about 40GB it will generate a file with that size 😅
– Sposmen
May 10 '18 at 19:47
Right, but all other solutions do that too, don't they?
– David Faure
May 11 '18 at 22:41
1
@DavidFaure The original answer about using "VBoxManage internalcommands createrawvmdk ..." just creates something that you could think of as equivalent to a shortcut to the USB drive that you have attached to the system at the time that you run the above command. So you don't end up with a potentially huge image of the USB stick as mentioned by user33845
– ConceptRat
Oct 10 '18 at 2:45
add a comment |
I would suggest the following steps.
- Open Disks.
- Look for the USB.
- Click there and at the top right corner you will see a settings icon that has 3 parallel lines.
- Click there and choose Create Disk Image...
- Select the location and click Create. It will create an .img file which you can use in VirtualBox.
add a comment |
I did not want to run Virtualbox as root.
I did not want my user to be of the disk group, having full permissions to all disks.
So here is what I got to work:
Find out what sd the memory stick is. In the following instructions it's sdc
.
Unmount memory Stick
su -
chmod 666 /dev/sdc1
chmod 666 /dev/sdc
exit # Run the following command as regular user:
VBoxManage internalcommands createrawvmdk -filename usb.vmdk -rawdisk /dev/sdc
su - # Back as root again:
chmod 777 usb.vmdk
chmod 666 /dev/sdc
Attach usb.vmdk virtualbox machine
chmod 666 /dev/sdc
- Start virtualbox machine
After done, reset sdc1 permission for security:
chmod 660 /dev/sdc1
In the above you can see that I had to reset the permissions for the memory stick a few times, because it would get set back to root each time.
I'm using Mandriva Linux, but it should be about the same in Ubuntu
The permission fiddling here is very bad advice. First of all, you are doing it as root, so you don't really need to change the permissions to make those commands work. Secondly, it is better to add the appropriate user into the disk group so it isn't even necessary.
– Evan Teran
Feb 14 at 20:40
@ Evan Teran Have you even tried it? And yes the user is part of the disk group. This is the method that I still use to today with my own linux operating system. Wayne Sallee Wayne@WayneSallee.com
– Wayne Sallee
Feb 15 at 21:10
I didn't say it wouldn't work, I said it's not good advice. Regardless of the user's groups, if you are running the commands as root, you shouldn't even need to muck with the permissions because root access anyway. Also, making files and folders with 777 and 666 is bad practice, you shouldn't make things world readable or writeable unless they need to be.
– Evan Teran
Feb 16 at 1:12
@ Evan Teran it's not good advice to run a program as root, that does not need to be root. The memory stick is only in for a little while, and it is not on a server. It's a matter of where you want to put the risk. I choose to put the risk on the memory stick rather than the system. Wayne@WayneSallee.com
– Wayne Sallee
2 days ago
Correction: I haven't put my user in the disk group. Wayne@WayneSallee.com
– Wayne Sallee
2 days ago
|
show 2 more comments
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f693719%2fhow-to-boot-from-a-usb-drive-in-virtualbox%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
6 Answers
6
active
oldest
votes
6 Answers
6
active
oldest
votes
active
oldest
votes
active
oldest
votes
VirtualBox itself does not support booting from a USB device. In order to boot from a USB device, another bootloader is required. The steps below provide one possible way to accomplish this:
- Download Plop Boot Manager (currently v5.0.15)
- Extract the file
plpbt.iso
from the ZIP archive and save it somewhere.
Open the settings for the virtual machine and attach the ISO file:
Add a filter for the USB device:
Boot the VM and select the "USB" option in the menu:
If all went well, the machine should now boot from the USB device.
1
This is definitely an easier answer than mine. I like it! I wish I could upvote more. =)
– Terrance
Nov 4 '15 at 18:08
3
This answer should include that you have to be part of the vboxusers group.
– musiKk
Jan 15 '16 at 16:53
6
It does not work for me. When I select usb I wait forever with his screen. Any idea? postimg.org/image/dv8w83pi3
– John
Feb 11 '16 at 17:19
6
I wanted to add that Plop Boot Manager only officially supports EHCI. If you're like me, and you're trying to use a USB 3.0 drive with Plop Boot Manager, it won't work. You could try to use the method mentioned in the other post, but VirtualBox also doesn't seem very fond of working with raw vmdks from USB 3.0 devices. If you only have USB 3 ports on your computer, you can order a USB 2.0 hub and connect the drive through that. It will behave essentially like a USB 2.0 drive.
– fakedad
Mar 21 '16 at 0:02
3
If you combine this solution with the VMDK one, you can get native USB performance. Otherwise this only works with USB 1.1.
– Will Bickford
Aug 16 '16 at 16:56
|
show 5 more comments
VirtualBox itself does not support booting from a USB device. In order to boot from a USB device, another bootloader is required. The steps below provide one possible way to accomplish this:
- Download Plop Boot Manager (currently v5.0.15)
- Extract the file
plpbt.iso
from the ZIP archive and save it somewhere.
Open the settings for the virtual machine and attach the ISO file:
Add a filter for the USB device:
Boot the VM and select the "USB" option in the menu:
If all went well, the machine should now boot from the USB device.
1
This is definitely an easier answer than mine. I like it! I wish I could upvote more. =)
– Terrance
Nov 4 '15 at 18:08
3
This answer should include that you have to be part of the vboxusers group.
– musiKk
Jan 15 '16 at 16:53
6
It does not work for me. When I select usb I wait forever with his screen. Any idea? postimg.org/image/dv8w83pi3
– John
Feb 11 '16 at 17:19
6
I wanted to add that Plop Boot Manager only officially supports EHCI. If you're like me, and you're trying to use a USB 3.0 drive with Plop Boot Manager, it won't work. You could try to use the method mentioned in the other post, but VirtualBox also doesn't seem very fond of working with raw vmdks from USB 3.0 devices. If you only have USB 3 ports on your computer, you can order a USB 2.0 hub and connect the drive through that. It will behave essentially like a USB 2.0 drive.
– fakedad
Mar 21 '16 at 0:02
3
If you combine this solution with the VMDK one, you can get native USB performance. Otherwise this only works with USB 1.1.
– Will Bickford
Aug 16 '16 at 16:56
|
show 5 more comments
VirtualBox itself does not support booting from a USB device. In order to boot from a USB device, another bootloader is required. The steps below provide one possible way to accomplish this:
- Download Plop Boot Manager (currently v5.0.15)
- Extract the file
plpbt.iso
from the ZIP archive and save it somewhere.
Open the settings for the virtual machine and attach the ISO file:
Add a filter for the USB device:
Boot the VM and select the "USB" option in the menu:
If all went well, the machine should now boot from the USB device.
VirtualBox itself does not support booting from a USB device. In order to boot from a USB device, another bootloader is required. The steps below provide one possible way to accomplish this:
- Download Plop Boot Manager (currently v5.0.15)
- Extract the file
plpbt.iso
from the ZIP archive and save it somewhere.
Open the settings for the virtual machine and attach the ISO file:
Add a filter for the USB device:
Boot the VM and select the "USB" option in the menu:
If all went well, the machine should now boot from the USB device.
answered Nov 4 '15 at 5:24
Nathan OsmanNathan Osman
21k32144237
21k32144237
1
This is definitely an easier answer than mine. I like it! I wish I could upvote more. =)
– Terrance
Nov 4 '15 at 18:08
3
This answer should include that you have to be part of the vboxusers group.
– musiKk
Jan 15 '16 at 16:53
6
It does not work for me. When I select usb I wait forever with his screen. Any idea? postimg.org/image/dv8w83pi3
– John
Feb 11 '16 at 17:19
6
I wanted to add that Plop Boot Manager only officially supports EHCI. If you're like me, and you're trying to use a USB 3.0 drive with Plop Boot Manager, it won't work. You could try to use the method mentioned in the other post, but VirtualBox also doesn't seem very fond of working with raw vmdks from USB 3.0 devices. If you only have USB 3 ports on your computer, you can order a USB 2.0 hub and connect the drive through that. It will behave essentially like a USB 2.0 drive.
– fakedad
Mar 21 '16 at 0:02
3
If you combine this solution with the VMDK one, you can get native USB performance. Otherwise this only works with USB 1.1.
– Will Bickford
Aug 16 '16 at 16:56
|
show 5 more comments
1
This is definitely an easier answer than mine. I like it! I wish I could upvote more. =)
– Terrance
Nov 4 '15 at 18:08
3
This answer should include that you have to be part of the vboxusers group.
– musiKk
Jan 15 '16 at 16:53
6
It does not work for me. When I select usb I wait forever with his screen. Any idea? postimg.org/image/dv8w83pi3
– John
Feb 11 '16 at 17:19
6
I wanted to add that Plop Boot Manager only officially supports EHCI. If you're like me, and you're trying to use a USB 3.0 drive with Plop Boot Manager, it won't work. You could try to use the method mentioned in the other post, but VirtualBox also doesn't seem very fond of working with raw vmdks from USB 3.0 devices. If you only have USB 3 ports on your computer, you can order a USB 2.0 hub and connect the drive through that. It will behave essentially like a USB 2.0 drive.
– fakedad
Mar 21 '16 at 0:02
3
If you combine this solution with the VMDK one, you can get native USB performance. Otherwise this only works with USB 1.1.
– Will Bickford
Aug 16 '16 at 16:56
1
1
This is definitely an easier answer than mine. I like it! I wish I could upvote more. =)
– Terrance
Nov 4 '15 at 18:08
This is definitely an easier answer than mine. I like it! I wish I could upvote more. =)
– Terrance
Nov 4 '15 at 18:08
3
3
This answer should include that you have to be part of the vboxusers group.
– musiKk
Jan 15 '16 at 16:53
This answer should include that you have to be part of the vboxusers group.
– musiKk
Jan 15 '16 at 16:53
6
6
It does not work for me. When I select usb I wait forever with his screen. Any idea? postimg.org/image/dv8w83pi3
– John
Feb 11 '16 at 17:19
It does not work for me. When I select usb I wait forever with his screen. Any idea? postimg.org/image/dv8w83pi3
– John
Feb 11 '16 at 17:19
6
6
I wanted to add that Plop Boot Manager only officially supports EHCI. If you're like me, and you're trying to use a USB 3.0 drive with Plop Boot Manager, it won't work. You could try to use the method mentioned in the other post, but VirtualBox also doesn't seem very fond of working with raw vmdks from USB 3.0 devices. If you only have USB 3 ports on your computer, you can order a USB 2.0 hub and connect the drive through that. It will behave essentially like a USB 2.0 drive.
– fakedad
Mar 21 '16 at 0:02
I wanted to add that Plop Boot Manager only officially supports EHCI. If you're like me, and you're trying to use a USB 3.0 drive with Plop Boot Manager, it won't work. You could try to use the method mentioned in the other post, but VirtualBox also doesn't seem very fond of working with raw vmdks from USB 3.0 devices. If you only have USB 3 ports on your computer, you can order a USB 2.0 hub and connect the drive through that. It will behave essentially like a USB 2.0 drive.
– fakedad
Mar 21 '16 at 0:02
3
3
If you combine this solution with the VMDK one, you can get native USB performance. Otherwise this only works with USB 1.1.
– Will Bickford
Aug 16 '16 at 16:56
If you combine this solution with the VMDK one, you can get native USB performance. Otherwise this only works with USB 1.1.
– Will Bickford
Aug 16 '16 at 16:56
|
show 5 more comments
EDIT: 7 Mar 2018
Something to note here. Leaving the USB drive in the computer when you reboot can change the /dev/sd
drive letter designation causing the raw usb.vmdk
file to point to the incorrect drive so it does not boot in VirtualBox. As a test I left one in my system. It was /dev/sdi
before I rebooted, after reboot it was /dev/sdc
. When you reboot your computer for any changes please remove the USB drive prior to rebooting. I am looking into if the raw disk can be created from the UUID of the drive instead as that will not change.
Since VirtualBox does not boot to USB drives, you can create a .vmdk
file that points to your USB drive for booting to it.
NOTE: You MUST add your user account to the vboxusers
group for VirtualBox to see your USB. You MUST also add your account to the disk
group as well, or you cannot add the .vmdk
file to your Virtual Machine. Added instructions below in EDIT. This also does not copy the USB drive to the hard drive and uses the USB directly. This can be helpful if there is persistence on the USB that you want to keep. Not every situation is the same so this may not work for every case.
First, you need to have your USB you created in your system, and determine what the physical drive is. We are going to assume that your drive is mounted as /dev/sdb1
. So, the physical drive would be /dev/sdb
.
Next, type in the following from a terminal window to create the .vmdk
file that points to the USB drive:
sudo vboxmanage internalcommands createrawvmdk -filename ~/usb.vmdk -rawdisk /dev/sdb
Or
sudo VBoxManage internalcommands createrawvmdk -filename ~/usb.vmdk -rawdisk /dev/sdb
Then you should see something similar to this:
RAW host disk access VMDK file /home/ravan/usb.vmdk created successfully.
Note: Some people have had issues of ownership of the newly created file. Take ownership of the new file:
sudo chown $USER:$USER ~/usb.vmdk
Then all you should have to do is to add the .vmdk
file to your VirtualBox Virtual Machine and make sure that you can boot to it.
EDIT:
To add your user to the vboxusers
group, run the following command:
sudo usermod -a -G vboxusers username
To add your user to the disk
group, run the following command:
Note: Adding your user to the disk group can be dangerous and a security risk. It is as dangerous as having sudo access to write to a raw disk.
sudo usermod -a -G disk username
Then you MUST REBOOT your system in order for the changes to take effect.
Before reboot:
After reboot:
Hope this helps!
1
I got this error: VBoxManage: error: VMDK: could not open raw disk file '/dev/sdc' VBoxManage: error: Error code VERR_WRITE_PROTECT at /build/virtualbox-VDAABr/virtualbox-4.3.36-dfsg/src/VBox/Storage/VMDK.cpp(3390) in function int vmdkCreateRawImage(PVMDKIMAGE, PVBOXHDDRAW, uint64_t) VBoxManage: error: Cannot create the raw disk VMDK: VERR_WRITE_PROTECT VBoxManage: error: The raw disk vmdk file was not created
– John
Feb 11 '16 at 17:33
@John Did you add your account to thedisk
group then logout and back in or reboot after you added the group?
– Terrance
Feb 11 '16 at 17:36
Yes I reboot it and event if I run it as root result is same...
– John
Feb 11 '16 at 17:54
2
works well for me. Remarks: do not need to reboot, just to logout/login. Once in the disk group, one should not need to use sudo.
– Karl Forner
Apr 21 '17 at 9:08
1
I followed the instructions, but when trying to boot Windows 10 from usb-drive in virtualbox it says "FATAL: Could not read from the boot medium! System halted.". Any suggestions? Thank you for your help!
– Arch Linux Tux
Nov 18 '17 at 19:28
|
show 9 more comments
EDIT: 7 Mar 2018
Something to note here. Leaving the USB drive in the computer when you reboot can change the /dev/sd
drive letter designation causing the raw usb.vmdk
file to point to the incorrect drive so it does not boot in VirtualBox. As a test I left one in my system. It was /dev/sdi
before I rebooted, after reboot it was /dev/sdc
. When you reboot your computer for any changes please remove the USB drive prior to rebooting. I am looking into if the raw disk can be created from the UUID of the drive instead as that will not change.
Since VirtualBox does not boot to USB drives, you can create a .vmdk
file that points to your USB drive for booting to it.
NOTE: You MUST add your user account to the vboxusers
group for VirtualBox to see your USB. You MUST also add your account to the disk
group as well, or you cannot add the .vmdk
file to your Virtual Machine. Added instructions below in EDIT. This also does not copy the USB drive to the hard drive and uses the USB directly. This can be helpful if there is persistence on the USB that you want to keep. Not every situation is the same so this may not work for every case.
First, you need to have your USB you created in your system, and determine what the physical drive is. We are going to assume that your drive is mounted as /dev/sdb1
. So, the physical drive would be /dev/sdb
.
Next, type in the following from a terminal window to create the .vmdk
file that points to the USB drive:
sudo vboxmanage internalcommands createrawvmdk -filename ~/usb.vmdk -rawdisk /dev/sdb
Or
sudo VBoxManage internalcommands createrawvmdk -filename ~/usb.vmdk -rawdisk /dev/sdb
Then you should see something similar to this:
RAW host disk access VMDK file /home/ravan/usb.vmdk created successfully.
Note: Some people have had issues of ownership of the newly created file. Take ownership of the new file:
sudo chown $USER:$USER ~/usb.vmdk
Then all you should have to do is to add the .vmdk
file to your VirtualBox Virtual Machine and make sure that you can boot to it.
EDIT:
To add your user to the vboxusers
group, run the following command:
sudo usermod -a -G vboxusers username
To add your user to the disk
group, run the following command:
Note: Adding your user to the disk group can be dangerous and a security risk. It is as dangerous as having sudo access to write to a raw disk.
sudo usermod -a -G disk username
Then you MUST REBOOT your system in order for the changes to take effect.
Before reboot:
After reboot:
Hope this helps!
1
I got this error: VBoxManage: error: VMDK: could not open raw disk file '/dev/sdc' VBoxManage: error: Error code VERR_WRITE_PROTECT at /build/virtualbox-VDAABr/virtualbox-4.3.36-dfsg/src/VBox/Storage/VMDK.cpp(3390) in function int vmdkCreateRawImage(PVMDKIMAGE, PVBOXHDDRAW, uint64_t) VBoxManage: error: Cannot create the raw disk VMDK: VERR_WRITE_PROTECT VBoxManage: error: The raw disk vmdk file was not created
– John
Feb 11 '16 at 17:33
@John Did you add your account to thedisk
group then logout and back in or reboot after you added the group?
– Terrance
Feb 11 '16 at 17:36
Yes I reboot it and event if I run it as root result is same...
– John
Feb 11 '16 at 17:54
2
works well for me. Remarks: do not need to reboot, just to logout/login. Once in the disk group, one should not need to use sudo.
– Karl Forner
Apr 21 '17 at 9:08
1
I followed the instructions, but when trying to boot Windows 10 from usb-drive in virtualbox it says "FATAL: Could not read from the boot medium! System halted.". Any suggestions? Thank you for your help!
– Arch Linux Tux
Nov 18 '17 at 19:28
|
show 9 more comments
EDIT: 7 Mar 2018
Something to note here. Leaving the USB drive in the computer when you reboot can change the /dev/sd
drive letter designation causing the raw usb.vmdk
file to point to the incorrect drive so it does not boot in VirtualBox. As a test I left one in my system. It was /dev/sdi
before I rebooted, after reboot it was /dev/sdc
. When you reboot your computer for any changes please remove the USB drive prior to rebooting. I am looking into if the raw disk can be created from the UUID of the drive instead as that will not change.
Since VirtualBox does not boot to USB drives, you can create a .vmdk
file that points to your USB drive for booting to it.
NOTE: You MUST add your user account to the vboxusers
group for VirtualBox to see your USB. You MUST also add your account to the disk
group as well, or you cannot add the .vmdk
file to your Virtual Machine. Added instructions below in EDIT. This also does not copy the USB drive to the hard drive and uses the USB directly. This can be helpful if there is persistence on the USB that you want to keep. Not every situation is the same so this may not work for every case.
First, you need to have your USB you created in your system, and determine what the physical drive is. We are going to assume that your drive is mounted as /dev/sdb1
. So, the physical drive would be /dev/sdb
.
Next, type in the following from a terminal window to create the .vmdk
file that points to the USB drive:
sudo vboxmanage internalcommands createrawvmdk -filename ~/usb.vmdk -rawdisk /dev/sdb
Or
sudo VBoxManage internalcommands createrawvmdk -filename ~/usb.vmdk -rawdisk /dev/sdb
Then you should see something similar to this:
RAW host disk access VMDK file /home/ravan/usb.vmdk created successfully.
Note: Some people have had issues of ownership of the newly created file. Take ownership of the new file:
sudo chown $USER:$USER ~/usb.vmdk
Then all you should have to do is to add the .vmdk
file to your VirtualBox Virtual Machine and make sure that you can boot to it.
EDIT:
To add your user to the vboxusers
group, run the following command:
sudo usermod -a -G vboxusers username
To add your user to the disk
group, run the following command:
Note: Adding your user to the disk group can be dangerous and a security risk. It is as dangerous as having sudo access to write to a raw disk.
sudo usermod -a -G disk username
Then you MUST REBOOT your system in order for the changes to take effect.
Before reboot:
After reboot:
Hope this helps!
EDIT: 7 Mar 2018
Something to note here. Leaving the USB drive in the computer when you reboot can change the /dev/sd
drive letter designation causing the raw usb.vmdk
file to point to the incorrect drive so it does not boot in VirtualBox. As a test I left one in my system. It was /dev/sdi
before I rebooted, after reboot it was /dev/sdc
. When you reboot your computer for any changes please remove the USB drive prior to rebooting. I am looking into if the raw disk can be created from the UUID of the drive instead as that will not change.
Since VirtualBox does not boot to USB drives, you can create a .vmdk
file that points to your USB drive for booting to it.
NOTE: You MUST add your user account to the vboxusers
group for VirtualBox to see your USB. You MUST also add your account to the disk
group as well, or you cannot add the .vmdk
file to your Virtual Machine. Added instructions below in EDIT. This also does not copy the USB drive to the hard drive and uses the USB directly. This can be helpful if there is persistence on the USB that you want to keep. Not every situation is the same so this may not work for every case.
First, you need to have your USB you created in your system, and determine what the physical drive is. We are going to assume that your drive is mounted as /dev/sdb1
. So, the physical drive would be /dev/sdb
.
Next, type in the following from a terminal window to create the .vmdk
file that points to the USB drive:
sudo vboxmanage internalcommands createrawvmdk -filename ~/usb.vmdk -rawdisk /dev/sdb
Or
sudo VBoxManage internalcommands createrawvmdk -filename ~/usb.vmdk -rawdisk /dev/sdb
Then you should see something similar to this:
RAW host disk access VMDK file /home/ravan/usb.vmdk created successfully.
Note: Some people have had issues of ownership of the newly created file. Take ownership of the new file:
sudo chown $USER:$USER ~/usb.vmdk
Then all you should have to do is to add the .vmdk
file to your VirtualBox Virtual Machine and make sure that you can boot to it.
EDIT:
To add your user to the vboxusers
group, run the following command:
sudo usermod -a -G vboxusers username
To add your user to the disk
group, run the following command:
Note: Adding your user to the disk group can be dangerous and a security risk. It is as dangerous as having sudo access to write to a raw disk.
sudo usermod -a -G disk username
Then you MUST REBOOT your system in order for the changes to take effect.
Before reboot:
After reboot:
Hope this helps!
edited Aug 21 '18 at 14:15
answered Nov 4 '15 at 5:46
TerranceTerrance
19.6k34797
19.6k34797
1
I got this error: VBoxManage: error: VMDK: could not open raw disk file '/dev/sdc' VBoxManage: error: Error code VERR_WRITE_PROTECT at /build/virtualbox-VDAABr/virtualbox-4.3.36-dfsg/src/VBox/Storage/VMDK.cpp(3390) in function int vmdkCreateRawImage(PVMDKIMAGE, PVBOXHDDRAW, uint64_t) VBoxManage: error: Cannot create the raw disk VMDK: VERR_WRITE_PROTECT VBoxManage: error: The raw disk vmdk file was not created
– John
Feb 11 '16 at 17:33
@John Did you add your account to thedisk
group then logout and back in or reboot after you added the group?
– Terrance
Feb 11 '16 at 17:36
Yes I reboot it and event if I run it as root result is same...
– John
Feb 11 '16 at 17:54
2
works well for me. Remarks: do not need to reboot, just to logout/login. Once in the disk group, one should not need to use sudo.
– Karl Forner
Apr 21 '17 at 9:08
1
I followed the instructions, but when trying to boot Windows 10 from usb-drive in virtualbox it says "FATAL: Could not read from the boot medium! System halted.". Any suggestions? Thank you for your help!
– Arch Linux Tux
Nov 18 '17 at 19:28
|
show 9 more comments
1
I got this error: VBoxManage: error: VMDK: could not open raw disk file '/dev/sdc' VBoxManage: error: Error code VERR_WRITE_PROTECT at /build/virtualbox-VDAABr/virtualbox-4.3.36-dfsg/src/VBox/Storage/VMDK.cpp(3390) in function int vmdkCreateRawImage(PVMDKIMAGE, PVBOXHDDRAW, uint64_t) VBoxManage: error: Cannot create the raw disk VMDK: VERR_WRITE_PROTECT VBoxManage: error: The raw disk vmdk file was not created
– John
Feb 11 '16 at 17:33
@John Did you add your account to thedisk
group then logout and back in or reboot after you added the group?
– Terrance
Feb 11 '16 at 17:36
Yes I reboot it and event if I run it as root result is same...
– John
Feb 11 '16 at 17:54
2
works well for me. Remarks: do not need to reboot, just to logout/login. Once in the disk group, one should not need to use sudo.
– Karl Forner
Apr 21 '17 at 9:08
1
I followed the instructions, but when trying to boot Windows 10 from usb-drive in virtualbox it says "FATAL: Could not read from the boot medium! System halted.". Any suggestions? Thank you for your help!
– Arch Linux Tux
Nov 18 '17 at 19:28
1
1
I got this error: VBoxManage: error: VMDK: could not open raw disk file '/dev/sdc' VBoxManage: error: Error code VERR_WRITE_PROTECT at /build/virtualbox-VDAABr/virtualbox-4.3.36-dfsg/src/VBox/Storage/VMDK.cpp(3390) in function int vmdkCreateRawImage(PVMDKIMAGE, PVBOXHDDRAW, uint64_t) VBoxManage: error: Cannot create the raw disk VMDK: VERR_WRITE_PROTECT VBoxManage: error: The raw disk vmdk file was not created
– John
Feb 11 '16 at 17:33
I got this error: VBoxManage: error: VMDK: could not open raw disk file '/dev/sdc' VBoxManage: error: Error code VERR_WRITE_PROTECT at /build/virtualbox-VDAABr/virtualbox-4.3.36-dfsg/src/VBox/Storage/VMDK.cpp(3390) in function int vmdkCreateRawImage(PVMDKIMAGE, PVBOXHDDRAW, uint64_t) VBoxManage: error: Cannot create the raw disk VMDK: VERR_WRITE_PROTECT VBoxManage: error: The raw disk vmdk file was not created
– John
Feb 11 '16 at 17:33
@John Did you add your account to the
disk
group then logout and back in or reboot after you added the group?– Terrance
Feb 11 '16 at 17:36
@John Did you add your account to the
disk
group then logout and back in or reboot after you added the group?– Terrance
Feb 11 '16 at 17:36
Yes I reboot it and event if I run it as root result is same...
– John
Feb 11 '16 at 17:54
Yes I reboot it and event if I run it as root result is same...
– John
Feb 11 '16 at 17:54
2
2
works well for me. Remarks: do not need to reboot, just to logout/login. Once in the disk group, one should not need to use sudo.
– Karl Forner
Apr 21 '17 at 9:08
works well for me. Remarks: do not need to reboot, just to logout/login. Once in the disk group, one should not need to use sudo.
– Karl Forner
Apr 21 '17 at 9:08
1
1
I followed the instructions, but when trying to boot Windows 10 from usb-drive in virtualbox it says "FATAL: Could not read from the boot medium! System halted.". Any suggestions? Thank you for your help!
– Arch Linux Tux
Nov 18 '17 at 19:28
I followed the instructions, but when trying to boot Windows 10 from usb-drive in virtualbox it says "FATAL: Could not read from the boot medium! System halted.". Any suggestions? Thank you for your help!
– Arch Linux Tux
Nov 18 '17 at 19:28
|
show 9 more comments
I came to this post just few days ago. I don't want to use Plop Boot Manager, because my USB stick is already bootable.
So I tried to point the USB stick to a VMDK disk (as in Terrance answer) by creating vboxmanage internalcommands createrawvmdk -filename ~/usb.vmdk -rawdisk /dev/sdb
Unfortunately, this refused to work... I chmod
and chown
the usb.vmdk
disk, and so I was able to attach it to a VM but it simply didn't work.
Finally, I tried another solution and this one has worked flawlessly. Here it is (thanks to Gean Santos for the research):
- Insert USB stick and identify it (mine is
/dev/sdb
, running Sabayon Linux);
Create a
.vmdk
disk by converting the raw device (i.e. the USB stick) to a VirtualBox disk
sudo VBoxManage convertfromraw /dev/sdb ./usb.vmdk --format vmdk
Now you have a
usb.vmdk
disk created from your bootable USB stick. I tried alsodd
the USB stick to an image file and create the.vmdk
disk from the image file. It works, as well as.vdi
disks created the former way (or from the image file)
Now, give permissions to the created disk in order VirtualBox can access the file. It just means change the file owner to an user that are in vboxusers group. If your VirtualBox install is running OK, than this owner would be, probably, you:
sudo chown `whoami`:`whoami` ./usb.vmdk
Now, you just have to attach the
usb.vmdk
disk to a Virtual Machine. But it must be attached to an IDE controller. I triedSATA
with no success.
At this point, you're OK.
Just boot the new VM, press F12
and choose the bootable drive.
Enjoy!
Does this work with USB 3.0 (cf. comments here askubuntu.com/questions/693719/…) ?
– nutty about natty
Jul 4 '17 at 18:54
add a comment |
I came to this post just few days ago. I don't want to use Plop Boot Manager, because my USB stick is already bootable.
So I tried to point the USB stick to a VMDK disk (as in Terrance answer) by creating vboxmanage internalcommands createrawvmdk -filename ~/usb.vmdk -rawdisk /dev/sdb
Unfortunately, this refused to work... I chmod
and chown
the usb.vmdk
disk, and so I was able to attach it to a VM but it simply didn't work.
Finally, I tried another solution and this one has worked flawlessly. Here it is (thanks to Gean Santos for the research):
- Insert USB stick and identify it (mine is
/dev/sdb
, running Sabayon Linux);
Create a
.vmdk
disk by converting the raw device (i.e. the USB stick) to a VirtualBox disk
sudo VBoxManage convertfromraw /dev/sdb ./usb.vmdk --format vmdk
Now you have a
usb.vmdk
disk created from your bootable USB stick. I tried alsodd
the USB stick to an image file and create the.vmdk
disk from the image file. It works, as well as.vdi
disks created the former way (or from the image file)
Now, give permissions to the created disk in order VirtualBox can access the file. It just means change the file owner to an user that are in vboxusers group. If your VirtualBox install is running OK, than this owner would be, probably, you:
sudo chown `whoami`:`whoami` ./usb.vmdk
Now, you just have to attach the
usb.vmdk
disk to a Virtual Machine. But it must be attached to an IDE controller. I triedSATA
with no success.
At this point, you're OK.
Just boot the new VM, press F12
and choose the bootable drive.
Enjoy!
Does this work with USB 3.0 (cf. comments here askubuntu.com/questions/693719/…) ?
– nutty about natty
Jul 4 '17 at 18:54
add a comment |
I came to this post just few days ago. I don't want to use Plop Boot Manager, because my USB stick is already bootable.
So I tried to point the USB stick to a VMDK disk (as in Terrance answer) by creating vboxmanage internalcommands createrawvmdk -filename ~/usb.vmdk -rawdisk /dev/sdb
Unfortunately, this refused to work... I chmod
and chown
the usb.vmdk
disk, and so I was able to attach it to a VM but it simply didn't work.
Finally, I tried another solution and this one has worked flawlessly. Here it is (thanks to Gean Santos for the research):
- Insert USB stick and identify it (mine is
/dev/sdb
, running Sabayon Linux);
Create a
.vmdk
disk by converting the raw device (i.e. the USB stick) to a VirtualBox disk
sudo VBoxManage convertfromraw /dev/sdb ./usb.vmdk --format vmdk
Now you have a
usb.vmdk
disk created from your bootable USB stick. I tried alsodd
the USB stick to an image file and create the.vmdk
disk from the image file. It works, as well as.vdi
disks created the former way (or from the image file)
Now, give permissions to the created disk in order VirtualBox can access the file. It just means change the file owner to an user that are in vboxusers group. If your VirtualBox install is running OK, than this owner would be, probably, you:
sudo chown `whoami`:`whoami` ./usb.vmdk
Now, you just have to attach the
usb.vmdk
disk to a Virtual Machine. But it must be attached to an IDE controller. I triedSATA
with no success.
At this point, you're OK.
Just boot the new VM, press F12
and choose the bootable drive.
Enjoy!
I came to this post just few days ago. I don't want to use Plop Boot Manager, because my USB stick is already bootable.
So I tried to point the USB stick to a VMDK disk (as in Terrance answer) by creating vboxmanage internalcommands createrawvmdk -filename ~/usb.vmdk -rawdisk /dev/sdb
Unfortunately, this refused to work... I chmod
and chown
the usb.vmdk
disk, and so I was able to attach it to a VM but it simply didn't work.
Finally, I tried another solution and this one has worked flawlessly. Here it is (thanks to Gean Santos for the research):
- Insert USB stick and identify it (mine is
/dev/sdb
, running Sabayon Linux);
Create a
.vmdk
disk by converting the raw device (i.e. the USB stick) to a VirtualBox disk
sudo VBoxManage convertfromraw /dev/sdb ./usb.vmdk --format vmdk
Now you have a
usb.vmdk
disk created from your bootable USB stick. I tried alsodd
the USB stick to an image file and create the.vmdk
disk from the image file. It works, as well as.vdi
disks created the former way (or from the image file)
Now, give permissions to the created disk in order VirtualBox can access the file. It just means change the file owner to an user that are in vboxusers group. If your VirtualBox install is running OK, than this owner would be, probably, you:
sudo chown `whoami`:`whoami` ./usb.vmdk
Now, you just have to attach the
usb.vmdk
disk to a Virtual Machine. But it must be attached to an IDE controller. I triedSATA
with no success.
At this point, you're OK.
Just boot the new VM, press F12
and choose the bootable drive.
Enjoy!
edited Oct 14 '16 at 21:20
answered Oct 14 '16 at 18:57
Marcio H ZuchiniMarcio H Zuchini
14116
14116
Does this work with USB 3.0 (cf. comments here askubuntu.com/questions/693719/…) ?
– nutty about natty
Jul 4 '17 at 18:54
add a comment |
Does this work with USB 3.0 (cf. comments here askubuntu.com/questions/693719/…) ?
– nutty about natty
Jul 4 '17 at 18:54
Does this work with USB 3.0 (cf. comments here askubuntu.com/questions/693719/…) ?
– nutty about natty
Jul 4 '17 at 18:54
Does this work with USB 3.0 (cf. comments here askubuntu.com/questions/693719/…) ?
– nutty about natty
Jul 4 '17 at 18:54
add a comment |
The easiest solution is to copy the contents of the USB key into an iso file (well, next time I'll just download the iso on the right machine, no USB key needed in the first place)
dd if=/dev/sdc of=myusbkey.iso
And then add this .iso as an optical drive in the VirtualBox settings, under Storage, Controller: IDE (or SATA, I guess).
No need to make a .vmdk file, VirtualBox supports .iso files.
This answer should be at the top.
– McMutton
Mar 13 '18 at 10:20
I agree :-) But that requires more upvotes, still ;)
– David Faure
Mar 23 '18 at 13:11
The thing here is if you have a partition with a bootable image of about 40GB it will generate a file with that size 😅
– Sposmen
May 10 '18 at 19:47
Right, but all other solutions do that too, don't they?
– David Faure
May 11 '18 at 22:41
1
@DavidFaure The original answer about using "VBoxManage internalcommands createrawvmdk ..." just creates something that you could think of as equivalent to a shortcut to the USB drive that you have attached to the system at the time that you run the above command. So you don't end up with a potentially huge image of the USB stick as mentioned by user33845
– ConceptRat
Oct 10 '18 at 2:45
add a comment |
The easiest solution is to copy the contents of the USB key into an iso file (well, next time I'll just download the iso on the right machine, no USB key needed in the first place)
dd if=/dev/sdc of=myusbkey.iso
And then add this .iso as an optical drive in the VirtualBox settings, under Storage, Controller: IDE (or SATA, I guess).
No need to make a .vmdk file, VirtualBox supports .iso files.
This answer should be at the top.
– McMutton
Mar 13 '18 at 10:20
I agree :-) But that requires more upvotes, still ;)
– David Faure
Mar 23 '18 at 13:11
The thing here is if you have a partition with a bootable image of about 40GB it will generate a file with that size 😅
– Sposmen
May 10 '18 at 19:47
Right, but all other solutions do that too, don't they?
– David Faure
May 11 '18 at 22:41
1
@DavidFaure The original answer about using "VBoxManage internalcommands createrawvmdk ..." just creates something that you could think of as equivalent to a shortcut to the USB drive that you have attached to the system at the time that you run the above command. So you don't end up with a potentially huge image of the USB stick as mentioned by user33845
– ConceptRat
Oct 10 '18 at 2:45
add a comment |
The easiest solution is to copy the contents of the USB key into an iso file (well, next time I'll just download the iso on the right machine, no USB key needed in the first place)
dd if=/dev/sdc of=myusbkey.iso
And then add this .iso as an optical drive in the VirtualBox settings, under Storage, Controller: IDE (or SATA, I guess).
No need to make a .vmdk file, VirtualBox supports .iso files.
The easiest solution is to copy the contents of the USB key into an iso file (well, next time I'll just download the iso on the right machine, no USB key needed in the first place)
dd if=/dev/sdc of=myusbkey.iso
And then add this .iso as an optical drive in the VirtualBox settings, under Storage, Controller: IDE (or SATA, I guess).
No need to make a .vmdk file, VirtualBox supports .iso files.
answered Nov 13 '16 at 10:00
David FaureDavid Faure
26125
26125
This answer should be at the top.
– McMutton
Mar 13 '18 at 10:20
I agree :-) But that requires more upvotes, still ;)
– David Faure
Mar 23 '18 at 13:11
The thing here is if you have a partition with a bootable image of about 40GB it will generate a file with that size 😅
– Sposmen
May 10 '18 at 19:47
Right, but all other solutions do that too, don't they?
– David Faure
May 11 '18 at 22:41
1
@DavidFaure The original answer about using "VBoxManage internalcommands createrawvmdk ..." just creates something that you could think of as equivalent to a shortcut to the USB drive that you have attached to the system at the time that you run the above command. So you don't end up with a potentially huge image of the USB stick as mentioned by user33845
– ConceptRat
Oct 10 '18 at 2:45
add a comment |
This answer should be at the top.
– McMutton
Mar 13 '18 at 10:20
I agree :-) But that requires more upvotes, still ;)
– David Faure
Mar 23 '18 at 13:11
The thing here is if you have a partition with a bootable image of about 40GB it will generate a file with that size 😅
– Sposmen
May 10 '18 at 19:47
Right, but all other solutions do that too, don't they?
– David Faure
May 11 '18 at 22:41
1
@DavidFaure The original answer about using "VBoxManage internalcommands createrawvmdk ..." just creates something that you could think of as equivalent to a shortcut to the USB drive that you have attached to the system at the time that you run the above command. So you don't end up with a potentially huge image of the USB stick as mentioned by user33845
– ConceptRat
Oct 10 '18 at 2:45
This answer should be at the top.
– McMutton
Mar 13 '18 at 10:20
This answer should be at the top.
– McMutton
Mar 13 '18 at 10:20
I agree :-) But that requires more upvotes, still ;)
– David Faure
Mar 23 '18 at 13:11
I agree :-) But that requires more upvotes, still ;)
– David Faure
Mar 23 '18 at 13:11
The thing here is if you have a partition with a bootable image of about 40GB it will generate a file with that size 😅
– Sposmen
May 10 '18 at 19:47
The thing here is if you have a partition with a bootable image of about 40GB it will generate a file with that size 😅
– Sposmen
May 10 '18 at 19:47
Right, but all other solutions do that too, don't they?
– David Faure
May 11 '18 at 22:41
Right, but all other solutions do that too, don't they?
– David Faure
May 11 '18 at 22:41
1
1
@DavidFaure The original answer about using "VBoxManage internalcommands createrawvmdk ..." just creates something that you could think of as equivalent to a shortcut to the USB drive that you have attached to the system at the time that you run the above command. So you don't end up with a potentially huge image of the USB stick as mentioned by user33845
– ConceptRat
Oct 10 '18 at 2:45
@DavidFaure The original answer about using "VBoxManage internalcommands createrawvmdk ..." just creates something that you could think of as equivalent to a shortcut to the USB drive that you have attached to the system at the time that you run the above command. So you don't end up with a potentially huge image of the USB stick as mentioned by user33845
– ConceptRat
Oct 10 '18 at 2:45
add a comment |
I would suggest the following steps.
- Open Disks.
- Look for the USB.
- Click there and at the top right corner you will see a settings icon that has 3 parallel lines.
- Click there and choose Create Disk Image...
- Select the location and click Create. It will create an .img file which you can use in VirtualBox.
add a comment |
I would suggest the following steps.
- Open Disks.
- Look for the USB.
- Click there and at the top right corner you will see a settings icon that has 3 parallel lines.
- Click there and choose Create Disk Image...
- Select the location and click Create. It will create an .img file which you can use in VirtualBox.
add a comment |
I would suggest the following steps.
- Open Disks.
- Look for the USB.
- Click there and at the top right corner you will see a settings icon that has 3 parallel lines.
- Click there and choose Create Disk Image...
- Select the location and click Create. It will create an .img file which you can use in VirtualBox.
I would suggest the following steps.
- Open Disks.
- Look for the USB.
- Click there and at the top right corner you will see a settings icon that has 3 parallel lines.
- Click there and choose Create Disk Image...
- Select the location and click Create. It will create an .img file which you can use in VirtualBox.
edited Feb 22 '17 at 10:32
karel
59.5k13129151
59.5k13129151
answered Feb 22 '17 at 9:17
Madhurjya DasguptaMadhurjya Dasgupta
411
411
add a comment |
add a comment |
I did not want to run Virtualbox as root.
I did not want my user to be of the disk group, having full permissions to all disks.
So here is what I got to work:
Find out what sd the memory stick is. In the following instructions it's sdc
.
Unmount memory Stick
su -
chmod 666 /dev/sdc1
chmod 666 /dev/sdc
exit # Run the following command as regular user:
VBoxManage internalcommands createrawvmdk -filename usb.vmdk -rawdisk /dev/sdc
su - # Back as root again:
chmod 777 usb.vmdk
chmod 666 /dev/sdc
Attach usb.vmdk virtualbox machine
chmod 666 /dev/sdc
- Start virtualbox machine
After done, reset sdc1 permission for security:
chmod 660 /dev/sdc1
In the above you can see that I had to reset the permissions for the memory stick a few times, because it would get set back to root each time.
I'm using Mandriva Linux, but it should be about the same in Ubuntu
The permission fiddling here is very bad advice. First of all, you are doing it as root, so you don't really need to change the permissions to make those commands work. Secondly, it is better to add the appropriate user into the disk group so it isn't even necessary.
– Evan Teran
Feb 14 at 20:40
@ Evan Teran Have you even tried it? And yes the user is part of the disk group. This is the method that I still use to today with my own linux operating system. Wayne Sallee Wayne@WayneSallee.com
– Wayne Sallee
Feb 15 at 21:10
I didn't say it wouldn't work, I said it's not good advice. Regardless of the user's groups, if you are running the commands as root, you shouldn't even need to muck with the permissions because root access anyway. Also, making files and folders with 777 and 666 is bad practice, you shouldn't make things world readable or writeable unless they need to be.
– Evan Teran
Feb 16 at 1:12
@ Evan Teran it's not good advice to run a program as root, that does not need to be root. The memory stick is only in for a little while, and it is not on a server. It's a matter of where you want to put the risk. I choose to put the risk on the memory stick rather than the system. Wayne@WayneSallee.com
– Wayne Sallee
2 days ago
Correction: I haven't put my user in the disk group. Wayne@WayneSallee.com
– Wayne Sallee
2 days ago
|
show 2 more comments
I did not want to run Virtualbox as root.
I did not want my user to be of the disk group, having full permissions to all disks.
So here is what I got to work:
Find out what sd the memory stick is. In the following instructions it's sdc
.
Unmount memory Stick
su -
chmod 666 /dev/sdc1
chmod 666 /dev/sdc
exit # Run the following command as regular user:
VBoxManage internalcommands createrawvmdk -filename usb.vmdk -rawdisk /dev/sdc
su - # Back as root again:
chmod 777 usb.vmdk
chmod 666 /dev/sdc
Attach usb.vmdk virtualbox machine
chmod 666 /dev/sdc
- Start virtualbox machine
After done, reset sdc1 permission for security:
chmod 660 /dev/sdc1
In the above you can see that I had to reset the permissions for the memory stick a few times, because it would get set back to root each time.
I'm using Mandriva Linux, but it should be about the same in Ubuntu
The permission fiddling here is very bad advice. First of all, you are doing it as root, so you don't really need to change the permissions to make those commands work. Secondly, it is better to add the appropriate user into the disk group so it isn't even necessary.
– Evan Teran
Feb 14 at 20:40
@ Evan Teran Have you even tried it? And yes the user is part of the disk group. This is the method that I still use to today with my own linux operating system. Wayne Sallee Wayne@WayneSallee.com
– Wayne Sallee
Feb 15 at 21:10
I didn't say it wouldn't work, I said it's not good advice. Regardless of the user's groups, if you are running the commands as root, you shouldn't even need to muck with the permissions because root access anyway. Also, making files and folders with 777 and 666 is bad practice, you shouldn't make things world readable or writeable unless they need to be.
– Evan Teran
Feb 16 at 1:12
@ Evan Teran it's not good advice to run a program as root, that does not need to be root. The memory stick is only in for a little while, and it is not on a server. It's a matter of where you want to put the risk. I choose to put the risk on the memory stick rather than the system. Wayne@WayneSallee.com
– Wayne Sallee
2 days ago
Correction: I haven't put my user in the disk group. Wayne@WayneSallee.com
– Wayne Sallee
2 days ago
|
show 2 more comments
I did not want to run Virtualbox as root.
I did not want my user to be of the disk group, having full permissions to all disks.
So here is what I got to work:
Find out what sd the memory stick is. In the following instructions it's sdc
.
Unmount memory Stick
su -
chmod 666 /dev/sdc1
chmod 666 /dev/sdc
exit # Run the following command as regular user:
VBoxManage internalcommands createrawvmdk -filename usb.vmdk -rawdisk /dev/sdc
su - # Back as root again:
chmod 777 usb.vmdk
chmod 666 /dev/sdc
Attach usb.vmdk virtualbox machine
chmod 666 /dev/sdc
- Start virtualbox machine
After done, reset sdc1 permission for security:
chmod 660 /dev/sdc1
In the above you can see that I had to reset the permissions for the memory stick a few times, because it would get set back to root each time.
I'm using Mandriva Linux, but it should be about the same in Ubuntu
I did not want to run Virtualbox as root.
I did not want my user to be of the disk group, having full permissions to all disks.
So here is what I got to work:
Find out what sd the memory stick is. In the following instructions it's sdc
.
Unmount memory Stick
su -
chmod 666 /dev/sdc1
chmod 666 /dev/sdc
exit # Run the following command as regular user:
VBoxManage internalcommands createrawvmdk -filename usb.vmdk -rawdisk /dev/sdc
su - # Back as root again:
chmod 777 usb.vmdk
chmod 666 /dev/sdc
Attach usb.vmdk virtualbox machine
chmod 666 /dev/sdc
- Start virtualbox machine
After done, reset sdc1 permission for security:
chmod 660 /dev/sdc1
In the above you can see that I had to reset the permissions for the memory stick a few times, because it would get set back to root each time.
I'm using Mandriva Linux, but it should be about the same in Ubuntu
edited 7 hours ago
answered May 11 '16 at 19:37
Wayne SalleeWayne Sallee
113
113
The permission fiddling here is very bad advice. First of all, you are doing it as root, so you don't really need to change the permissions to make those commands work. Secondly, it is better to add the appropriate user into the disk group so it isn't even necessary.
– Evan Teran
Feb 14 at 20:40
@ Evan Teran Have you even tried it? And yes the user is part of the disk group. This is the method that I still use to today with my own linux operating system. Wayne Sallee Wayne@WayneSallee.com
– Wayne Sallee
Feb 15 at 21:10
I didn't say it wouldn't work, I said it's not good advice. Regardless of the user's groups, if you are running the commands as root, you shouldn't even need to muck with the permissions because root access anyway. Also, making files and folders with 777 and 666 is bad practice, you shouldn't make things world readable or writeable unless they need to be.
– Evan Teran
Feb 16 at 1:12
@ Evan Teran it's not good advice to run a program as root, that does not need to be root. The memory stick is only in for a little while, and it is not on a server. It's a matter of where you want to put the risk. I choose to put the risk on the memory stick rather than the system. Wayne@WayneSallee.com
– Wayne Sallee
2 days ago
Correction: I haven't put my user in the disk group. Wayne@WayneSallee.com
– Wayne Sallee
2 days ago
|
show 2 more comments
The permission fiddling here is very bad advice. First of all, you are doing it as root, so you don't really need to change the permissions to make those commands work. Secondly, it is better to add the appropriate user into the disk group so it isn't even necessary.
– Evan Teran
Feb 14 at 20:40
@ Evan Teran Have you even tried it? And yes the user is part of the disk group. This is the method that I still use to today with my own linux operating system. Wayne Sallee Wayne@WayneSallee.com
– Wayne Sallee
Feb 15 at 21:10
I didn't say it wouldn't work, I said it's not good advice. Regardless of the user's groups, if you are running the commands as root, you shouldn't even need to muck with the permissions because root access anyway. Also, making files and folders with 777 and 666 is bad practice, you shouldn't make things world readable or writeable unless they need to be.
– Evan Teran
Feb 16 at 1:12
@ Evan Teran it's not good advice to run a program as root, that does not need to be root. The memory stick is only in for a little while, and it is not on a server. It's a matter of where you want to put the risk. I choose to put the risk on the memory stick rather than the system. Wayne@WayneSallee.com
– Wayne Sallee
2 days ago
Correction: I haven't put my user in the disk group. Wayne@WayneSallee.com
– Wayne Sallee
2 days ago
The permission fiddling here is very bad advice. First of all, you are doing it as root, so you don't really need to change the permissions to make those commands work. Secondly, it is better to add the appropriate user into the disk group so it isn't even necessary.
– Evan Teran
Feb 14 at 20:40
The permission fiddling here is very bad advice. First of all, you are doing it as root, so you don't really need to change the permissions to make those commands work. Secondly, it is better to add the appropriate user into the disk group so it isn't even necessary.
– Evan Teran
Feb 14 at 20:40
@ Evan Teran Have you even tried it? And yes the user is part of the disk group. This is the method that I still use to today with my own linux operating system. Wayne Sallee Wayne@WayneSallee.com
– Wayne Sallee
Feb 15 at 21:10
@ Evan Teran Have you even tried it? And yes the user is part of the disk group. This is the method that I still use to today with my own linux operating system. Wayne Sallee Wayne@WayneSallee.com
– Wayne Sallee
Feb 15 at 21:10
I didn't say it wouldn't work, I said it's not good advice. Regardless of the user's groups, if you are running the commands as root, you shouldn't even need to muck with the permissions because root access anyway. Also, making files and folders with 777 and 666 is bad practice, you shouldn't make things world readable or writeable unless they need to be.
– Evan Teran
Feb 16 at 1:12
I didn't say it wouldn't work, I said it's not good advice. Regardless of the user's groups, if you are running the commands as root, you shouldn't even need to muck with the permissions because root access anyway. Also, making files and folders with 777 and 666 is bad practice, you shouldn't make things world readable or writeable unless they need to be.
– Evan Teran
Feb 16 at 1:12
@ Evan Teran it's not good advice to run a program as root, that does not need to be root. The memory stick is only in for a little while, and it is not on a server. It's a matter of where you want to put the risk. I choose to put the risk on the memory stick rather than the system. Wayne@WayneSallee.com
– Wayne Sallee
2 days ago
@ Evan Teran it's not good advice to run a program as root, that does not need to be root. The memory stick is only in for a little while, and it is not on a server. It's a matter of where you want to put the risk. I choose to put the risk on the memory stick rather than the system. Wayne@WayneSallee.com
– Wayne Sallee
2 days ago
Correction: I haven't put my user in the disk group. Wayne@WayneSallee.com
– Wayne Sallee
2 days ago
Correction: I haven't put my user in the disk group. Wayne@WayneSallee.com
– Wayne Sallee
2 days ago
|
show 2 more comments
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f693719%2fhow-to-boot-from-a-usb-drive-in-virtualbox%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You can just open your USB, compress everything into an ISO file and boot it normally.
– dat tutbrus
Nov 4 '15 at 11:14
@Ravan - not to forget often users do not attach in gparted the property "boot" to the usb-stick. This is in menu 'partition' of gparted and there you can edit the flag resp. the label of the usb-stick and activate the parameter "boot".
– dschinn1001
Nov 13 '15 at 13:20