Gentoo Archives: gentoo-user

From: Bill Kenworthy <billk@×××××××××.au>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Creating an firmware image from a too large microSDcard...?
Date: Sat, 16 Jan 2016 09:53:43
Message-Id: 569A130E.6070400@iinet.net.au
In Reply to: Re: [gentoo-user] Creating an firmware image from a too large microSDcard...? by Neil Bothwick
1 On 16/01/16 17:27, Neil Bothwick wrote:
2 > On Sat, 16 Jan 2016 04:50:49 +0100, Meino.Cramer@×××.de wrote:
3 >
4 >> to post a firmware image of my embedded linux computer
5 >> to a friend I want to size it down.
6 >>
7 >> System wise I did that already (only the really necessary
8 >> stuff of Gentoo plus some configuration and addons related
9 >> to the embedded system)...the problem comes with the size of
10 >> the microSDcard I use: 32 GB....
11 >>
12 >> The microSDcard (source) has two partitions (boot + the rest).
13 >> The boot partition is the first partition and it is of a fixed
14 >> and tiny size. The second partition contains the "rest": Gentoo.
15 >> Currently the used space of this partition is also small.
16 >>
17 >> The image needs to be of a format, which makes
18 >> it possble to 'dd' it onto a microSDcard (target) and afterwards use
19 >> g/parted to resize/expand the second partition to the end
20 >> of the microSDcard to get all storage space available.
21 >
22 > Quick and kludgy. Partition an SD card of the correct size, rsync your
23 > data to it, then dd that card.
24 >
25 > Any other method you use will require you to have a smaller SD card to
26 > test the resultant image, so you may as well use that as the source and
27 > know it works.
28 >
29 >
30
31 It is possible to create a dd image of the whole SD card and mount it in
32 a loopback to repartition etc.
33
34 Mount it then shrink your existing file system (and probably the
35 partition too) to less than the required size, then recreate the dd
36 image to a size still less than the new sd card.
37
38 On the new card, dd it across until it errors off, then fix/expand the
39 partition and then the file system. You dont care if the end is missing
40 as long as your data is within the size needed.
41
42 BillK

Replies