[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
    /dev/loop0: TYPE="squashfs"
    /dev/cache: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b" TYPE="ext4"
    /dev/system: LABEL="system" UUID="da594c53-9beb-f85c-85c5-cedf76546f7a" TYPE="ext4"
    /dev/data: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b" TYPE="ext4"
    /dev/mmcblk1: PTUUID="0969ebc9" PTTYPE="dos"
    /dev/mmcblk1p1: SEC_TYPE="msdos" LABEL="LIBREELEC" UUID="090C-41E0" TYPE="vfat" PARTUUID="0969ebc9-01"
    /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
    e2label /dev/mmcblk1p2 ""

    2. Apply a label to data partition

    Apply LIBREELEC_DISK partition label to internal data partition:

    Code
    e2label /dev/data "LIBREELEC_DISK"

    3. Verify partition labels

    Verify that partition label was correctly applied using blkid:

    Code
    /dev/loop0: TYPE="squashfs"
    /dev/cache: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b" TYPE="ext4"
    /dev/system: LABEL="system" UUID="da594c53-9beb-f85c-85c5-cedf76546f7a" TYPE="ext4"
    /dev/data: LABEL="LIBREELEC_DISK" UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b" TYPE="ext4"
    /dev/mmcblk1p1: SEC_TYPE="msdos" LABEL="LIBREELEC" UUID="090C-41E0" TYPE="vfat" PARTUUID="0969ebc9-01"
    /dev/mmcblk1p2: UUID="637a27c5-a4af-4919-b692-949a67ded223" TYPE="ext4" PARTUUID="0969ebc9-02"
    /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
    systemctl stop kodi
    mkdir -p /tmp/data
    mount -o rw /dev/data /tmp/data
    cp -pPRv /storage/. /tmp/data
    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!

  • 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

  • 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.

  • 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 :-).

  • 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 ?