Test booting from your USB device without rebooting your Linux PC

Let’s assume you want to test that your newly bootable USB device is indeed bootable. Here’s a way to do this without rebooting, using VirtualBox.

First plug your USB device. These days, chances are it will get mounted automatically. Unmount it; but don’t eject it (use the umount command as root in a terminal window, if need be).

In a terminal window, ensure you have read and write access to the device. For example, let’s assume my device is /dev/sdb:

[me@home ~]$ ls -l /dev/sdb*
brw-rw---- 1 root disk 8, 16 21 sept. 17:10 /dev/sdb
brw-rw---- 1 root disk 8, 17 21 sept. 16:50 /dev/sdb1

In this example, the device is writeable by group disk. So I’ll just make sure I am part of this group, logout, and log back in. If your situation is not this simple, or you don’t want to change your groups, you may, as a quick hack, run this command:

[root@home ~]$ chmod 666 /dev/sdb*

The above command will simply make the device writeable by anyone, including you ;) This change shouldn’t be permanent; it should automatically get reversed on next reboot.

OK, so now you have full control of the device. Next comes the step where you create a description of the device, for VirtualBox to use. Here’s the command:

[yves@home ~]$ VBoxManage internalcommands createrawvmdk -filename ~me/VirtualBox\ VMs/FLASH.vmdk -rawdisk /dev/sdb

Of course, change me with your real user name. Don’t forget the tilde: “~me” means “home directory of ‘me’”.

Finally, in VirtualBox, create a machine with the features you need. Choose the newly created FLASH.vmdk disk as the main disk to boot from. Start the machine. Done.

Ajouter un commentaire

Le code HTML est affiché comme du texte et les adresses web sont automatiquement transformées.

La discussion continue ailleurs

URL de rétrolien : http://yalis.fr/cms/index.php/trackback/19

Fil des commentaires de ce billet