# Flash partitions

**URL:** <https://forum.legato.io/t/flash-partitions/1991>\
**Category:** Legato Linux distribution (Yocto project)\
**Created:** [February 19, 2015, 7:09pm UTC](https://forum.legato.io/t/flash-partitions/1991 "2015-02-19T19:09:02Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![buzzag](https://avatars.discourse-cdn.com/v4/letter/b/f6c823/32.png) [@buzzag](https://forum.legato.io/u/buzzag)\
**Post date:** [February 19, 2015, 7:09pm UTC](https://forum.legato.io/t/flash-partitions/1991/1 "2015-02-19T19:09:02Z")

</div>

Hello all!  
I need to expand the flash partition size to fit my rootfs. I know I have to pass the command AT!APPPARTCHG, but I have no idea about the command syntax. Can anyone give the command details - its syntax, usage and examples if possible ?

Thanks!

---

<div class="post-metadata">

**Author:** ![amitchell](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/amitchell/32/68_2.png) [@amitchell](https://forum.legato.io/u/amitchell)\
**Post date:** [February 23, 2015, 6:25pm UTC](https://forum.legato.io/t/flash-partitions/1991/2 "2015-02-23T18:25:30Z")

</div>

Hi.

If you run the command as a query you should see something like:

`at!apppartchg?
Total APP partition size: 261886 kB
APPSBL,PAD,APPS,PAD,SYSTEM,PAD,USERDATA,PAD,USERAPP,PAD = 
768,50,20000,384,50000,300,38000,2560,149440,384`

That will list the sizes of the partitions. The one you care about for your rootfs is “SYSTEM”. Depending on how large it is you can steal some space from the subsequent partitions without too many consequences. e.g. increase size by 10MB …

```auto
AT!APPPARTCHG=768,50,20000,384,60000,300,38000,2560,139440,384
```

Some stuff you should be aware of:

1. This is destructive. If you move a boundary for a partition it will be deleted.
2. Be very careful to make sure the numbers add up. You don’t want to brick your device which is entirely possible.
3. Maybe you should try booting from NFS or SD card first. There are examples in the README for the Yocto build.

Regards,  
Andrew

---

<div class="post-metadata">

**Author:** ![buzzag](https://avatars.discourse-cdn.com/v4/letter/b/f6c823/32.png) [@buzzag](https://forum.legato.io/u/buzzag)\
**Post date:** [February 26, 2015, 12:59pm UTC](https://forum.legato.io/t/flash-partitions/1991/3 "2015-02-26T12:59:22Z")

</div>

Thank you very much! But I may have some problems… 😕

Can’t these partitions (such as USERDATA and USERAPP) be unified in a single one (rootfs + userdata + userapp)? For my application requires Java machine, my ROOTFS got a little bigger (something around 130MB), plus my data space.

I don’t know if these partitions make part of the android system scheme (maybe I’m talking trash, please correct me if I’m wrong) or it’s just an convenient partitioning, but comparing with the majors embedded linux solutions, the rootfs+data partition are always in same place.

In short, Can I make it in the same space?

Thanks again!

---

<div class="post-metadata">

**Author:** ![amitchell](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/amitchell/32/68_2.png) [@amitchell](https://forum.legato.io/u/amitchell)\
**Post date:** [February 26, 2015, 9:36pm UTC](https://forum.legato.io/t/flash-partitions/1991/4 "2015-02-26T21:36:41Z")

</div>

Hi.

You can’t collapse them into the same space, but you can steal as much space as you want from the others. The partitions are used as follows:

APPSBL - the bootloader. Leave this one alone  
APPS - kernel  
SYSTEM - rootfs  
USERDATA - We put the Legato framework here in some instances, but you don’t have to. You can reclaim all of this space if you like. As of 15.01 it is mounted as /mnt/legato.  
USERAPP - The big writable area for your use (mounted as /mnt/flash)

You could take space from USERDATA and USERAPP to add to your SYSTEM partition. If you want to be able to leave the option oppen to write the Legato app framework into its own partition then you should leave at least 10MB of space in USERDATA. For example, if you need 150MB in SYSTEM then you could run:

```auto
AT!APPPARTCHG=768,50,20000,384,150000,300,10000,2560,77440,384
```

Note - I haven’t tested these numbers. Double check everything!

As I mentioned before, you can also boot from SD, NFS or a USB stick until you have fine-tuned everything and are sure you have the numbers right.

Regards,  
Andrew

---

<div class="post-metadata">

**Author:** ![buzzag](https://avatars.discourse-cdn.com/v4/letter/b/f6c823/32.png) [@buzzag](https://forum.legato.io/u/buzzag)\
**Post date:** [March 2, 2015, 12:52pm UTC](https://forum.legato.io/t/flash-partitions/1991/5 "2015-03-02T12:52:12Z")

</div>

Thanks again, this is exactly what I need! 😃

---

<div class="post-metadata">

**Author:** ![buzzag](https://avatars.discourse-cdn.com/v4/letter/b/f6c823/32.png) [@buzzag](https://forum.legato.io/u/buzzag)\
**Post date:** [March 2, 2015, 2:00pm UTC](https://forum.legato.io/t/flash-partitions/1991/6 "2015-03-02T14:00:36Z")

</div>

Well, not everything went ok… ☹

[code]AT!UNLOCK=“A710”

> OK  
> AT!APPPARTCHG=768,50,19000,384,160000,300,10000,384,71000,0 (these numbers were based on my previous partition)  
> ERROR[/code]

No matter what I put after “AT!APPPARTCHG=”, I’m still getting ERROR response - even using the original partition numbers.

Do I need to unlock something else? (I’m using WP7104 module)

---

<div class="post-metadata">

**Author:** ![amitchell](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/amitchell/32/68_2.png) [@amitchell](https://forum.legato.io/u/amitchell)\
**Post date:** [March 3, 2015, 7:08pm UTC](https://forum.legato.io/t/flash-partitions/1991/7 "2015-03-03T19:08:09Z")

</div>

It’s not possible to have a size of 0 for any partitions. Do you get this error with other combinations?

---

<div class="post-metadata">

**Author:** ![buzzag](https://avatars.discourse-cdn.com/v4/letter/b/f6c823/32.png) [@buzzag](https://forum.legato.io/u/buzzag)\
**Post date:** [March 3, 2015, 8:30pm UTC](https://forum.legato.io/t/flash-partitions/1991/8 "2015-03-03T20:30:14Z")

</div>

You were right! Although my original partition had a block with 0 size (which I took as a base), I couldn’t set it again after typing the original numbers… Who knows why? 😮

Anyway, I set my partitions as follow and it worked fine! Now I have plenty of room for my Java machine and other stuff!

[code]  
AT!UNLOCK=“A710”

> OK  
> AT!APPPARTCHG=768,50,19000,384,160000,300,10000,383,71000,1  
> OK [/code]

After erasing and flashing…

`
Filesystem Size Used Available Use% Mounted on
/dev/root 156.8M 132.8M 24.0M 85% /
/dev/mtdblock4 72.0M 2.3M 69.7M 3% /mnt/flash
/dev/mtdblock3 10.5M 1.5M 9.0M 14% /mnt/legato
/dev/mtdblock5 5.3M 2.8M 2.4M 53% /mnt/userrw
unionfs 72.0M 2.3M 69.7M 3% /etc
unionfs 72.0M 2.3M 69.7M 3% /data`

Thank you very much!!!

---

<div class="post-metadata">

**Author:** ![rio99](https://avatars.discourse-cdn.com/v4/letter/r/d78d45/32.png) [@rio99](https://forum.legato.io/u/rio99)\
**Post date:** [January 9, 2017, 11:02am UTC](https://forum.legato.io/t/flash-partitions/1991/9 "2017-01-09T11:02:20Z")

</div>

Hi, I have problem executing `AT!UNLOCK="A710"` in order to resize rootfs, it responds `ERROR`, how can I unlock my device? Please help.

---

<div class="post-metadata">

**Author:** ![raf](https://avatars.discourse-cdn.com/v4/letter/r/848f3c/32.png) [@raf](https://forum.legato.io/u/raf)\
**Post date:** [January 18, 2017, 11:03pm UTC](https://forum.legato.io/t/flash-partitions/1991/10 "2017-01-18T23:03:51Z")

</div>

Hi @rio99,

For AR755x and WP targets, I believe the command is `AT!ENTERCND="A710"`

Cheers,  
Raf
