I need to create a raw disk image for use in a virtual machine, but I need to create the partitions before creating the file system or installing the operating system.
Can anyone describe a process to do this?
First create a blank raw disk image (25GB in this case):
Give it a partition table:
Mount it as a loopback device (the simplest way to define cylinders, heads, and sectors):
Check that it seems to be a valid block device:
When you're done you need to unloop the device (it will need unmapping and unmounting first):
Tested on Ubuntu 14.04.
The "hard" parts are: