Skip to contentSkip to conversation

Read-only file system with persistent storage

DISCUSSION Gary Thomas 7 participants 7 messages Jul 16, 2015 – Jul 23, 2015

lore
Share & tools
lore
#0 lore raw

I'd like to set up a system with a read-only root file system along with some persistent read-write storage. What are the [best] options in Poky/Yocto for this? Is there any support for some type of overlay file system?

Thanks for any ideas/pointers

Signature · 4 lines
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------
#1 lore raw

Hi Gary, I'm interested in that too. In my case I want to have a reset-to-factory-defaults-button on my device. The idea was use an readonly filesystem and, on top of it, a read-write filesystem. All modifications goes to top-half, once the RTFD button is pressed the top-half is formated and the system goes back to its instalattion.

I have no ideia about support for that on Yocto, I know of OverlayFS existence only. I think its possible but I don't know really how to do it, also never tried. I'm just fearing that dealing with OverlayFS on rootfs could be a headache. Anyway, take a look on this:
https://www.kernel.org/doc/Documentation/filesystems/overlayfs.txt

Best regards

- dhs

2015-07-16 8:36 GMT-03:00 Gary Thomas <[email protected]>:

Quoted 18 lines

I'd like to set up a system with a read-only root file system along with some persistent read-write storage. What are the [best] options in Poky/Yocto for this? Is there any support for some type of overlay file system?

Thanks for any ideas/pointers

--
------------------------------------------------------------
Gary Thomas | Consulting for the
MLB Associates | Embedded world
------------------------------------------------------------
--
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto

Signature · 2 lines
*"Do or do not. There is no try"*
  *Yoda Master*
#2 lore raw
In reply to Gary Thomas

Hi Gary,

Quoted 6 lines · Gary Thomas

I'd like to set up a system with a read-only root file system along with some persistent read-write storage. What are the [best] options in Poky/Yocto for this? Is there any support for some type of overlay file system?

Thanks for any ideas/pointers

I remember that back in my automotive days, one of my teams had to use Genivi's persistence component:

http://projects.genivi.org/persistence-management/

There are also git repositories over there. I can't comment on the code quality and stability, but this component is part of the Genivi reference platform (which technically doesn't mean anything), and there's at least 1 vehicle from a major OEM which uses this component on the roads. As usual, keep your eyes open for possible issues.

Kind regards,
Nikolay

#3 lore raw
In reply to Gary Thomas
Quoted 6 lines · Gary Thomas

I'd like to set up a system with a read-only root file system along with some persistent read-write storage. What are the [best] options in Poky/Yocto for this? Is there any support for some type of overlay file system?

Thanks for any ideas/pointers

Depends. NOR or NAND flash?

with NOR, you can store a squashfs rootfs into it, and then use another portion with jffs2 or ubifs for r/w capability. If you want to be able to change 'everything', you can use an overlay fs, this requires some fiddling with pivot_root and friends.

with NAND, you'd have to use a fault-tolerant filesystem to store the rootfs. Dunno if it's possible to store a squashfs as a volume into ubi. The rest is similar to NOR.

Kind regards,

Mike Looijmans
System Expert

TOPIC Embedded Products Eindhovenseweg 32-C, NL-5683 KH Best Postbus 440, NL-5680 AK Best
Telefoon: +31 (0) 499 33 69 79
Telefax: +31 (0) 499 33 69 70
E-mail: [email protected]
Website: www.topicproducts.com

Please consider the environment before printing this e-mail

#4 lore raw

Dear Mike Looijmans,

Quoted 2 lines · Mike Looijmans

with NAND, you'd have to use a fault-tolerant filesystem to store the rootfs. Dunno if it's possible to store a squashfs as a volume into ubi.

It is. See ubiblock,
http://www.linux-mtd.infradead.org/doc/ubi.html#L_ubiblock.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#5 lore raw
In reply to Gary Thomas

If you are using systemd you can simply create a separate writeable partition and then use the volatile_binds.bb recipe to map files or directories from the read only rootfs to the writable partition via bind mounts. If you are not using systemd you can do the same thing with sysVinit you'll just have to write your own recipe equivalent to volatile_binds.bb

This method works and the way volatile_binds is written it takes the default settings from the read only rootfs which is nice.

The only problem I've found is if you have a bind mount to a file you have to be careful not to delete the file or it will break the mount link.You'd be surprised how often you want to delete the file when you go to update it. Therefore I tend to use directories with volatile_binds.bb instead of individual files.

Matt S.

Quoted 23 lines

-----Original Message-----
From: [email protected] [mailto:yocto- [email protected]] On Behalf Of Gary Thomas
Sent: Thursday, July 16, 2015 4:37 AM
To: Yocto Project
Subject: [yocto] Read-only file system with persistent storage

I'd like to set up a system with a read-only root file system along with some persistent read-write storage. What are the [best] options in Poky/Yocto for this? Is there any support for some type of overlay file system?

Thanks for any ideas/pointers

--
------------------------------------------------------------
Gary Thomas | Consulting for the
MLB Associates | Embedded world
------------------------------------------------------------
--
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto

#6 lore raw

Am 21.07.2015 um 18:01 schrieb Matt Schuckmann:

Quoted 1 line

If you are using systemd you can simply create a separate writeable partition and then use the volatile_binds.bb recipe to map files or directories from the read only rootfs to the writable partition via bind mounts.

How should one use the volatile-binds.bb recipe? How can I configure which files, directories shall be bind mounted? Thanks

Quoted 32 lines

If you are not using systemd you can do the same thing with sysVinit you'll just have to write your own recipe equivalent to volatile_binds.bb

This method works and the way volatile_binds is written it takes the default settings from the read only rootfs which is nice.

The only problem I've found is if you have a bind mount to a file you have to be careful not to delete the file or it will break the mount link.You'd be surprised how often you want to delete the file when you go to update it. Therefore I tend to use directories with volatile_binds.bb instead of individual files.

Matt S.

Quoted 23 lines

-----Original Message-----
From: [email protected] [mailto:yocto- [email protected]] On Behalf Of Gary Thomas
Sent: Thursday, July 16, 2015 4:37 AM
To: Yocto Project
Subject: [yocto] Read-only file system with persistent storage

I'd like to set up a system with a read-only root file system along with some persistent read-write storage. What are the [best] options in Poky/Yocto for this? Is there any support for some type of overlay file system?

Thanks for any ideas/pointers

--
------------------------------------------------------------
Gary Thomas | Consulting for the
MLB Associates | Embedded world
------------------------------------------------------------
--
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto

Signature · 11 lines
Lukas Böhm                       fon:  ++49 351 26996-0
iseg Spezialelektronik GmbH      fax:  ++49 351 26996-21
Bautzner Landstr. 23             mail: [email protected]
D-01454 Radeberg OT Rossendorf   web:  www.iseg-hv.de

Geschäftsführer/Managing Director:
    Dr. Frank Gleisberg, Dr. Joachim Pöthig
Registergericht/Lower District Court:
    Amtsgericht Dresden HRB 16250
Umsatzsteuer-Identnummer / VAT Id:
    DE 812 50 89 42