1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

old wiki

Discussion in 'Off-Topic' started by boelle, 27 September 2016.

  1. boelle

    boelle New Member

    Messages:
    0
  2. Brindosch

    Brindosch Administrator Administrator

    Messages:
    593
    Hardware:
    RPi1/Zero, RPi2, RPi3, +nodeMCU/ESP8266
  3. boelle

    boelle New Member

    Messages:
    0
    sadly not i think

    there was some very specific steps in there.

    and without a locked backup i cant verify that what i google is also the same
     
  4. Brindosch

    Brindosch Administrator Administrator

    Messages:
    593
    Hardware:
    RPi1/Zero, RPi2, RPi3, +nodeMCU/ESP8266
    This is a backup of the old article
    Code:
    # Overview
    Once you have Hyperion setup and properly configured, it is useful to make the file-system read only. This way you can abruptly shut off the raspberry pi without causing any harm to the SD Card's file-system.
    # Steps
    ### Disable Swap
    ```
    dphys-swapfile swapoff
    dphys-swapfile uninstall
    update-rc.d dphys-swapfile disable
    ```
    ### Install UnionFS
    `aptitude install unionfs-fuse`
    ### Create UnionFS Mount Script
    `nano /usr/local/bin/mount_unionfs`
    
    add these lines to the file:
    
    ```#!/bin/sh
    [ -z "$1" ] && exit 1 || DIR=$1
    ROOT_MOUNT=$(grep -v "^#" /etc/fstab | awk '$2=="/" {print substr($4,1,2)}')
    if [ "$ROOT_MOUNT" != "ro" ]; then
    /bin/mount --bind ${DIR}_org ${DIR}
    else
    /bin/mount -t tmpfs ramdisk ${DIR}_rw
    /usr/bin/unionfs-fuse -o cow,allow_other,suid,dev,nonempty ${DIR}_rw=RW:${DIR}_org=RO ${DIR}
    fi
    ```
    
    Make the file executable:
    
    `chmod +x /usr/local/bin/mount_unionfs`
    
    Update your fstab to look like this:
    
    ```
    proc            /proc           proc    defaults          0       0
    /dev/mmcblk0p1  /boot           vfat    ro                0       2
    /dev/mmcblk0p2  /               ext4    ro,noatime        0       1
    mount_unionfs   /etc            fuse    defaults          0       0
    mount_unionfs   /var            fuse    defaults          0       0
    none            /tmp            tmpfs   defaults          0       0
    ```
    
    Prepare these directories:
    
    ```
    cp -al /etc /etc_org
    mv /var /var_org
    mkdir /etc_rw
    mkdir /var /var_rw
    reboot
    ```
    Finished!
    # End
    
    Now you don't have to worry if your raspberry pi loses power suddenly, all should be well :)
    
    If for some reason you need to make changes you can remount the filesystem as read/write with this command:
    `mount -o remount,rw /`
    
    Enjoy
    
    _I give [Max via the pi3g Blog](http://blog.pi3g.com/2014/04/make-raspbian-system-read-only/) credit for this solution_
    
    _BaM provided a better mount_unionfs script in the comments_
     
  5. boelle

    boelle New Member

    Messages:
    0
    Thanks a lot.... it would save me some hours of searching..

    saved the email i just got and will print it on paper too :-D
     
  6. Neelstha

    Neelstha New Member

    Messages:
    0
    Hardware:
    iMX6
    Last edited: 22 March 2017