[HOWTO] Boot from SD card, use internal memory for data

  • This guide can be applied to my S805, S905 and S912 builds. It won't work on devices with native dual-boot, e.g. WeTek. It won't work with official LE or any other build that does not use partition labels for dual booting.


    WARNING: Before proceeding, remember to backup your SD card that you boot LE from. Backup the whole card using "Win 32 Disk Imager" or "dd".


    If you want to keep Android on your box for any reason but don't have/want to buy/want to use a fast and big SD card for LibreELEC, it is possible to load LE from SD card and use internal memory to store your data. This way internal data partition can be shared with Android.


    Advantages:

    + system responding faster - most of the times internal memory is better with random read/writes

    + no need to overwrite Android

    + you can use SD card as small as 1GB for LE (perhaps even 256MB but this guide won't cover it)


    Disadvantages:

    - data partition shared with Android

    - LE boot time does not improve


    wrxtasy edit

    LE/CE 8.9 Leia additional instructions in Post #63

    Basically all references to LIBREELEC_DISK posted below need to be changed to STORAGE for LE/CE 8.9


    1. Identify partition that you boot from and change its label.

    Login over SSH and use blkid to list disk partitions and their labels. Find a partition called LIBREELEC_DISK:

    Code
    1. /dev/loop0: TYPE="squashfs"
    2. /dev/cache: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b" TYPE="ext4"
    3. /dev/system: LABEL="system" UUID="da594c53-9beb-f85c-85c5-cedf76546f7a" TYPE="ext4"
    4. /dev/data: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b" TYPE="ext4"
    5. /dev/mmcblk1: PTUUID="0969ebc9" PTTYPE="dos"
    6. /dev/mmcblk1p1: SEC_TYPE="msdos" LABEL="LIBREELEC" UUID="090C-41E0" TYPE="vfat" PARTUUID="0969ebc9-01"
    7. /dev/mmcblk1p2: LABEL="LIBREELEC_DISK" UUID="637a27c5-a4af-4919-b692-949a67ded223" TYPE="ext4" PARTUUID="0969ebc9-02"

    In my case it is /dev/mmcblk1p2. Remove label from this partition:

    Code
    1. e2label /dev/mmcblk1p2 ""


    2. Apply a label to data partition

    Apply LIBREELEC_DISK partition label to internal data partition:

    Code
    1. e2label /dev/data "LIBREELEC_DISK"


    3. Verify partition labels

    Verify that partition label was correctly applied using blkid:

    Code
    1. /dev/loop0: TYPE="squashfs"
    2. /dev/cache: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b" TYPE="ext4"
    3. /dev/system: LABEL="system" UUID="da594c53-9beb-f85c-85c5-cedf76546f7a" TYPE="ext4"
    4. /dev/data: LABEL="LIBREELEC_DISK" UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b" TYPE="ext4"
    5. /dev/mmcblk1p1: SEC_TYPE="msdos" LABEL="LIBREELEC" UUID="090C-41E0" TYPE="vfat" PARTUUID="0969ebc9-01"
    6. /dev/mmcblk1p2: UUID="637a27c5-a4af-4919-b692-949a67ded223" TYPE="ext4" PARTUUID="0969ebc9-02"
    7. /dev/mmcblk1: PTUUID="0969ebc9" PTTYPE="dos"


    4. (Optional) Copy your data to internal memory

    If you omit this step, after reboot you will have a clean system.

    Code
    1. systemctl stop kodi
    2. mkdir -p /tmp/data
    3. mount -o rw /dev/data /tmp/data
    4. cp -pPRv /storage/. /tmp/data
    5. umount /tmp/data
  • Confirmed working on x96 s905x box, just take note of below command. basically it will copy all the folders and files under storage, but if you have LE mounted network shares it will try to copy all the files inside as well which is not expected. So you just need to copy the folders manually and skip the mounted shared folders


    cp -pPRv /storage/. /tmp/data

  • That's a great guide! It's also a good method to backup the Kodi data in the eventuality the SD is going to fail!

    As frequenzy mentioned, we should put an extra step on unmounting all the network shares before start the copy and the final step to reboot, so that you can test this.

    I guess to revert back the change is just to revert back the labels to the original state?

    Thanks kszaq!

    Zenbox Z11 Pro 2G/16G - 100M LAN - Wireless AC Qualcomm QCA9377 1-stream (433 Mbps) - LE 8.2.4.2-Test2

  • Hi, I tried this last night on my Mecool s912 3GB dual boot (thanks for all the work on that!) but when I rebooted it it gave me the "can't access tty: job control turned off" error on boot. Up to that point it had worked exactly as you posted above. Sadly I can't offer any more information because I had to pull the SD card and reboot to Android (no SSH connection).


    I've gone back to dual boot - in the mean time, should I delete the tmp/data files I copied over to the Android system? (how can I?)


    Thanks

    S912 - MECOOL M8S PRO, 3GB, 100Mb

    S805 - DroidPlayer MXQ, Amlogic A5, 1GB, 100Mb

  • Link Below.

    #1


    CAUTION: If your box has a non-standard partition layout, you will see an error when trying to boot from internal memory for the first time. To solve it, you need to boot one more time from SD card and run installtointernal again.

    Maybe you missed this or not ??

    Hi, thanks for your reply. I did not know booting twice was necessary in this case too. However, I'm following kszaq's instructions above to share the android data partition with libreelec, not overwrite it. The link you posted says installtointernal would erase Android. I've done this on an S805 box, but I would like to keep the dual boot option on the S912 for the time being.

    S912 - MECOOL M8S PRO, 3GB, 100Mb

    S805 - DroidPlayer MXQ, Amlogic A5, 1GB, 100Mb

  • Hi, thanks for your reply.

    Sorry ,

    My Mistake.

  • How can I reverse this?

    Beelink MiniMXIII II 2GB, 32GB always running latest Libreelec from SD card. No issues so far(except for the ones already known or posted by me).

    Mecool m8s Pro+ which with widevine level 1, Android runs a hacked version of android TV.

  • KIII pro (am912) working :-) thanks a lot everything got faster especially changing channels on satellite ... , just a question if anyone knows ... on video settings i have 2 choices (actually both say res 1080) in the first one all borders are off the screen, in the second one all is fine except the gui in the tv tab( to watch sat channels) that is still off the screen ( the image is fine though) , when i watch videos through addons the gui is fine..... , anyone has any idea how to fix this :-).

  • Remove the label from the data partition:

    Code
    1. e2label /dev/data ""

    Disclaimer - I've not tried this. But LE looks for a storage partition with the 'LIBREELEC_DISK' label.

    Works indeed! Thanks!

    Beelink MiniMXIII II 2GB, 32GB always running latest Libreelec from SD card. No issues so far(except for the ones already known or posted by me).

    Mecool m8s Pro+ which with widevine level 1, Android runs a hacked version of android TV.

  • Awesome! Works much faster then an SD card.


    Which command shows the free disk space? I cannot find the info in df -h output.

  • How does the dual boot works in this case ? do we need still leave the SD card in the box to boot to LE and remove the SD card to boot to android ?

    What will happen to internal android data , will get erased if i copy SD LE Addon data to internal ?


    Please clarify

    Thanks

  • You still need a USB stick / SD card to boot into LibreELEC.

    Internal Android data is untouched, LE Kodi data is just added to that Android Internal storage partition.


    If you do an OTA Update.zip of Android Firmware, the Data partition remains untouched as well - so LE Kodi data also remains intact.


    If you use the Low Level USB Burning Tool to flash an Android TV ROM, it will overwrite the internal Data partition. Make sure you do a LE .tar backup before doing something like that and messing with the Android Data partition.

  • Thanks, Is the performance better by this approach ? the OS is still in SD card and the only the addons are internal, how big is a difference moving addons data to internal ?

  • how big is a difference moving addons data to internal ?

    To be honest, I did not notice much difference. Maybe fanarts were loading faster but I'm not even sure about that.

    Apple TV 4k - Vero 4k - Pi 3 | Yamaha RX-V483 | Sony 55XE9305 | Synology DS916+