OpenELEC Forum
Re: RPi openelec on read-only SDcard - Printable Version

+- OpenELEC Forum (https://forum.openelec.tv)
+-- Forum: Generic Forum (https://forum.openelec.tv/forumdisplay.php?fid=5)
+--- Forum: STORAGE (https://forum.openelec.tv/forumdisplay.php?fid=60)
+--- Thread: Re: RPi openelec on read-only SDcard (/showthread.php?tid=77629)



RPi openelec on read-only SDcard - kybrex - 07-24-2015

Hi everyone,
I have installed openELEC a few days ago and I like it, but I would like to solve following:
1. Boot openElec without mounting storage (disk) on SDcard (cmdline.txt contains boot=mmcblk0p1, disk=mmcblk0p2). I was trying to remove disk= from cmdline, but I get an error saying "cannot mount storage...".
2. Prevent writing any data to System partition (mmcblk0p1) on SD card, because I want to maximize its life and mainly I want to prevent damage system settings by using the device, because my RPi with openELEC installed should work as an HTPC for children. Thats why I need to "restore system" after each reboot, BUT I need to make some kind of init setup via script like cmdline, where I'll be able to connect RPi to local WIFI, to mount shared multimedia folders etc.

I noticed, that whole file-system is "read-only" and it is probably loaded into RAM except /var and I would like to load even this dir (/var) to RAM to prevent all writes to SD card (I really do not need store system state after reboot and the "init settings" should be already persisted on SDC in the init script Smile ) or I had an idea to make SD card like "live distribution" on read-only bootable media like CD (and store it to SD card), but I didn't find any way to do it yet.

I was thinking about make my own live linux distribution with media software preinstalled, however it is much more complicated and I like openELEC so I would like to get it working like I would need and like I describe it above. Smile Is there any way to do it? Smile

Thanks for your advices Smile

K.


Re:Re: RPi openelec on read-only SDcard - nickr - 07-24-2015

You need to store settings and logs somewhere.


RPi openelec on read-only SDcard - klojum - 07-24-2015

To have OpenELEC work on a readonly device will not happen. Kodi needs to store/update its databases with video information.
The system partition set up as readonly for a reason. All settings go via the 2nd, /storage partition. So removing that, via the cmdline or otherwise, is not an option.
Restoring the system after each reboot is insane. Install OE, make it running to your wishes and make a full backup/image. Restore that in case of trouble.


RPi openelec on read-only SDcard - kybrex - 07-24-2015

Okey, thank's for prompt reply.
May I ask you for some experiences about SD card lifetime (My is Kingston - unknown class)? Is it months or years...? Or is it possible to boot openELEC from external HDD connected to USB?


OpenELEC:~ # df -h
Filesystem Size Used Available Use% Mounted on
devtmpfs 165.3M 0 165.3M 0% /dev
/dev/mmcblk0p1 125.0M 104.8M 20.2M 84% /flash
/dev/mmcblk0p2 318.5M 3.1M 294.3M 1% /storage
/dev/loop0 94.5M 94.5M 0 100% /
tmpfs 170.4M 0 170.4M 0% /dev/shm
tmpfs 170.4M 4.6M 165.8M 3% /run
tmpfs 170.4M 0 170.4M 0% /sys/fs/cgroup
tmpfs 170.4M 224.0K 170.1M 0% /var
tmpfs 170.4M 4.0K 170.4M 0% /tmp

I see /var on tmpfs. Is that mean this directory is located in RAM?

OpenELEC:~ # iostat -d
Linux 3.17.8 (OpenELEC) 07/24/15 _armv6l_ (1 CPU)

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
mmcblk0 15.66 554.78 2.44 99733 438
mmcblk0p1 13.65 519.83 0.00 93449 0
mmcblk0p2 1.69 29.93 2.44 5380 438

Some information about I/O traffic on SDcard to support my question about SD card lifetime. Smile


Re:Re: RPi openelec on read-only SDcard - nickr - 07-24-2015

Raspberry pi can only boot from SD card.

You can mount /storage to a USB drive, there are plenty of howtos about.

However your SD card is unlikely to wear out from kodi use. You are following a red herring. Most people who mount /storage to USB do it for speed.


Re:Re: RPi openelec on read-only SDcard - Laser-Man - 02-20-2016

Quote:You need to store settings and logs somewhere.

right, but this could be a NFS or CIFS mount.

Quote:To have OpenELEC work on a readonly device will not happen. Kodi needs to store/update its databases with video information.

It is not as stable as it looks like. Whether from plugins or from whatever, all my KODI systems loosing parts of functionality after some month. I have to set up them again (dd from archived file to sdcard), and that's it. It is never ever the power supply, and never ever a power net shortage (Germany 99.999% power supply). Most times, a RPi hangs during data base refresh or update, up to 3 times a year it hangs during video play (DVB-T recorded). I guess, all my disk broken issues came from "I had to disconnect the PSU, after the RPi/KODI device hangs". Attaching RPI battery UPS to 2 of the 5 just made resetting them more complicated. UPS did not made it more stable.

My 5 cents after 2.5 years of using a total of 5 RPis (2x RPi1 B2 with RaspBMC, OpenELEC and 3x RPi 2 with OpenELEC and OSMC):
  • The system itself could be more robust by being completely read-only.
  • the folder /var/config f.i. could be read only until explicitly mounted rw to sync the new config, then remounted ro again
  • the /var/config content would redirect the database to an external one (or to the localhost, depending on what the user configured)
  • the /var/config content would redirect/reference to the final folders and files, which would reside on a ramdisk copy or on a network mount (depending on what the user configured)
such a system would get only 3 to 10 writes the year, explicitly requested and password-confirmed by the admin.
The remaining time, it would be completely read-only and nothing could ever crash the disks.

I have enough knowledge about debian to setup such systems in general, but can't do it neither in OpenELEC nor in OSMC in special. And finally I don't know enough to change KODI this way. I'd be lost after strace'ing what files are written. Finally, I miss the knowledge to modify an image builder process this way.

Would be cool to come together with somebody who knows the rest...