Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
running root on ro
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
sligo
Tux's lil' helper
Tux's lil' helper


Joined: 17 Oct 2011
Posts: 93

PostPosted: Tue Mar 04, 2014 12:10 pm    Post subject: running root on ro Reply with quote

I have a system that runs headless without a keyboard and does only on simple task after booting up.

What would be best practice to set up the system in a way it would not get damaged when pulling the plug only without shutting down? Is there a way to migrate a running system into some sort of Live-Image like state?
Back to top
View user's profile Send private message
SirRobin2318
Apprentice
Apprentice


Joined: 24 Apr 2004
Posts: 241
Location: Strasbourg, france.

PostPosted: Tue Mar 04, 2014 12:28 pm    Post subject: Reply with quote

Yes there is, you can have a ro root, but parts of it have to be mounted on temporary file systems to get a functioning system:

http://www.linuxfromscratch.org/hints/downloads/files/readonly_rootfs.txt
https://wiki.debian.org/ReadonlyRoot

You'll have to think about being able to remount it as rw to do some updates from time to time.
Back to top
View user's profile Send private message
Telemin
l33t
l33t


Joined: 25 Aug 2005
Posts: 753
Location: Glasgow, UK

PostPosted: Tue Mar 04, 2014 12:28 pm    Post subject: Reply with quote

Hi there,

If you are referring to having a livecd-esque system you could look at UnionFS / casper. UnionFS is the older, probably better known way to transparently overlay ro and rw filesystems. I have no practical experience with casper other than to know it is the system ubuntu uses for its persistent liveusb feature.

Otherwise, if you know you are only going to be writing logs then you could go a slightly different route. Mount root ro, and then provide a writeable (ramdisk?) mount for anything that needs to be writable, e.g /var/tmp /var/log.

Take a look here maybe for inspiration on that front: https://sites.google.com/site/linuxpendrive/rorootfs


-telemin-
_________________
The Geek formerly known as -Freestyling-
When you feel your problem has been solved please add [Solved] to the topic title.
Please adopt an unanswered post
Back to top
View user's profile Send private message
sligo
Tux's lil' helper
Tux's lil' helper


Joined: 17 Oct 2011
Posts: 93

PostPosted: Tue Mar 04, 2014 1:14 pm    Post subject: Reply with quote

Thanks for your replies. Its not a rescue system and its not on USB. The system is currently running on odroid arm machine but its running in a normal setup. Its only purpose is to play a stream with cvlc. Its more or less a simple stereo setup. I don't need it to run during nights or if i am not at home. There is not even a need for sshd running, since i don't log into it.

I've read the Debian link and it seems its easier then i thought. I'll try to mount /var/log /var/run /tmp etc. into ramdisk. Hopefully that does the trick and keeps it from breaking the system on the long run.
Back to top
View user's profile Send private message
Telemin
l33t
l33t


Joined: 25 Aug 2005
Posts: 753
Location: Glasgow, UK

PostPosted: Tue Apr 01, 2014 2:52 pm    Post subject: Reply with quote

Hi there,

I know that we are a little while down the road now, but I just realised that one of the features in btrfs does exactly what you are after:

https://btrfs.wiki.kernel.org/index.php/Seed-device

If you aren't already sorted with things this might help you out :)

-telemin-
_________________
The Geek formerly known as -Freestyling-
When you feel your problem has been solved please add [Solved] to the topic title.
Please adopt an unanswered post
Back to top
View user's profile Send private message
sligo
Tux's lil' helper
Tux's lil' helper


Joined: 17 Oct 2011
Posts: 93

PostPosted: Tue Apr 01, 2014 3:52 pm    Post subject: Reply with quote

Telemin wrote:
Hi there,

I know that we are a little while down the road now, but I just realised that one of the features in btrfs does exactly what you are after:

https://btrfs.wiki.kernel.org/index.php/Seed-device

If you aren't already sorted with things this might help you out :)

-telemin-


Thanks, i did it mounting to ramdisk. I had a rather bad experience with btrfs and IO in the past. Not sure if problems are solved.
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3134

PostPosted: Tue Apr 01, 2014 7:59 pm    Post subject: Reply with quote

You can easily make liveCD image from gentoo, just stuff whatever you want to run this way into compressed sqfs filesystem using for example `mksquashfs`. If you provide kernel with proper boot parameters (looptype=sqfs loop=<filename> or osmething like that, it's been a while) initramfs will automagicaly get it up and running for you. Like in it will prepare you some RAM space to serve as root and link static stuff from compressed filesystem into it.

another neat way is using unionfs, where you mount one device as readonly branch and tmpfs as writable branch that keeps all changes. I had some use of thsi way as well, the only downside was I had to customize initramfs. I kinda couldn't make it work with the one generated with genkernel, so I finaly used kernel from aufs-sources and modified init script inside initramfs along with introducing my custom boot params.

either way works just fine regardless of boot medium, it can be HDD, CD, or USB drive as well as NFS share.

also, if you like tricks, AFAIK you can make readonly swap containing hibernated system image. In case of single-purpose system it might be nice to reduce boot time a bit.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum