Browsed by
Category: Technical

Using a physical drive/raw drive access with Virtualbox

Using a physical drive/raw drive access with Virtualbox

This comes from the good article here, or in the VirtualBox documentation.

Virtualization has been a tremendous help to developers such as myself. It keeps us from having to keep a pile of hard drives/machines all running different operating systems. And while this is great, there are some times when you might want to use a raw hard drive. For example, if you pull a hard drive out of an existing system and want to keep the OS/data intact but use it as a virtual machine inside another host OS.

Well, you can set up VirtualBox to use a physical hard drive inside a VM. This method is called “raw hard disk access.” This allows you to mount or boot a secondary hard drive or external USB as your storage device inside the VM.

Warning: Do not attempt to mount or boot the partition that runs the host OS with a VM, as that can lead to severe data corruption. And no matter which drive or partition you want to mount, it’s always a good idea to back up any existing data on it before continuing.

Creating the Virtual Machine:

You’ll first want to create a virtual machine within the VirtualBox GUI. Choose all options like normal, but when asked about the virtual hard drive, select Do not add a virtual hard drive.

Next, you’ll need to find the path and drive number of the physical drive you’d like to mount:

In Windows, open Disk Management. You’ll see the associated drive numbers on the left and will identify them later as PhysicalDrive0, PhysicalDrive1, etc.

In Linux, run the following command: sudo fdisk -l. You’ll see a listing of the partitions. Make note of the desired drive in the format of dev/sda0, dev/sda1, etc.

In Mac OS X, use the following command: diskutil list. You’ll see a listing of the partitions. Make note of the desired drive in the format of /dev/disk0, /dev/disk1, etc.

Now open a command prompt on your OS. If you’re using Windows as the host OS you will also need to go to the root directory of VirtualBox using the following command: cd C:\Program Files\Oracle\VirtualBox

Creating the VirtualBox Hard Drive:

Now you can run the command to create the virtual hard drive file that points to your desired physical drive. For each of the following examples ensure that you input the desired names between the arrows and replace the number or pound sign with your desired drive number.

For Windows:
You often must be administrator to run this command. Make sure your cmd.exe is running as administrator. This also means you must start VirtualBox as administrator to use these drive links.

VBoxManage internalcommands createrawvmdk -filename "C:\Users\\VirtualBox VMs\\.vmdk" -rawdisk \\.\PhysicalDrive#

For Linux:

VBoxManage internalcommands createrawvmdk -filename ".vmdk" -rawdisk /dev/sda

For Mac OS X:

VBoxManage internalcommands createrawvmdk -filename ".vmdk" -rawdisk /dev/disk#

This VMDK will be a very small file that simply points to your physical drive. Now you can attach the VMDK to your VM. To do so, open the VirtualBox GUI, select the desired VM, click Settings, clickStorage, click Add Hard Disk button, select Choose existing drive, and then select the VMDK file you just created.

AI Downs Expert Human Fighter Pilot in Dogfight Simulations. Every Time.

AI Downs Expert Human Fighter Pilot in Dogfight Simulations. Every Time.

It is not just that AI’s are doing complex tasks, it’s that they increasingly doing complex evaluative tasks better than the best humans in the whole world. These AI’s can be written by a few (or just one) persons using off-the-shelf compute. This makes it available to almost anyone – at prices far below the price of an average yearly employee salary.

‘A pilot A.I. developed by a doctoral graduate from the University of Cincinnati has shown that it can not only beat other A.I.s, but also a professional fighter pilot with decades of experience. In a series of flight combat simulations, the A.I. successfully evaded retired U.S. Air Force Colonel Gene “Geno” Lee, and shot him down every time. In a statement, Lee called it “the most aggressive, responsive, dynamic and credible A.I. I’ve seen to date.”‘

There’s a lot going on here. A computer should be able to defeat a human pilot due to its lack of concern about excessive G forces and other ‘wet-ware’/human factors. It can take advantage of the full capabilities of our modern strike craft (such as sustained dozen+ G turns) without an concerns of blacking out or loss of cognitive powers.

But there are other serious considerations.

Ease of Creating Systems better than the Best

We see that a single doctoral graduate at a public university was able to create something from commercially available hardware using well published/studied fuzzy logic algorithms that is able to beat some of the world’s best pilots. Consistently. With a little work, in theory, this could be plugged into a real jet and it could take out a good portion of the US, or any other, Air Force. It’s not science fiction – it’s doable by anyone in the world today with the desire and a jet. That puts this easily in the realm of all the superpowers, and even into the hand of a number of 2nd world dictatorships. The compute power, the algorithms, and everything except for the jet are available to you and I today.

The logical response is to then develop AI’s that can fight the other AI’s. This leads to an arms race where humans are not even a part of outside of the tricky work of training and writing the statistical training for the AI’s. Now we have autonomous weapons of war, armed for combat, fighting each other in which people would no longer be able to compete against. The ramifications of this are somewhat staggering – all the way up to a SkyNet style apocalypse. I would recommend the book “Killing without Heart” by Shane Riza for more on this topic.

