I have made great progress with my USB project so far, However I was wondering if there would be a way to DD multiple partitions into one Raw image file for redistribution. The following are the commands I have been using to achieve a full clone from usb to usb:
DD if=/dev/sd[x] status=progress | gzip > newredhat.raw.gz
however, the only issue with this, is that it copies the entirety of the USB stick, (meaning it would copy the volume as 28gb) and in some cases it doesn't work when trying to go to a smaller USB stick. I had tried doing the following to work around this :
dd if=/dev/sdb1 | dd if=/dev/sdb2 | dd if=/dev/sdb3 | gzip > newredhat.raw.gz
Which to my surprise worked, however I don't believe it is saving the file the way I would imagine it is. Is there any way that I can avoid copying the entire disk drive (SDB) and only copy the necesarry partitions SDB1, SDB2, and SDB3, in such a way that I save them to one image file, and then zcat that file to a new USB of variable size in order for it to then run?
Thanks for any and all help in advance!
ddthe partition table (usually the first 1 MB of the disk) andtarcontents individual partitions. The downside is, obviously, being impossible to store the backup in one file. – iBug Jul 26 '18 at 15:49dd if=… | dd if=… | dd if=… | …makes no sense. Only the lastddcan do something useful. – Kamil Maciorowski Jul 26 '18 at 16:34gdisk -l /dev/sdb. Add this information to your question by [edit]ing. – Kamil Maciorowski Jul 26 '18 at 16:43conv=noerror,sync for error safetyfor error safety: https://unix.stackexchange.com/a/144178/318461 - also think about the partition table, which you miss on the second command - consider this question: https://superuser.com/questions/738738/restoring-a-disk-image-with-dd – Cadoiz Jan 19 '21 at 13:16