Here the terminology, perhaps, trips me up a little. In the fdisk output above, it shows that the "disk" is (nominally) 4 GB - an intentionally small SD card. But only ~ 1.3 GB is allocated to partitions / filesystems (whichever is the correct term). That's the only part I believe I need to image to get the smallest snapshot; 1.3 GB. The structure may be easier to see with lsblk
So you are right, when I imaged sdc, without count I got a 4 GB image file - the whole thing. When I did sdc1 and sdc2 without count I got 2 separate images totaling about 1.3 GB. But 2 image files are messier to work with than 1, so I think I just want the first part of the disk that has been allocated to partitions / filesystems. Restoring a 1.3 GB image is likely going to be considerably faster than 4 GB irrespective of the blocksize. At least that is my thinking.
Code: Select all
$ lsblk /dev/sdc NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sdc 8:32 1 3.8G 0 disk +-sdc1 8:33 1 41.7M 0 part +-sdc2 8:34 1 1.2G 0 part
Technically I think there are some unalloacted sectors within that 1.3 GB, but it's a rather small percentage. I believe dd'ing the first 1,304,671,232 bytes in this example is enough to copy what Etcher created to another SD card cleanly. Of course, as I think you plan, I want to do some initial configuration and may need to expand sdc2 a little to get the starting point I want work from.
When I searched for information on the use of dd for this purpose I either got very specific examples, or seemingly complicated discussions. I'm hoping this approach is a balance between simplicity and enough generalization to work for many common cases, i.e. the combination of
- fdisk -l
- dd (with bs and count numbers copied from the fdisk output)
Writing this out helped me clarify my thinking - and hopefully may help others who want to image a (partially allocated) SD card. (Assuming the resize2fs_once process is bypassed as above.)
Cheers, and Thanks!