Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HowTo: RPiTC read-only file system
26-11-2016, 12:17 PM, (This post was last modified: 26-11-2016, 12:19 PM by admin.)
#1
HowTo: RPiTC read-only file system
You can find some generic documentation about read-only system here:
https://wiki.debian.org/ReadonlyRoot

To create a read-only RPiTC image is quite simple, we just need a Linux machine and 5minutes Smile
Here step by step how to "convert" your RPiTC OS to a read-only OS:

1) customize your RPiTC image with RPiTC Builder and/or your custom mods. Shutdown the OS and plug the sdcard on your linux pc.
2) backup your sdcard with dd or your preferred tool!
3) start a partition utility (I use gparted) and add 2 new primary partitions to the RPiTC sdcard:
- a new 100Mb partition labeled RPiTC_var
- a new 500Mb partition labeled RPiTC_home
(see image attached)
4) now mount the new partitions (just unplug-replug the sdcard) and copy the content of the RPiTC/var to the new RPiTC_var partition and the content of RPiTC/home in the RPiTC_var partition. In my Fedora system the partitions are mounted in the /run/media/gibbio/ folder, change it to match your system mount syntax:
sudo mv /run/media/gibbio/RPiTC/var/* /run/media/gibbio/RPiTC_var/
same for the new RPiTC_home partition:
sudo mv /run/media/gibbio/RPiTC/home/* /run/media/gibbio/RPiTC_home/
5) now we have to edit the RPiTC/etc/fstab file in this way:
sudo vi /run/media/gibbio/RPiTC/etc/fstab

# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
tmpfs /tmp tmpfs nodev,nosuid 0 0
tmpfs /var/log tmpfs nodev,nosuid 0 0
tmpfs /home/rpitc/.cache/mozilla tmpfs mode=1777,noatime 0 0
tmpfs /var/tmp tmpfs mode=1777,noatime 0 0
/dev/mmcblk0p1 /boot vfat defaults,ro,errors=remount-ro 1 2
/dev/mmcblk0p2 / ext4 defaults,noatime,nodiratime,ro,errors=remount-ro 0 1
/dev/mmcblk0p3 /var ext4 defaults,noatime,nodiratime 0 2
/dev/mmcblk0p4 /home ext4 defaults,noatime,nodiratime 0 3

mmcblk0p3 and mmcblk0p4 are the fresh created partitions (the writable partitions we need)

6) now run a "sync" to flush the fs operations, unmount the sdcard partitions plug the sdcard in your Raspberry Pi board and power on.

If you need to modify some configuration or update package/system you can mount the / fs in write-mode on the fly as root with the command:
mount -o remount,rw /


Attached Files Thumbnail(s)
   
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)