Continued from http://teknoarticles.blogspot.com.es/2016/12/start-using-whole-disk-images-with.html For security reasons, there may be the need of encrypting several partitions of volumes on your images. And you can have a pre-created image with that encryption on place, instead of having to do manually after boot. This can be done with guestfs and luks . The following script will show how to perform that encryption and mount it automatically: #!/usr/bin/env python import binascii import guestfs import os # remove old generated drive try: os.unlink("/tmp/overcloud-full-partitioned.qcow2") except: pass g = guestfs.GuestFS(python_return_dict=True) # import old and new images print("Creating new repartitioned image") g.add_drive_opts("/tmp/overcloud-full.qcow2", format="qcow2", readonly=1) g.disk_create("/tmp/overcloud-full-partitioned.qcow2", "qcow2", 10 * 1024 * 1024 * 1024) #10G g.add_drive_opts("/tmp/o...