# Create folders inside /mnt (w/o editing sierra\_git.bb)

**URL:** https://forum.legato.io/t/create-folders-inside-mnt-w-o-editing-sierra-git-bb/5203
**Category:** Legato Linux distribution (Yocto project)
**Created:** [May 21, 2020, 4:51pm UTC](https://forum.legato.io/t/create-folders-inside-mnt-w-o-editing-sierra-git-bb/5203 "2020-05-21T16:51:54Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![SantX27](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/santx27/32/935_2.png) [@SantX27](https://forum.legato.io/u/SantX27)
#### Post date: [May 21, 2020, 4:51pm UTC](https://forum.legato.io/t/create-folders-inside-mnt-w-o-editing-sierra-git-bb/5203/1 "2020-05-21T16:51:54Z")

</div>

Hi, I recently started using a mangOH WP46 as a testbench for a project which requires specific folders scattered in /. As an example, I’m missing /mnt/ramdisk. Is there any way to generate these folders during image compilation from a personal meta layer (like meta-custom) without messing with files inside meta-swi and meta-swi-extras?

---

<div class="post-metadata">

### Author: ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)
#### Post date: [May 22, 2020, 12:15am UTC](https://forum.legato.io/t/create-folders-inside-mnt-w-o-editing-sierra-git-bb/5203/2 "2020-05-22T00:15:08Z")

</div>

You can modify the init script to create folder

> [@Adding scripts to run at startup](https://forum.legato.io/t/adding-scripts-to-run-at-startup/2412/2):
>
> Hi jakebjorkekato, You have told that you had problem connecting to the internet as it was blocked by firewall and you were able to access after running the iptables rules you have mentioned. But we are not clear what actually you are looking for !? Your last sentence I wrote another script to looks incomplete, Have you missed out to provide any information by mistake here ? Regards, Muralidhara N.

---

<div class="post-metadata">

### Author: ![SantX27](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/santx27/32/935_2.png) [@SantX27](https://forum.legato.io/u/SantX27)
#### Post date: [May 22, 2020, 12:56pm UTC](https://forum.legato.io/t/create-folders-inside-mnt-w-o-editing-sierra-git-bb/5203/3 "2020-05-22T12:56:19Z")

</div>

Yes, but only on folders that are abstracted by overlayfs, but since /mnt and /opt are not overlays, I can’t write on them because the OS is contained in a squashfs. I don’t want to break the existing layout of /mnt overlaying it since there are a lot of legato specific things in there. I just want to make my folders inside those paths in a clean way, without extracting the cwe and without messing with Sierra Wireless specific metas.

---

<div class="post-metadata">

### Author: ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)
#### Post date: [May 22, 2020, 4:22pm UTC](https://forum.legato.io/t/create-folders-inside-mnt-w-o-editing-sierra-git-bb/5203/4 "2020-05-22T16:22:17Z")

</div>

I remember i can overlay on read only file system.  
For example,

mkdir /tmp/tmp\_usr\_lib;mkdir /tmp/tmp\_usr\_lib\_wr;

mount -t overlay overlay /usr/lib -o lowerdir=/usr/lib,upperdir=/tmp/tmp\_usr\_lib,workdir=/tmp/tmp\_usr\_lib\_wr;

Not sure if you can do the same.

---

<div class="post-metadata">

### Author: ![SantX27](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/santx27/32/935_2.png) [@SantX27](https://forum.legato.io/u/SantX27)
#### Post date: [May 22, 2020, 4:47pm UTC](https://forum.legato.io/t/create-folders-inside-mnt-w-o-editing-sierra-git-bb/5203/5 "2020-05-22T16:47:10Z")

</div>

I kinda solved the problem, by making a new recipe (called mountpoints) starting from sierra\_bit.bb but using my own folders and deleting all the sierra licenses and legato specific code, but when I add **IMAGE\_INSTALL += “mountpoints”** on top of mdm9x28-image.inc, I get the folders but the image is highly unstable, because it’s missing some busybox-related symlinks and it keeps panicking and restarting endlessly. On another note, yes, I could overlay /opt without any problems, but /mnt contains the overlays for /home, /dev and other locations in the system. If I mount on top of /mnt the system stop working properly since now it has no overlays working.

---

<div class="post-metadata">

### Author: ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)
#### Post date: [May 25, 2020, 2:04am UTC](https://forum.legato.io/t/create-folders-inside-mnt-w-o-editing-sierra-git-bb/5203/6 "2020-05-25T02:04:21Z")

</div>

how about this?

root@swi-mdm9x28-wp:~# mkdir /mnt/test  
mkdir: can’t create directory ‘/mnt/test’: Read-only file system  
root@swi-mdm9x28-wp:~#  
root@swi-mdm9x28-wp:~# mkdir /tmp/tmp\_mnt;mkdir /tmp/tmp\_mnt\_wr;  
root@swi-mdm9x28-wp:~#  
root@swi-mdm9x28-wp:~# cp -rf /mnt/legato/ /tmp/tmp\_mnt  
root@swi-mdm9x28-wp:~#  
root@swi-mdm9x28-wp:~# mount -t overlay overlay /mnt -o lowerdir=/mnt,upperdir=/  
tmp/tmp\_mnt,workdir=/tmp/tmp\_mnt\_wr;  
root@swi-mdm9x28-wp:~#  
root@swi-mdm9x28-wp:~# ls /mnt  
flash legato persist smack userrw  
root@swi-mdm9x28-wp:~#  
root@swi-mdm9x28-wp:~# mkdir /mnt/test  
root@swi-mdm9x28-wp:~#  
root@swi-mdm9x28-wp:~# ls /mnt  
flash legato persist smack test userrw

root@swi-mdm9x28-wp:~# legato version  
19.02.0\_cf7c704124f14adfeb3f8595be4b0772\_modified  
root@swi-mdm9x28-wp:~#  
root@swi-mdm9x28-wp:~# cm info  
Device: WP7607  
IMEI: 359779081234565  
IMEISV: 6  
FSN: VN730485080103  
Firmware Version: SWI9X07Y\_02.28.03.03 000000 jenki[254.838375] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:1 cur:0 tx) bc(rx:0 tx:2) mode:FIFO slv\_addr:0x3a MSTR\_STS:0x0c1300c8 OPER:0x00000090  
ns 2019/05/21 03:33:04  
Bootloader Version: SWI9X07Y\_[254.858904] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:1 cur:0 tx) bc(rx:0 tx:2) mode:FIFO slv\_addr:0x3a MSTR\_STS:0x0c1300c8 OPER:0x00000090  
02.28.03.03 000000 jenkins 2019/05/21 03:33:04  
MCU Version: 002.011  
PRI Part Number (PN): 9908958  
PRI Revision: 001.000  
Carrier PRI Name: GENERIC  
Carrier PRI Revision: 002.068\_000  
SKU: 1104301  
Last Reset Cause: Reset, User Requested  
Resets Count: Expected: 147 Unexpected: 12

---

<div class="post-metadata">

### Author: ![SantX27](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/santx27/32/935_2.png) [@SantX27](https://forum.legato.io/u/SantX27)
#### Post date: [May 25, 2020, 2:40pm UTC](https://forum.legato.io/t/create-folders-inside-mnt-w-o-editing-sierra-git-bb/5203/7 "2020-05-25T14:40:15Z")

</div>

Yeah, I guess that could work too. I instead chose to make a recipe that makes the folders I need and adding them to the image using build.sh. I will still put your answer as a solution, since it’s more straightforward. Also, I messed up with the IMAGE\_INSTALL, so that’s why the image was missing things. Thanks for the help!
