A quick command to clone a SD card (not tested on flash drive but should work):
Note: Your iso image will be as large as your SD card/Flash drive. View the Compressed Clone Image section below if you need a smaller file.
cat /dev/sdc/ > /home/username/Downloads/backup.iso
Quick command to clone an ISO file back to the SD card:
sudo sh -c 'cat /home/username/Downloads/backup.iso > /dev/sdb; sync'
If you don’t know the device location then run this command to find your device:
Compressed Clone Image
Command to create compressed image:
dd if=/dev/sdc status=progress | gzip -c > /home/username/Downloads/backup.img.gz
Command to put image on sd card or flash drive:
gunzip -c /home/username/Downloads/backup.img.gz | dd of=/dev/sdc status=progress
When testing the above commands to put the image back onto the SD card or flash drive I kept getting a permission error.
I ran this command to drop into the root shell:
**Use at your own risk!
When the copy is complete type exit