Skip to contentSkip to conversation

Make one directory writeable

DISCUSSION Bhupendra Singh 4 participants 4 messages Feb 13, 2019 – Feb 14, 2019

lore
Share & tools
lore
#0 lore raw

Hello

I have built core-image-minimal with read only rootfs then now I want to make one directory (like /mnt) writable.

Is it possible to make one directory writeable in read only rootfs if yes ,please tell me how can I do same.

Bhupendra Singh

#1 lore raw

You can use overlayfs for this. You mount the overlayfs on top of your rootfs and then it appear like you have a writeable file system. In reality all the new stuff is written to another (writeable) file system.
If you dismount the overlayfs, the rootfs reverts back to its original state.
If you again mount the overlayfs, you get your modifications back.

Best Regards,
Ulf Samuelsson
+46 722 427 437

Quoted 13 lines

13 feb. 2019 kl. 08:21 skrev Bhupendra Singh <[email protected]>:

Hello
I have built core-image-minimal with read only rootfs then now I want to make one directory (like /mnt) writable. Is it possible to make one directory writeable in read only rootfs if yes ,please tell me how can I do same.

Bhupendra Singh

Signature · 4 lines
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto
#2 lore raw
In reply to Bhupendra Singh

Hi Bhupendra,

Quoted 7 lines · Bhupendra Singh

Hello

I have built core-image-minimal with read only rootfs then now I want to make one directory (like /mnt) writable.

Is it possible to make one directory writeable in read only rootfs if yes ,please tell me how can I do same.

This is not exactly yocto specific, general linux concepts apply. You can use a secondary, tertiary, ... partition or starage device and then mount that as read-write. But it always has to be a seperate filesystem. There is no way to make only one path of a given filesystem RW, it always means that the whole filesystem is writeable.

Greetz

Signature · 20 lines
———————————————
Josef Holzmayr
Software Developer Embedded Systems

Tel: +49 8444 9204-48
Fax: +49 8444 9204-50

R-S-I Elektrotechnik GmbH & Co. KG
Woelkestrasse 11
D-85301 Schweitenkirchen
www.rsi-elektrotechnik.de
———————————————
Amtsgericht Ingolstadt – GmbH: HRB 191328 – KG: HRA 170393
Geschäftsführer: Dr.-Ing. Michael Sorg, Dipl.-Ing. Franz Sorg
Ust-IdNr: DE 128592548 

_____________________________________________________________
Amtsgericht Ingolstadt - GmbH: HRB 191328 - KG: HRA 170363
Geschäftsführer: Dr.-Ing. Michael Sorg, Dipl.-Ing. Franz Sorg
USt-IdNr.: DE 128592548
#3 lore raw

As for the particular case of /mnt, on most images, /mnt is a symlink to /media, and /media is (on) a filesystem in RAM, so it's already writeable.

If the write does not need to persist across reboots, use a tmpfs mount.

If your real problem is that you cannot create anything in /mnt (or /media for modern users), the issue is that someone broke something in your image, because that should work out of the box.

Quoted 19 lines · Josef Holzmayr

Hi Bhupendra,

Quoted 7 lines · Bhupendra Singh

Hello

I have built core-image-minimal with read only rootfs then now I want to make one directory (like /mnt) writable.

Is it possible to make one directory writeable in read only rootfs if yes ,please tell me how can I do same.

This is not exactly yocto specific, general linux concepts apply. You can use a secondary, tertiary, ... partition or starage device and then mount that as read-write. But it always has to be a seperate filesystem. There is no way to make only one path of a given filesystem RW, it always means that the whole filesystem is writeable.

Greetz