On 16/01/16 17:27, Neil Bothwick wrote:
> On Sat, 16 Jan 2016 04:50:49 +0100, meino.cra...@gmx.de wrote:
> 
>> to post a firmware image of my embedded linux computer
>> to a friend I want to size it down.
>>
>> System wise I did that already (only the really necessary
>> stuff of Gentoo plus some configuration and addons related
>> to the embedded system)...the problem comes with the size of
>> the microSDcard I use: 32 GB....
>>
>> The microSDcard (source) has two partitions (boot + the rest).
>> The boot partition is the first partition and it is of a fixed
>> and tiny size. The second partition contains the "rest": Gentoo.
>> Currently the used space of this partition is also small.
>>
>> The image needs to be of a format, which makes
>> it possble to 'dd' it onto a microSDcard (target) and afterwards use
>> g/parted to resize/expand the second partition to the end
>> of the microSDcard to get all storage space available.
> 
> Quick and kludgy. Partition an SD card of the correct size, rsync your
> data to it, then dd that card.
> 
> Any other method you use will require you to have a smaller SD card to
> test the resultant image, so you may as well use that as the source and
> know it works.
> 
> 

It is possible to create a dd image of the whole SD card and mount it in
a loopback to repartition etc.

Mount it then shrink your existing file system (and probably the
partition too) to less than the required size, then recreate the dd
image to a size still less than the new sd card.

On the new card, dd it across until it errors off, then fix/expand the
partition and then the file system.  You dont care if the end is missing
as long as your data is within the size needed.

BillK



Reply via email to