{"id":20678250,"url":"https://github.com/oxdabit/overlay-raspbian","last_synced_at":"2026-05-18T19:02:43.431Z","repository":{"id":213527197,"uuid":"284914857","full_name":"OxDAbit/overlay-Raspbian","owner":"OxDAbit","description":"Script to mount SquashFS over OverlayFS in Raspberry Pi \u003e= 3","archived":false,"fork":false,"pushed_at":"2023-12-21T15:36:26.000Z","size":60,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-11T12:48:33.508Z","etag":null,"topics":["overlayfs","raspberry-pi","raspberry-pi-3","raspberry-pi-4","raspberrypi","raspbian","sfs","squashfs"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OxDAbit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-04T07:55:54.000Z","updated_at":"2024-12-13T23:21:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"a2451d19-82be-47c2-98ca-a337b1b2142b","html_url":"https://github.com/OxDAbit/overlay-Raspbian","commit_stats":null,"previous_names":["oxdabit/overlay-raspbian"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/OxDAbit/overlay-Raspbian","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OxDAbit%2Foverlay-Raspbian","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OxDAbit%2Foverlay-Raspbian/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OxDAbit%2Foverlay-Raspbian/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OxDAbit%2Foverlay-Raspbian/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OxDAbit","download_url":"https://codeload.github.com/OxDAbit/overlay-Raspbian/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OxDAbit%2Foverlay-Raspbian/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279007194,"owners_count":26084248,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["overlayfs","raspberry-pi","raspberry-pi-3","raspberry-pi-4","raspberrypi","raspbian","sfs","squashfs"],"created_at":"2024-11-16T21:19:32.700Z","updated_at":"2025-10-11T12:48:33.824Z","avatar_url":"https://github.com/OxDAbit.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# overlayRoot.sh\nSquash File System over OverlayFS\n\nForked from: https://wiki.psuter.ch/doku.php?id=solve_raspbian_sd_card_corruption_issues_with_read-only_mounted_root_partition\n\n# Repository folder structure\n```\n/src\n├── overlay\n│   └── overlayRoot.sh                  # Original script v1.1 Created by Pascal Suter\n│\n└── overlay_sfs                         # Custom resources\n    ├── boot                            # Contain boot files\n    │   ├── cmdline-no_overlay.txt      # Boot Raspberry without OverlayFS\n    │   └── cmdline-overlay.txt         # Boot Raspberry with OverlayFS\n    └── sbin                            # Script to create OverlayFS and SquashFS\n        └── overlayRoot.sh              # SquashFS over OverlayFS script v1.4\n```\n\n# Installation\n**NOTE:** _This script has been tested with Raspbian OS (32-bit) Lite (Debian Buster)_\n\n1. First of all, create the folder structure:\n    ```\n    /lib/live/\n    ├── mounted\n    │   ├── ro          # Where Lower overlay folder is located\n    │   ├── rw          # Where Upper and Work overlay folder is located\n    │   └── squashed    # Where .sfs file is unsquashed\n    └── squashfs        # Where .sfs file is located\n    ```\n\n    To do that:\n    ```\n    sudo -s\n    mkdir /lib/live\n    mkdir /lib/live/mounted\n    mkdir /lib/live/mounted/ro\n    mkdir /lib/live/mounted/rw\n    mkdir /lib/live/mounted/squashed\n    mkdir /lib/live/squahfs\n    ```\n2. Install Squasfs \n    ``` \n    sudo apt-get install squashfs-tools -y \n    ```\n3. Copy [overlayRoot.sh](https://github.com/OxDAbit/overlayRoot.sh/blob/master/src/overlay_sfs/sbin/overlayRoot.sh) script into **/sbin/**\n    - I usually copy from my computer to Raspberry **/home/user** path using:\n        ```\n        # From computer terminal\n        sudo scp -r /pc_overlayRoot rsp_user@rsp_ip_address:/destination_path\n        ```\n    - After copy the script, simply move to **/sbin** path runing:\n        ```\n        sudo mv /home/user/overlayRoot.sh /sbin/\n        ```\n    - Make it executable:\n        ``` \n        chmod +x /sbin/overlayRoot.sh\n        ```\n4. Disable **swap**\n    ```\n    dphys-swapfile swapoff\n    dphys-swapfile uninstall\n    update-rc.d dphys-swapfile remove\n    systemctl stop dphys-swapfile\n    systemctl disable dphys-swapfile\n    ```\n4. Change your boot parameter in **/boot/cmdline.txt**. Adding `init=/sbin/overlayRoot.sh`:\n    - **cmdline.txt** with OverlayFS\n    ```\n    console=serial0,115200 console=tty1 root=PARTUUID=97652995-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait init=/sbin/overlayRoot.sh\n    ```\n    - **cmdline.txt** without OverlayFS\n    ```\n    console=serial0,115200 console=tty1 root=PARTUUID=97652995-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait \n    ```\n    **NOTE:** _Can copy [cmdline-overlay.txt](https://github.com/OxDAbit/overlayRoot.sh/blob/master/src/overlay_sfs/boot/cmdline-overlay.txt) and [cmdline-no_overlay.txt](https://github.com/OxDAbit/overlayRoot.sh/blob/master/src/overlay_sfs/boot/cmdline-no_overlay.txt) from this repository and paste in your system_\n4. Reboot time }: )\n    ```\n    reboot \n    ```\n\n# Enable / Disable OverlayFS\nCopy **cmdline-no_overlay.txt** and **cmdline-overlay.txt** into **/boot/** path.\n\nAfter runing the script **/boot/** partition is mounted as a RW. To Enable or Disable OverlayFS:\n- **Enable** OverlayFS:\n    ``` \n    cp /boot/cmdline-overlay.txt /boot/cmdline.txt\n    ```\n- **Disable** OverlayFS:\n    ```\n    cp  /boot/cmdline-no_overlay.txt /boot/cmdline.txt\n    ```\n- After modify **cmdline.txt** file reboot Rapsberry `sudo reboot`\n\n# Create Squash file\nFor this example I've created a 3 test files which will be located in **/home** and **/etc** folders after mount OverlayFS.\n1. Create a temp folder in **/home/user** (for exemple):\n    ```\n    sudo -s\n    mkdir /home/user/squahsfs_tmp \n    ```\n2. Inside the squash file we will add a file which will be located inside **/etc/** and **/home/** folders (just for testing), so we should create 2 new folders inside **squashfs_tmp**:\n    ``` \n    cd /home/user/squahsfs_tmp\n    mkdir etc\n    mkdir home\n    ```\n3. Create some test files inside this folders:\n    ```\n    touch etc/hello_etc\n    touch home/home_file_01\n    touch home/home_file_01\n    ```\n4. We've implemented the changes so is time to create a SFS file:\n    ```\n    cd ..                                               # We're located in /home/user path right now\n    squashfs squahsfs_tmp file_system.sfs -comp xz      # Creating SFS File }:)\n    ```\n    This command generate a _sfs_ file call **file_system.sfs** based in **squahfs_tmp** folder content.\n5. In the script the **/lib/live/squahsfs** directory is defined as the location where the file will be found the squash files so we should move the file.\n    ```\n    mv /home/user/squahsfs_tmp /lib/live/squashfs\n    ```\n6. Remove **squasfs_tmp** folder\n    ```\n    rm -rf /home/user/squashfs_tmp \n    ```\n7. Enable overlay\n    ```\n    cp /boot/cmdline-overlay.txt /boot/cmdline.txt\n    ```\n8. Reboot time }: )\n    ```\n    reboot \n    ```\n9. If everything has worked as we expected we will see:\n    ```\n    ls /home\n     ├── home_file_01\n     ├── home_file_02\n     └── other /home files...\n\n    ls /etc\n     ├── hello_etc\n     └── other /etc files...\n    ```\n\n# Update Squash file\nUpdate squashs file adding or removing some file. To do that:\n1. Reboot system without OverlayFS\n    ```\n    sudo -s\n    cp  /boot/cmdline-no_overlay.txt /boot/cmdline.txt\n    reboot\n    ```\n2. Go to **squashfs** default path\n    ```\n    sudo -s\n    cd /lib/live/squashfs\n    ```\n3. Unsquash **file_system.sfs**\n    ```\n    unsquashfs -f file_system.sfs\n    ```\n    After run this command a folder **squashfs-root** will appear.\n    ```\n    /lib/live/squashfs\n      ├── file_sytem.sfs\n      └── squashfs-root\n    ```\n4. Modify **squashfs-root** content removing **home_file_02** (for exemple)\n    ```\n    rm -rf squashfs-root/home/home_file_02 \n    ```\n5. Remove old **file_system.sfs**\n    ```\n    rm -rf file_system.sfs\n    ```\n6. Create the new _sfs_ file\n    ```\n    squashfs squashfs-root file_system.sfs -comp xz\n    ```\n7. Now modify **cmdline.txt** to mount overlayFS after reboot and apply the sfs changes\n    ```\n    cp /boot/cmdline-overlay.txt /boot/cmdline.txt\n    ```\n8. Rebot time }: )\n    ```\n    reboot \n    ```\n\nThe other way to modify squashfs:\n1. Remount RO partition\n    ```\n    sudo -s\n    mount -o remount,rw /lib/live/mounted/ro \n    ```\n2. Go to **squashfs** folder\n    ```\n    cd /lib/live/mounted/ro/lib/live/squashfs\n    ```\n3. Repeat steps from 3 until 8 indicated in the previous section\n\nContact\n=======\n- Twitter. [**@0xDA_bit**](https://twitter.com/0xDA_bit)\n- Github. [**OxDAbit**](https://github.com/OxDAbit)\n- Mail. **oxdabit@protonmail.com**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foxdabit%2Foverlay-raspbian","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foxdabit%2Foverlay-raspbian","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foxdabit%2Foverlay-raspbian/lists"}