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

  • Use the tar command to create the archive, copy the archive to destination and extract

    I tried this. Nothing is big enough to hold the tar so it just doesn't do it.

    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.

  • I've found this very handy because now I can do a clean SD card install and still have my addons. I have two s905x boxes and want to transfer the data that's on the internal memory of the first one to the other one. How can I achieve this?

    Boot both boxes in LE.

    Stop Kodi in both boxes.

    scp -r all desired folders from the source box to the target box.

    Reboot the target box, or just start Kodi again.

    That's one way to do it. ;)

  • Very interesting !

    I'm currently using sx05re build from niabi for kodi first and emulation second.

    I'm always chasing ways to speed up kodi and would like to apply this.

    But in storage is located the roms folder which needs lot of space.

    Do you think possible to keep roms folder on sdcard ?

  • Once this is done and you're using internal memory for data, how do I then get a "fresh" system back? Surely reflashing the SD card won't work because all of the data is now on the internal partition? Which directories do I need to delete?

    EDIT: Solution is to do this extra step:

    systemctl stop kodi
    mkdir -p /tmp/data
    mount -o rw /dev/data /tmp/data
    rm -rf /tmp/data/.kodi
    cp -pPRv /storage/. /tmp/data
    umount /tmp/data

    Edited once, last by DragonQ ().

  • Once this is done and you're using internal memory for data, how do I then get a "fresh" system back?

    Reverts the steps You have done before.

    Reflashing the SD card or flashing a new SD card will work, but the data on internal memory will not be used

  • I'd like to give this a try but I'm confused on how to copy filer/folders over if I have mounted a NAS drive so Tvheadend can record there.

    Can I use the "cp -pPRv /storage/. /tmp/data" command"?

    If not, how do I manually copy the files and folders over?

    I'm just starting this SSH stuff so be easy on me.


  • I think I got it. I used the "systemct1 disable storage" command to dismount the drive.

    I then followed the instructions. However, the box hung during copying the files over. it got to copying picons. I was unable to give the "umount /tmp/data" command. I pulled the plug and rebooted the box. The box rebooted normally.

    It seems to be working OK.

    Is there a way to make sure everything went OK? It does seem snappier but it just may be a placebo effect.


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

    Hi Friend. How did you solve this? I have the same problem with x96 mini. And i do not understand what twice booting means. If i boot again from sd y see the error again and i can not do anything. Where have i to put the installtointernal comand? When error screen with libreelec logo appears, i can not acces via ssh. What i do is to reinstall libreelec on the sd card but after ssh instructions, the error screen appears again... how did you fix it? Thankss!!!!!

  • Hello, First of all. Major thanks for the work! For me it worked perfectly, but i have a small quirk on my S912. When i press power off, it just reboots. Is there a fix for this? am i overlooking something? Thanks in advance!

  • I am sure s.t. like this in other threads, but may not be available for s912, anyway it's not in this thread. So if anyone wanted to know the difference between internal memory and SD Card / USB HDD - here some insight:

    External helpfull links
    HowTo: Linux / UNIX List Just Directories Or Directory Names - nixCraft


    # SD Card - SanDisk Extreme SDHC UHS-I 32GB class 10 (SDSDX-032G-X46 maybe or s.t. similar)

    On Windows with Delink Card Reader I am able to read/write 100/50MB/s, here it changes (and reading is slower - in any test).

    (write) LibreELEC:~ # sync; dd if=/dev/zero of=./test.tmp bs=500K count=1024

    1024+0 records in

    1024+0 records out

    524288000 bytes (500.0MB) copied, 15.941096 seconds, 31.4MB/s

    (clear) LibreELEC:~ # sync; echo 3 | tee /proc/sys/vm/drop_caches

    (read) LibreELEC:~ # sync; time dd if=./test.tmp of=/dev/null bs=500K count=1024

    1024+0 records in

    1024+0 records out

    524288000 bytes (500.0MB) copied, 22.870083 seconds, 21.9MB/s

    real 0m 22.87s

    user 0m 0.02s

    sys 0m 1.32s

    # Internal Memory of Beelink GT1-T-D1 3G/32GB/6335/-A (mount -o rw /dev/data /tmp/data)

    (write) LibreELEC:~ # sync; dd if=/dev/zero of=/tmp/data/test.tmp bs=500K count=1024

    1024+0 records in

    1024+0 records out

    524288000 bytes (500.0MB) copied, 2.510985 seconds, 199.1MB/s

    (clear) LibreELEC:~ # sync; echo 3 | tee /proc/sys/vm/drop_caches

    (read) LibreELEC:~ # sync; time dd if=/tmp/data/test.tmp of=/dev/null bs=500K count=1024

    1024+0 records in

    1024+0 records out

    524288000 bytes (500.0MB) copied, 3.693659 seconds, 135.4MB/s

    real 0m 3.69s

    user 0m 0.01s

    sys 0m 1.18s

    # USB3.0 HDD Samsung HM750LI (mount -o rw /dev/sda1 /tmp/data)

    // Tested on both ports ... ~0,5MB/s difference in 1 Test so .. confirmed and negligible - interesting - 1 port is supposed to be usb 2.0 ... not with that speeds.

    (write) LibreELEC:~ # sync; dd if=/dev/zero of=/tmp/data/test.tmp bs=500K count=1024

    1024+0 records in

    1024+0 records out

    524288000 bytes (500.0MB) copied, 9.072689 seconds, 55.1MB/s

    (clear) LibreELEC:~ # sync; echo 3 | tee /proc/sys/vm/drop_caches

    (read) LibreELEC:~ # sync; time dd if=/tmp/data/test.tmp of=/dev/null bs=500K count=1024

    1024+0 records in

    1024+0 records out

    524288000 bytes (500.0MB) copied, 14.759751 seconds, 33.9MB/s

    real 0m 14.76s

    user 0m 0.00s

    sys 0m 1.07s

    (If you do that, don't forget to delete files and unmount)

    Short note - over Gbit LAN using Samba (vs. Win10 Client with Intel NIC connected to the HDD) : It's ~ 20MB/s - R/W

    Edited once, last by rastobil ().

  • thanks for the easy to follow HowTo guide, works great. I just started testing S912 kodi-leia images, and have not set any of them up to put the data on the device's internal storage yet, because I have stable @wrxtasy amLogic builds using the same S912 devices. Is making a tar file of /storage while booted into the LE environment, then uploading the file to a NAS or putting it on an external disk all that is needed to preserve the data for my stable LE builds?

  • Hi folks, is anyone try this for Kodi 18 Leia yet? Change label /dev/data to "STORAGE"? I have tried this on my x96 1GB RAM with the dtb gxl_p212_1g.dtb, everything is fine, but I could not turn on neither connect to ssh of the box. With the /storage mount to /dev/mmcblk1p2, it works.

    The image I have tried is:

    - LibreELEC-S905.arm-9.0-devel-20180621082211-5287365.img

    - CoreELEC-S905.arm-8.90.4.img


    X96 S905X 1G/8G WiFi 8189es 100M LAN - LE 8 @ 1.512GHz on SDCard.

  • Hi! I have a Mecool Ki Pro box and managed to run CoreElec itself also from nand without deleting Android! Simply assign the label COREELEC to /dev/system, STORAGE to /dev/data, mount /dev/system and copy the content of /flash to it with cp -a /flash/* <mountpoint>

    Then, the minimum files to have in the root of any SD/flash drive with a FAT16/32 partition of almost any size is aml_autoscript, dtb.img and kernel.img, with that the box load only the kernel from the SD/flash drive and the rest is loaded from /dev/system. I can see the Android system files with a "ls /flash" and of course the data with "ls /storage".

    For LE obviously change the above to LIBREELEC for /dev/system, and LIBREELEC_DISK or STORAGE for /dev/data, depending of the LE version as wrxtasy stated in the main message.

    With this it would be possible even to make scripts/addons that takes advantage of this method and make backups of Android apk's or put any APK that will be installed on next Android boot xD and from the Android's point of view, I don't think it care of having the SYSTEM file on it's system root, unless you apply an update and that update formats /system or remove the files... in that case will only have to copy again the CE/LE files to /flash and maybe assign again the label, even I think that can create a flashable ZIP for install/recover it from recovery.

    One of the problems I see is what would happen when applying an CE/LE tar update, I'll try hehe, if CE/LE only replaces SYSTEM, kernel.img without formatting /flash it would be ok Edit: tested it and it don't format /flash, so no problem:) the other only problem is what I noticed here some months ago, NEVER do a hard-reset with /dev/data shared as LE/CE will wipe all /storage data, so not only LE/CE will reset but also Android xD

    Edit 2: it's ok to do a soft-reset, as it only remove config files, addons, etc. without deleting videos, downloads... so it also don't remove Android files :D

    Edited 5 times, last by aaron89 ().

  • Hi!
    I have a MXQ Pro Plus and wanted to put kodi files to internal as it was described in first post. But after I did everything, the LE started to use /dev/loop0 whitch is 125 MB and I noticed this only when it was full. With df -h shows that /dev/loop0 is full and Estuary Mod also confirms that the internal memory is 125 MB and is full. But in blkid the LIBREELEC_DISK label is set to /dev/data

    I also tried to reboot a couple times with no luck.

    It's a LE

    Does anyone have a clue what is going on?


  • I have a M8S Pro+ box, booted from LIbreElec SD card. There's no DATA partition in the blkid output. I can see the HDD connected though.


    LibreELEC:~ # blkid
    /dev/loop0: TYPE="squashfs"
    /dev/mmcblk0p1: SEC_TYPE="msdos" LABEL="LIBREELEC" UUID="2557-19A6" TYPE="vfat" PARTUUID="be03dce7-01"
    /dev/mmcblk0p2: LABEL="LIBREELEC_DISK" UUID="cdedf16d-e99c-4cd3-a2f1-61a687bcd470" TYPE="ext4" PARTUUID="be03dce7-02"
    /dev/sda1: LABEL="HD 1" UUID="92920C84920C6ED3" TYPE="ntfs" PARTUUID="5d5e9383-01"
    /dev/mmcblk0: PTUUID="be03dce7" PTTYPE="dos"


    However there is no lsblk or fdisk. But I suppose they would just give the same result. Can anyone please explain why there is no DATA partition on display?


  • Hi there. I have MECOOL M8S PRO W (Amlogic S905W, 1GB ROM). I have installed LibreELEC on my device from USB flash memory and everything is fine. My problem is that I can't make it to boot from internal or boot from SD/USB but using internal memory. Whatever device tree I had used (gxl_p212_1g, gxl_p281_1g with different suffixes) I couldn't see internal memory (/dev/system, /dev/data).

  • Hi!

    I have a funny side effect, indeed. Now "unused" partition on a SD card is mounting automatically into /var/media and now seen in Video folder))) How can I avoid this in the "right" way?

    P.S. I mean I can remove this partition entirely, but it's not the thing I want to do...

    Edited once, last by kanyck ().

  • Hi guys. I am thinking of upgrading to 8.9, what is the safest way to do this. I would love to just add the TAR file to the update folder but the partition rename from ""libreelec disk"" to ""storage"" , I am guessing this would cause problems. What is the easiest and safest way to upgrade