Sorry for the top post, I'm on my phone. 

I think partimage does what you want already. Clonezilla gives a (very 
slightly) friendlier front end, but I've not used either for several years... 


On 19 September 2016 17:49:44 BST, Colin Law <> wrote:
>On 19 September 2016 at 17:18, Robert McWilliam <>
>> On Mon, 19 Sep 2016, at 14:21, Colin Law wrote:
>>> I do a fair amount of work with SD cards and use dd to create an
>>> for backup or for burning onto other cards. If I burn an image from
>>> 8GB card onto a 16GB card then I get a card which is only half used.
>>> If I then make an image from that one then I get a 16GB image (of
>>> which only 8GB or less is partitioned) which is larger than it needs
>>> to be and also if I burn that onto another 8GB card then it fails as
>>> the card is not large enough (or at least it says it has failed, the
>>> card will in fact be ok).
>> You can copy a single partition by pointing dd at the partition
>> than the device, e.g. sda1 rather than sda. I expect that would
>> the same thing as  giving dd offset and size that you can get from
>> (but less likely to get those wrong).
>> Neither approach will give you an image that you can (reliably) put
>> onto a card with (just) dd. It won't include the partition table.
>Is not the partition table in the space before the first partition? So
>in the example I posted where I had
>Device     Boot  Start     End Sectors Size Id Type
>/dev/sdb1         8192  137215  129024  63M  c W95 FAT32 (LBA)
>/dev/sdb2       137216 4233215 4096000   2G 83 Linux
>is not the partition table in sectors 0 to 8191? So if I copy sectors
>0 to 2333215 that should include the partition table and all the
>partitions.  Is that not correct?
>> It
>> will work if the destination card is partitioned the same as the
>> and you write to the same offset, or if you've got a partition the
>> size and you update the offset to hit that, but otherwise you'd need
>> update the partition table (and other partitions) to make an
>> appropriately sized gap for it and then write to that.
>> I think it's better to look at what you're trying to do, and see if
>> is the right tool. I can understand wanting to use dd for archiving
>> backing up cards since it'll also catch things that have been deleted
>> lost to filesystem corruption that you can then (try to) recover once
>> you've noticed that something is missing. I'm less convinced it's a
>> idea going the other way; it causes the problems you're seeing when
>> sizes aren't the same and it means you're writing more to the cards
>> you need to. I think you'd be better to mount the image file and copy
>> the files across to the card.
>To do it that way I believe I would have to write a script to pick up
>the partition info from the original card, mount and copy the files in
>each partition, and save the partition info with the files. Then to
>restore it I would need a script to re-partition the new card and copy
>the files across to each partition.

Sent from my Android device with K-9 Mail. Please excuse my brevity.

Reply via email to