Social impact

In just the last few years, we’ve seen the rise of IBM’s Deep Blue ravage Jeopardy and defeat chess grand masters. Google AI defeated the Go world champion numerous times. On the commercial front, the rise of Siri/Google voice and other systems that use AI techniques to recognize speech and context get better and better each day. Self driving cars are already becoming a reality and may replace all taxi systems. The US Postal system already uses machines that operate on 30,000 letters per hour (8 letters/second) and have eliminated rooms full of people. What’s surprising is that a lot of these feats are done with machines that only cost about the salary of a single employee for a year.

The ever increasing pace shows us this is becoming widespread and is rapidly being adopted by wide sections of industry. Cloud companies are already in place selling the compute for pennies (Google I/O just announced it is releasing it’s AI systems for super-low prices of just $10/mo). As it replaces big pieces of our day to day lives, it is going to be a profound impact on our society – much like the industrial revolution. It’s not that we can (or should?) stop this development, but these technologies are going to have an even bigger impact than the internet. With that, there are a lot of things to considered with each new development if we wish to avoid to social disasters that plagued the late 1800’s and early 1900’s. It would really be good for us to start thinking about these issues before they become serious problems.

Machine Morals

To that end, we see people already working on imbuing machine learning with morals. We got our first view of how wrong things can go when Microsoft had to shut down it’s Twitter AI Tay after just 24 hours when it started spouting racism, denied the Holocaust, and worse. We also saw a AI controlled robot mysterious escape from a lab – twice. We cannot ignore that these systems will do unpredictable and unexpected things.

So, in the end, we have massively trans-formative technology entering our society. It’s probably a good idea to realize these things are not ‘if’, but ‘when’ realities that will come in our lifetimes. Maybe we should start talking about how we want to live with them in the new world it will create.

 

The Blackbird from The Mill completely blows me away as a concept

The Blackbird from The Mill completely blows me away as a concept

The Blackbird is the world’s first fully adjustable car rig that cannot only alter its chassis to match the precise length and width of almost any car, but its looks as well. Using CGI, the car rig can be re-skinned to look like any car, and its electric motor can be programmed to emulate the driving characteristics of the subject car, too. Automotive content producers no longer need the physical vehicle for a shoot as the Blackbird is a do-it-all-rig.

Practice your coding skills

Practice your coding skills

For those of us that work in the industry, one of the difficult parts about working in high tech is constantly keeping on top of all the new developments and technology.

One of the things I’ve noticed after you get a lot of years of work under your belt is that you naturally start specializing into certain areas. These specializations are good in themselves, but often they utilize only slivers of the original breadth of computer science, algorithms, and data structures. If one is not careful, you can lose that breadth that is essential to your adaptability.

LeetCode is a great website with literally hundreds of coding problems that can help you brush up on your algorithms, data structures, and coding skills.  Give it a whirl!

‘Audibilization’ of sorting algorithms

‘Audibilization’ of sorting algorithms

Visualization and “audibilization” of 15 Sorting Algorithms in 6 Minutes.
Sorts random shuffles of integers, with both speed and the number of items adapted to each algorithm’s complexity.
The algorithms are: selection sort, insertion sort, quick sort, merge sort, heap sort, radix sort (LSD), radix sort (MSD), std::sort (intro sort), std::stable_sort (adaptive merge sort), shell sort, bubble sort, cocktail shaker sort, gnome sort, bitonic sort and bogo sort (30 seconds of it).

Google more information via the “Sound of Sorting”.

CMake with compilers that need custom parameters

CMake with compilers that need custom parameters

When using CMake on non-GCC/non-Microsoft compilers – you often run into interesting problems. Especially true for embedded devices/cross-compilers.

One thing that can bite you is the fact that CMake requires the compiler to pass a ‘smoke’ test. Unfortunately, if there are required parameters for your compiler, the smoke test part will fail.

There are a few ways to solve this, the ‘recommended’ way seems to be via the CMAKE_FORCE_C_COMPILER/CMAKE_FORCE_CXX_COMPILER flags. This allows you to tell CMake what the compiler is and pass the smoke test.

CMAKE_FORCE_C_COMPILER(/usr/mycc/cxint86 GNU)
CMAKE_FORCE_CXX_COMPILER(/usr/mycc/cxxint86 GNU)

Here are the docs for more information
https://cmake.org/Wiki/CMake_Cross_Compiling#The_toolchain_file

Siggraph 2015 paper – Dynamic Skin Microgeometry

Siggraph 2015 paper – Dynamic Skin Microgeometry

Generating photo-realistic faces has long been a holy grail for rendering. It’s the combination of a number of difficult problems – eyes, skin, hair, etc. These guys demonstrate a simple, innovative new technique for mimicking the complex skin structures that occur when a character makes different faces. They simulate these ‘micro-structures’ by using anisotrophic bluring/sharpening of facial textures. Good for both realtime and off-line techniques.