Setting the SD card to Read Only

You can set the SD card to readonly in a VKLink node. All the stuff that is downloaded, etc is stored in RAM, so it does not need to write to the card at all. So, it can be set as readonly meaning you'll never have corrupt SD cards ever again. All this has to be done as superuser (sudo su).

How to do it:(Edit)

nano /etc/fstab

Change the following lines:

/dev/mmcblk0p1  /boot           vfat    ro,noatime          0       2
/dev/mmcblk0p2  /               ext4    ro,noatime      0       1

note the "ro" in the mount properties.

nano /boot/cmdline.txt

add ro to the end of that:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait ro

nano /etc/init.d/checkroot.sh
/etc/init.d/checkfs.sh

and comment out the do_start item (with a #):

.
.
.
case "$1" in
  start|"")
    #do_start
    ;;
  restart|reload|force-reload)
    echo "Error: argument '' not supported" >&2
    exit 3
    ;;
  stop)
.
.
.

nano /etc/init.d/checkroot-bootclean.sh

and comment out these two lines:

rm -f /tmp/.clean /lib/init/rw/.clean /run/.clean /run/lock/.clean
clean_all

so it looks like this:

.
.
.
        # system was previously running, which would otherwise
        # prevent
        # them being cleaned.
        #rm -f /tmp/.clean /lib/init/rw/.clean /run/.clean /run/lock/.clean

        #clean_all
        exit $?   
        ;;
.
.
.

turn off the swapfile:

update-rc.d dphys-swapfile disable

made dhcp leases in tmp instead of the file system:

rm -rf /var/lib/dhcp/
ln -s /tmp /var/lib/dhcp

Insert Googles Name Servers into resolv.conf (these never have to be changed)

nano /etc/resolv.conf

nameserver 8.8.8.8
nameserver 8.8.4.4

Reboot the pi. You should have sightly less memory, but no SD card writes!

If any writeable stuff needs to be changed, it is able to be done via the Main Setup Menu. The Main Setup Menu has a function built in to turn the filesystem back to writeable while its changing things and turns it back to readonly when it closes.

Advanced Stuff | Main page

Menu

Article:

Search: