I have 2 (relatively small) disk images for qemu (raw format) containing different filesystems (say fat and ext4).
I want to put them into an usb stick as two different partitions so that I can plug it in a pc and boot from there.
I could do it with fdisk and dd but that would require root access and manual intervention (this is going to be a frequent activity in the next months.
How can I automate the task? Can I avoid sudo and root access?
Currently the disk images are created during our continuous integration process and do not require root access or manual intervention but I cannot find a way to merge these two disks to satisfy this new requirement.
edit
What I need to automate is not the partition of an actual usb key, but the creation of a raw disk image that can be written into the usb key with a single sudo dd ...
. The disk image should already contains the partitions filled with the data (preserving permissions).
What I cannot grasp is why I should need root to write a raw disk image.