Creating and flashing image to Android device
Android fsutils (on ubuntu) comes with tools you need. You can also find them on GitHub. You need: simg2img, simg2simg, img2simg, make_ext4fs, and some terminal knowledge.

sudo simg2simg ./data.img ./data.raw.img
This gives you an image that can be mounted on Linux. To mount it, create an empty folder, then issue command...
sudo mount -t ext4  -o loop ./data.raw.img [new_folder_name]/
You can the find all the files in the folder you created. When you're done with the changes you want to make. Use this to make an Android image for fastboot.
sudo make_ext4fs -s -l [size_of_partition_in_bytes] -a data ./data data_new.img
The output will be the file data_new.img. Then you just use fastboot to flash like you normally would.