boot-from-nvme

From Vivid Unit

Vivid Unit comes with an M.2 connector and you can connect an NVME SSD to it.

SSD will give you much bigger storage space (Vivid Unit has 32GB eMMC storage) and better read/write speed. However the advantage of booting from SSD instead of eMMC is rather limited -- you will only see one or two seconds faster on boot. It is usually acceptable to let the device boot from eMMC while using NVME SSD as extra storage.

If you do want the device to boot from NVME SSD, you can migrate the root file system to SSD. Below are the instructions.

sudo gdisk /dev/nvme0n1p1

Type 'o' (create partition) and then type 'n' (new partition), press ENTER twice to use the default sector parameters (this will create one partition for the whole NVME SSD). Type 'w' to save the partition data.

Run this command to format the newly created partition to ext4:

sudo mkfs.ext4 /dev/nvme0n1p1

Now you can migrate the root file system to SSD. Run this command in your Vivid Unit to download the script:

wget https://www.vividunit.com/download/scripts/change-rootfs-storage.sh

Make it executable:

chmod +x change-rootfs-storage.sh

Install the rsync package first:

sudo apt install rsync

Run the script:

sudo ./change-rootfs-storage.sh /dev/nvme0n1p1

After the script finish running, you can reboot the device. Run command "lsblk" you will see the NVME SSD is mounted to '/', which means the root file system has been migrated to the SSD.

By default the eMMC is no longer mounted. However the eMMC is still onboard and you can still use it as an extra 32GB storage. You just need to mount eMMC again. The command below is to mount eMMC to '/mnt':

sudo mount /dev/mmcblk0p7 /mnt

This eMMC still keeps its data. If you remove the NVME SSD, your Vivid Unit can still boot from its eMMC. However if you erase the data on eMMC, it will become un-bootable and you need to re-install OS to eMMC if you remove the SSD.