Read Only Filesystem

This is probably a dumb/easy question but I couldn’t find an answer somewhere…If I were to make my SD card read only (to prevent corruption by ungraceful poweroffs) will my library still update when I add content to my NFS that my Rpi is syncing from?

Hi,

Assuming the library is stored on the card, rather than mysql; then the answer no it will not update.
Also you would need to remount as read write, when updates are released.

Your best bet is regularly back ups, even with read only setups; sd cards still die. Reported averages of life is about 2 years I think.

Thanks Tom.

Is it possible I can have the library stored on my NFS so can have my SD card read only and still have the library update? If so how can I go about doing this?

Well you could do a full NFS install or just move your home folder over

1 Like

For moving my home folder over would I just copy my current home folder to my NFS and then on my Rpi create a symlink of my home folder that points to the NFS?

Hi,

This topic should help:

Thanks Tom.

1 Like

This worked great, thank you! I did run into another issue though when making my root partition read only…when I make my root partition read only in /etc/fstab OSMC fails to boot, this is because ‘/home/osmc/.kodi/userdata’ fails to mount. I have another entry in fstab to have ‘/.kodi/userdata’ be located on my NFS as a rw directory as specified in the link you shared (this works fine when I don’t have my root partition ro)…
So I think what may be going on is a conflict between my ro root directory and my rw userdata NFS directory. When specifying my root partition to be ro is there maybe a way I can exclude my /mnt directory?
Thank you all for your help

Hi,

Please post your fstab

Thanks Tom

/dev/mmcblk0p1 /boot vfat defaults,noatime,noauto,x-systemd.automount,ro 0 0
//192.168.0.106/media/OSMC\040Music /mnt/Music cifs x-systemd.automount,noauto,ro,iocharset=utf8,username=xxxxxxx,password=xxxxxxxxxxx,uid=osmc,gid=osmc,file_mode=0770,dir_mode=0770,vers=1.0 0 0
//192.168.0.106/media/punkim /home/osmc/.kodi/userdata cifs x-systemd.automount,noauto,rw,iocharset=utf8,username=xxxxxx,password=xxxxxxxxxxxx,uid=osmc,gid=osmc,file_mode=0770,dir_mode=0770,vers=1.0 0 0
#rootfs is not mounted in fstab as we do it via initramfs. Uncomment for remount (slower boot)
/dev/mmcblk0p2 / ext4 defaults,noatime,ro 0 0

You are mounting to a non-existent /home/kodi, and then mounting / as ro.

Even if you mount / as ro first, I don’t think this will work as the directory you are using as a mountpoint is ro.

The only think I can think of would be to create a small partition and mount it rw as something like: /MyDrives. But… Even that may be a problem because / is ro…

1 Like

how can I try to make /home/osmc/.kodi/userdata it’s own partition? I’m willing to try to see if a small partition works

Instead of /home/kodi/userdata I’d suggest you use a completely different name, unless there is a reason you need userdata writable.

Best way to re-partition your card would be to use gparted (if you don’t have a linux system you can get Gparted Live and boot your PC using it). Make sure you have a good backup of the card, or clone you setup to a new card to test with.

1 Like

I actually want userdata writable so that my kodi library still updates-- ideally what I’m trying to get at with this is to have my SD card ro but still have my library update

Just use a MySQL database if you have a NAS or other system that can host it.

You could split /home off to it’s own partition, then anything under /home could be rw. That would take a bit of work to get setup the first time.

Basically (make sure Kodi is NOT running when you do this!):

  1. Create new partition, with label HOME
  2. Setup temporary mount in fstab of HOME as /newhome
  3. Copy /home to /newhome
  4. Unmount /newhome
  5. Change fstab to mount HOME as /home

At this point everything except /home will be ro.

1 Like

Thank you for all your help so far
It seems like the MySQL database option might be the easier route…would I just follow this guide?:

Yep, but… You can’t use MySQL on the Pi, as it’s a RO filesystem, unless we again visit the idea of a RW partition to house the database files. Easiest would to host the database on another system.

Yah, so I have a NAS that can host the database

Perfect!

One final thing to figure out is mounting the shares. Again, we run into the problem with the RO root filesystem. I guess just try it and see if the shares will mount. Instead of mounting them in userdata however I’d mount them in /mnt. You will need to create the mountpoint directories when root is mounted rw, then change root to ro and reboot. If you are lucky it will work.

Or, you could try the Kodi smb:// mounts but that may have performance problems. First preference of course if fstab mounts :wink: