I like to play with VirtualBox. So in this post I will show you how to install Kali Linux on a USB disk with VirtualBox which can be run both on VirtualBox and directly bootable.
Every change you made with VirtualBox (or direct access) will be stored on USB and can be accessed with Direct Access (or VirtualBox). It is awesome to use VirtualBox when you want to work beside another OS. And also awesome when you want to boot directly from Physical Computer.
The steps are very easy:
- Create a virtual hard drive pointing to the USB.
- Install Kali in VirtualBox as usual.
- The disk is ready!
Here you go. It is ready to fire!
Create a virtual hard drive
Here we are going to create a virtual disk (VMDK) that points to a physical drive. All the data is written in the physical drive and VirtualBox can directly access it.
- Create a terminal (or command prompt) with administrative privileges.
- Go to VirtualBox installation Directory
- If you are on Linux or MAC it is not necessary, but if you’re running Windows, you should do this step: C:\Program Files\Oracle\VirtualBox
- Attach your USB and find its physical driver number.
- On windows goto Disk Management and find the Disk Number (As an example Disk1 refers to your USB, so the number is 1)
- Create Virtual Drive with the following command:
- For Windows
VBoxManage internalcommands createrawvmdk -filename "C:\Users\<user_name>\VirtualBox VMs\<VM_folder_name>\<file_name>.vmdk" -rawdisk \\.\PhysicalDrive#
- For Linux:
VBoxManage internalcommands createrawvmdk -filename "</path/to/file>.vmdk" -rawdisk /dev/sda
- For Mac OS X:
VBoxManage internalcommands createrawvmdk -filename "</path/to/file>.vmdk" -rawdisk /dev/disk#
- For Windows
# sign is the disk number. Step 4 credits go to this link.
Install Kali in VirtualBox
This step is easy. You should start VirtualBox with administrative privileges. The only point is that attach created virtual disk to the new virtual machine as below:
Then start the virtual machine. It will ask to attach Kali ISO.
After attaching Kali ISO image, every thing is the default installation of Kali. Here are some screen shots from my installation:
That’s it. You may like to boot with real computer or with your VirtualBox.