How to install DietPi in emmc of NanoPi M1 Plus

Hello,

I am trying to install DietPi in emmc of NanoPi M1 Plus.

I am able to install DietPi in micro SD card and boot from it follwing the instructions in https://dietpi.com/docs/install/

But, couldn’t find a guide on how to install DietPi in emmc of NanoPi M1 Plus. Please guide me to correct resouces for this.

Thanks :smiley:

Test this → https://wiki.friendlyarm.com/wiki/index.php/NanoPi_M4#The_usage_of_eMMC_module

Generally, you had to search for keywords like “nano pi flash emmc”.

I run DietPi on an Pi CM4 on the Pi CM4 IO Board without any sdcard.

StephanStS Maybe you can have a look as discussed yesterday.

@hari: I did some tests and finally got it working.

Basically, you need to copy your SD card contents via the ‘dd’ command to the onboard flash and reboot. That’s all.

But life is not too easy: Before you can execute the dd command you need to ensure that the size of your SD cards partition is smaller than the onboard flash.
The following procedure is given as the user ‘root’. If you do not have root privileges, you will need to use the ‘sudo’ prefix to the commands.

Step 1: Examine your system with 'lsblk’
The goal is to find out which block device is your SD card and which one is the onboard flash.

root@dietpi:~# lsblk
NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
mmcblk0      179:0    0 29,8G  0 disk
└─mmcblk0p1  179:1    0 29,8G  0 part /
mmcblk2      179:8    0  7,3G  0 disk
└─mmcblk2p1  179:9    0  7,3G  0 part
mmcblk2boot0 179:16   0    4M  1 disk
mmcblk2boot1 179:24   0    4M  1 disk
root@dietpi:~#

You see two block devices: mmcblk0 and mmcblk2. The device mmcblk2 is the onboard flash (size 7,3G), this you can deduct from the additional boot partitions mmcblk2boot0 and mmcblk2boot1.
Additionally you see that the active root partition (SD card) is mounted to the Mountpoint ‘/’.

The final goal is to copy the partition mmcblk0p1 (from the SD card) to the partition mmcblk2p1 (onboard flash).

Step 2: Reduce your SD cards partition
In case that your SD card partition is smaller than the onboard flash you can jump over this step.
See above: You can see that the SD card (on mmcblk0) has a size of 29,8G. This partition needs to be resized to a value smaller than the 7,3G.
As a requirement, the data on your SD card needs to be less than the 7,3G. (If you cannot achieve this, you will not be able to boot from the onboard flash.)

You can resize your SD cards partition with various tools. One of them is the graphical tool gparted on a linux system with an X11 desktop. Here I do not describe how to shrink the partition size, you can search for this with the help of your favourite search engine. :slight_smile:
After you have resized the SD card, it could look like this:

root@dietpi:~# lsblk
NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
mmcblk0      179:0    0 29,8G  0 disk
└─mmcblk0p1  179:1    0  3,8G  0 part /
mmcblk2      179:8    0  7,3G  0 disk
└─mmcblk2p1  179:9    0  4,7G  0 part
mmcblk2boot0 179:16   0    4M  1 disk
mmcblk2boot1 179:24   0    4M  1 disk
root@dietpi:~#

As you can see, the size of the partition mmcblk0p1 now is 3,8G (which is less than the maximum size of 7,3G).

Step 3: Copy the SD card contents
Prepare the SD card copy with

dietpi-services stop
swapoff -a
mount -o remount,ro /

You can copy your SD card partition to the onboard flash via

dd if=/dev/mmcblk0p1 of=/dev/mmcblk2p1 bs=1M status=progress

This will take some time. Afterwards shutdown your system, remove the SD card and reboot.

Step 4: Resize your SD card
If you have booted from the onboard flash, the system looks like this:

root@dietpi:~# lsblk
NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
mmcblk2      179:0    0  7,3G  0 disk
└─mmcblk2p1  179:1    0  4,7G  0 part /
mmcblk2boot0 179:8    0    4M  1 disk
mmcblk2boot1 179:16   0    4M  1 disk
root@dietpi:~#

You can see that the size of the partition mmcblk2p1 (4,7G) is smaller than the whole onboard flash size (7,3G). To be able to use the rest of the onboard flash, start https://dietpi.com/docs/dietpi_tools/#dietpi-drive-manager to resize the partition.
See the tab ‘Move DietPi system to a larger SD card’ in the documentation to see how to maximize the partition size with the entry ‘Resize’.
After this procedure it looks like this:

root@dietpi:~# lsblk
NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
mmcblk2      179:0    0  7,3G  0 disk
└─mmcblk2p1  179:1    0  7,3G  0 part /
mmcblk2boot0 179:8    0    4M  1 disk
mmcblk2boot1 179:16   0    4M  1 disk
root@dietpi:~#

You see that the partition size is now enlarged to 7,3G.

Tataa! You have reached your target. :sunglasses: