# Large SDIMG File

**URL:** https://hub.mender.io/t/large-sdimg-file/266
**Category:** General Discussions
**Created:** [February 28, 2019, 2:17pm UTC](https://hub.mender.io/t/large-sdimg-file/266 "2019-02-28T14:17:14Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![DonalHEmb](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/donalhemb/32/75_2.png) [@DonalHEmb](https://hub.mender.io/u/DonalHEmb)
#### Post date: [February 28, 2019, 2:17pm UTC](https://hub.mender.io/t/large-sdimg-file/266/1 "2019-02-28T14:17:14Z")

</div>

Hi There,  
Any suggestions on how to speed up the flashing of a large SDIMG file? I’ve got a 14GB image for my RPi3 based system, and it’s taking much too long to flash the SD cards.  
If I was to reduce the root partition size, is there some way to expand the two root partitions upon first boot?  
Cheers,  
Donal

---

<div class="post-metadata">

### Author: ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)
#### Post date: [February 28, 2019, 2:30pm UTC](https://hub.mender.io/t/large-sdimg-file/266/2 "2019-02-28T14:30:39Z")

</div>

> If I was to reduce the root partition size, is there some way to expand the two root partitions upon first boot?

Typically you can only re-size and expand the last partition. So a simple way of reducing the SDIMG file size is to lower the DATA\_PART\_SIZE to minimum and expand that on boot.

Other optimization is to work with sparse files, e.g with:

> **[GitHub - intel/bmap-tools: BMAP Tools](https://github.com/intel/bmap-tools)**
>
> BMAP Tools. Contribute to intel/bmap-tools development by creating an account on GitHub.

---

<div class="post-metadata">

### Author: ![DonalHEmb](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/donalhemb/32/75_2.png) [@DonalHEmb](https://hub.mender.io/u/DonalHEmb)
#### Post date: [February 28, 2019, 2:40pm UTC](https://hub.mender.io/t/large-sdimg-file/266/3 "2019-02-28T14:40:19Z")

</div>

Thank you, will look into the BMAP tools.

---

<div class="post-metadata">

### Author: ![DonalHEmb](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/donalhemb/32/75_2.png) [@DonalHEmb](https://hub.mender.io/u/DonalHEmb)
#### Post date: [February 28, 2019, 3:34pm UTC](https://hub.mender.io/t/large-sdimg-file/266/4 "2019-02-28T15:34:28Z")

</div>

@mirzak bmap-tools has worked a treat, greatly reducing the flash time, thank you! Also, I hadn’t realised that the generation of the bmap files for the various yocto build output files was already enabled - is this a mender or yocto feature?

---

<div class="post-metadata">

### Author: ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)
#### Post date: [February 28, 2019, 4:03pm UTC](https://hub.mender.io/t/large-sdimg-file/266/5 "2019-02-28T16:03:41Z")

</div>

Glad it worked out. It is a Yocto feature

---

<div class="post-metadata">

### Author: ![mvargasevans](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mvargasevans/32/402_2.png) [@mvargasevans](https://hub.mender.io/u/mvargasevans)
#### Post date: [March 26, 2020, 10:59am UTC](https://hub.mender.io/t/large-sdimg-file/266/6 "2020-03-26T10:59:56Z")

</div>

Dear community,

I wanted to drop my 2 cents here by reporting results.  
bmap-tools is indeed faster.

Please proceed with the repo indicated or in ubuntu:  
sudo apt-get install bmap-tools

Make sure that your device is connected and present in the /dev partition and both files, the raw image and the .bmap file are in the same folder.

I tested with a RaspberryPi3, and after .rpi-boot it is necessary to umount any existing partitions except for /dev/sdb (in my case)

Then proceed:

```
mvargasevans@X1:~//mender-builder$ sudo bmaptool copy ./development.rpi-sdimg /dev/sdb
bmaptool: info: discovered bmap file './development.rpi-sdimg.bmap'
bmaptool: info: block map format version 2.0
bmaptool: info: 1661952 blocks of size 4096 (6.3 GiB), mapped 606924 blocks (2.3 GiB or 36.5%)
bmaptool: info: copying image 'development.rpi-sdimg' to block device '/dev/sdb' using bmap file 'development.rpi-sdimg.bmap'
bmaptool: WARNING: failed to enable I/O optimization, expect suboptimal speed (reason: cannot switch to the 'noop' I/O scheduler: [Errno 22] Invalid argument)
bmaptool: info: 100% copied
bmaptool: info: synchronizing '/dev/sdb'
bmaptool: info: copying time: 7m 36.4s, copying speed 5.2 MiB/sec

```

Some info from the documentation.  
[https://www.yoctoproject.org/docs/2.3/dev-manual/dev-manual.html#flashing-images-using-bmaptool](https://www.yoctoproject.org/docs/2.3/dev-manual/dev-manual.html#flashing-images-using-bmaptool)

There is an issue with my I/O, but that was already faster for a 7 GB image.

---

<div class="post-metadata">

### Author: ![tpiepho](https://avatars.discourse-cdn.com/v4/letter/t/e9a140/32.png) [@tpiepho](https://hub.mender.io/u/tpiepho)
#### Post date: [March 27, 2020, 8:44pm UTC](https://hub.mender.io/t/large-sdimg-file/266/7 "2020-03-27T20:44:14Z")

</div>

bmap-tools can also directly flash a compressed image file without decompressing the entire file first.

So it’s possible to make a sdimg, then copy the compressed sdimg and bmap file into the sdimg (by loopback mounting a partition on it). Since it will compress greatly the copy of the image can fit inside the image itself.

Then the sd image with the compressed image inside it can be used to boot the device via an SD card slot and then use bmap-tool to reflash the onboard eMMC quickly.

---

<div class="post-metadata">

### Author: ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)
#### Post date: [March 27, 2020, 9:21pm UTC](https://hub.mender.io/t/large-sdimg-file/266/8 "2020-03-27T21:21:27Z")

</div>

Great to see that you are sharing you experiences and how you can optimize the workflows.

Utilization of bmap and similar tools to speed provisioning (which is very important when in a production line) devices would be great content for a tutorial on our [Tutorial](https://hub.mender.io/c/tutorials/17) section if someone is up for writing something a bit more detailed.
