good

Friday, July 31, 2009

virtualbox usb for linux

Ubuntu9.04 today 1G install to the USB on its own, but each time in order to use Ubuntu USB and switched systems, it is the trouble could not bear to do, so think of a way, I hope from the VirtualBox boot from USB. But unfortunately, in VirtualBox by F12 keys out of the start menu, in addition to the hard disk to start from the outside, leaving only the "Floppy", "CD-ROM", "LAN", only to start from USB. In other words, VirtualBox does not support USB devices directly to start.

VirtualBox manual query to find another to replace the Law: The virtual USB device into a virtual hard drive, as if, VirtualBox can, through the virtual hard disk to start the!
VirtualBox manual: VirtualBox main interface / Help / Contents, or directly by the VirtualBox open F1.

About this article more relevant details please see the VirtualBox manual: Sun VirtualBox ® / Advanced topics/9.10. Using a raw host hard disk from a guest, which is described in detail a variety of different "host / virtual" system solution portfolio environment.

A first for some combination of my own environment:
Host system: fedora 10.
Virtual System: Ubuntu USB.
VirtualBox: v2.2.2
USB device: / dev / sdb
marco.chan: the account number belonging to vboxusers group of / dev / sdb useful r + w permissions.
Virtual Hard Disk path: ~ / .VirtualBox / HardDisks /

Second, again for a few things to note:
1, virtualbox your account to be able to read and write USB device, or can not add the virtualbox virtual hard disk.
2, to identify your USB device is which? Use df or fdisk can see that.

First, view the USB devices
Citations citations
[marco.chan @ fedora ~] $ sudo fdisk-l
Omitted from the above ...
Disk / dev / sdb: 1000 MB, 1000341504 bytes
255 heads, 63 sectors / track, 121 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0004e319
Omitted the following ...


Second, view the USB device properties, as well as add to the current account rw permissions.
Citations citations
[marco.chan @ fedora ~] $ ls-l / dev / sdb # See / dev / sdb property
brw-rw ---- 1 root disk 8, 16 2009-05-13 14:34 / dev / sdb

Citations citations
[marco.chan @ fedora ~] $ sudo chmod o + rw / dev / sdb # to add this account marco.chan attributes rw


Third, for USB devices create a virtual hard disk image.
Citations citations
[marco.chan @ fedora ~] $ VBoxManage internalcommands createrawvmdk-filename ~ / .VirtualBox / HardDisks / linuxhobbyUsb.vmdk-rawdisk / dev / sdb-register
VirtualBox Command Line Management Interface Version 2.2.2
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

RAW host disk access VMDK file / home / marco.chan / .VirtualBox / HardDisks / linuxhobbyUsb.vmdk created successfully.
See the above message that the virtual hard disk image file has been built! This is the image file just to connect, simple to understand, is a ln-s file, and will not "~ / .VirtualBox / HardDisks /" under the actual data, so a manual "which will not contain any actual data, as this will all be stored on the physical dis. "
~ / .VirtualBox / HardDisks / linuxhobbyUsb.vmdk: the preservation of the virtual hard disk image path, based on the actual situation of their own change, but the parent directory *. vmdk must be able to read and write.
/ dev / sdb: This is your USB devices, according to the actual circumstances of the case.

To determine whether, as the above tips, as has been established.
Citations citations
[marco.chan @ fedora ~] $ ls-l .VirtualBox / HardDisks /
total 5170244
-rw ------- 1 marco.chan marco.chan 1171292672 2009-04-14 21:15 CentOS5.vdi
-rwxrwxrwx 1 marco.chan marco.chan 994091520 2009-03-23 12:42 disk_windows.vdi
-rw ------- 1 marco.chan marco.chan 3123741184 2009-05-13 14:29 Fedora10.vdi
-rw ------- 1 marco.chan marco.chan 532 2009-05-13 14:56 linuxhobbyUsb.vmdk # is the East, only the size of 532 bytes.


Fourth, the increase in a system in VirtualBox.
In the establishment of a virtual hard drive when, select the existing virtual hard disk, that is just created linuxhobbyUsb.vmdk, the following chart:


Fifth, the test results ...

Ubuntu can see the normal boot from USB.

Note:
Plug USB devices every time after, / dev / sdx attributes will be restored, so it is necessary each time sudo chmod o + rw / dev / sdx (x in accordance with the actual environment), the other one-time solution may be as follows: the current user is added to the disk group, but will increase the risk of specific practices, that in accordance with the actual needs of their own may be.
My approach: the establishment of a alisa, so much more convenient!

No comments:

Post a Comment