Moving file system to NVME procedure?

From what I understand I will still have to have the bootloader and kernel on an EMMC or uSD
So what’s the correct way to move the filesystem to an NVME? Is there a builtin script for this? Update grub?
I was hoping to just change a mount point in fstab but root is not even mounted from fstab.

Thanks

1 Like

First, make a partition on nvme device with fdisk or parted, the partition will be under /dev/nvme0n1p1. Then, move your rootfs from sd/emmc to nvme with dd

dd if=/dev/disk/by-partuuid/b921b045-1df0-41c3-af44-4c6f280d3fae   \
 conv=sync,noerror bs=4M of=/dev/nvme0n1p1

Extend the filesystem

resize2fs /dev/nvme0n1p1

Edit /boot/extlinux/extlinux.conf

change

root=PARTUUID=b921b045-1d

to

root=/dev/nvme0n1p1

reboot and check mount.

8 Likes

Thanks Jack

Installed and running well

Hi Jack, I can’t find /boot/extlinux/extlinux.conf on the Debian installation (/boot is empty) and fstab is also doesn’t contain ‘/’, any ideas ?
Thanks

You can install package rockchip-fstab, it will create the /boot mount point.

1 Like

Hi Jack, thanks for your help, I’m up and running now, I’ve included your details of how to setup the radxa repository, so that others can find the package more easily.

wget -O - http://apt.radxa.com/stretch/public.key | sudo apt-key add -

create /etc/apt/sources.list.d/apt-radxa-com.list and add

deb http://apt.radxa.com/stretch/ stretch main

and run

apt-get update
apt-get install rockchip-fstab
2 Likes

Hi,

@jack, thank you for help.

  Model B 4GB
  Samsung SSD 970 EVO NVMe M.2 (MZ-V7E500BW)
  Operating System: Ubuntu 18.04.2 LTS
            Kernel: Linux 4.4.154-59-rockchip-g5e70f14

After first boot:
4,5% full boot_nr_1
df -H

Filesystem Size Used Avail Use% Mounted on
/dev/root 12G -227G 239G - /
devtmpfs 2.0G 0 2.0G 0% /dev
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 2.0G 1.2M 2.0G 1% /run
tmpfs 5.3M 4.1k 5.3M 1% /run/lock
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/mmcblk0p4 105M 40M 65M 38% /boot
/dev/sda2 5.0T 4.4T 337G 93% /media/rock/my
/dev/sdb1 3.0T 2.5T 309G 89% /media/rock/backup
tmpfs 400M 0 400M 0% /run/user/0
tmpfs 400M 25k 400M 1% /run/user/1000
/dev/mmcblk0p5 16G 5.9G 9.0G 40% /media/rock/ubt-bionic

After second boot:
96.3% full !!!boot_nr_2
df -H

Filesystem Size Used Avail Use% Mounted on
/dev/root 16G 6.2G 8.7G 42% /
devtmpfs 2.0G 0 2.0G 0% /dev
tmpfs 2.0G 98M 2.0G 5% /dev/shm
tmpfs 2.0G 1.2M 2.0G 1% /run
tmpfs 5.3M 4.1k 5.3M 1% /run/lock
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/mmcblk0p4 105M 40M 65M 38% /boot
/dev/sda2 5.0T 4.4T 337G 93% /media/rock/my
/dev/sdb1 3.0T 2.5T 309G 89% /media/rock/backup
tmpfs 400M 0 400M 0% /run/user/0
tmpfs 400M 41k 400M 1% /run/user/1000
/dev/mmcblk0p5 16G 5.9G 9.0G 40% /media/rock/ubt-bionic

blkid

/dev/nvme0n1p1: LABEL=“ubt-bionic” UUID=“9d4f00d3-3731-4dac-a791-7dbd9cb156e2” TYPE=“ext4” PARTUUID=“11632fb8-01”
/dev/mmcblk0p4: SEC_TYPE=“msdos” LABEL=“boot” UUID="(…)" TYPE=“vfat” PARTLABEL=“boot” PARTUUID="(…)"
/dev/mmcblk0p5: LABEL=“ubt-bionic” UUID="(…)" TYPE=“ext4” PARTLABEL=“rootfs” PARTUUID="(…)"
/dev/sda2: LABEL=“my” (…)
/dev/sdb1: LABEL=“backup” (…)

… something is wrong e.g: when I try to save a file ~ 20GB to the desktop:
There is 8.7 GB available, but 20.0 GB is required, write speed ~30MB/s.

any ideas ? :slight_smile:

when the rootfs is full, what cat /proc/cmdline shows? It seems the rootfs fall back to emmc.

@jack, cat /proc/cmdline:

earlyprintk console=ttyFIQ0,1500000n8 rw init=/sbin/init root=/dev/nvme0n1p1 rootwait rootfstype=ext4

I don’t have emmc, Micro SD Card only.

How many partitions are there on your SSD? If nvme0n1p1 is your only partition, I’d suggest to try resize2fs /dev/nvme0n1p1 to grow the file system

1 Like

Hi,
when I try this, I get an error:

apt-get install rockchip-fstab
Reading package lists... Done
Building dependency tree
Reading state information... Done
rockchip-fstab is already the newest version (0.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up rockchip-fstab (0.1) ...
sed: -e expression #1, char 0: no previous regular expression
mount all partitions
mount: mount point vfat does not exist
mount: mount point vfat does not exist
mount: mount point vfat does not exist
mount: mount point vfat does not exist
mount: mount point vfat does not exist
mount: mount point vfat does not exist
mount: mount point vfat does not exist
mount: mount point vfat does not exist
mount: mount point vfat does not exist
mount: mount point vfat does not exist
mount: mount point vfat does not exist
mount: mount point vfat does not exist
mount: mount point vfat does not exist
mount: mount point vfat does not exist
mount: mount point vfat does not exist
dpkg: error processing package rockchip-fstab (--configure):
 subprocess installed post-installation script returned error exit status 32
Errors were encountered while processing:
 rockchip-fstab
E: Sub-process /usr/bin/dpkg returned an error code (1)

To make the target system work you may need to edit /etc/fstab.

How should I proceed when I am moving from eMMC to SSD connected via USB?

I’ve made exact same partition on SSD (sector count is equal), copied, fsck’ed, mounted, rsynced from eMMC to SSD, emptied fstab and the system does not boot…
Nothing on HDMI screen but the monitor is active = there is signal.

extlinux.conf on eMMC (for boot purpose only):

timeout 10
menu title select kernel

label kernel-4.4.154-95-rockchip-gd2ab1f26e1b3
    kernel /vmlinuz-4.4.154-95-rockchip-gd2ab1f26e1b3
    devicetreedir /dtbs/4.4.154-95-rockchip-gd2ab1f26e1b3
    append earlyprintk console=ttyFIQ0,1500000n8 rw init=/sbin/init rootfstype=ext4 rootwait root=/dev/sda3

Should fstab have root fs entry?

1 Like

root=/dev/sda3 this is wrong. It should be sda5, check:

https://wiki.radxa.com/Rockpi4/partitions

@jack I’ve made everything as in second post here. The partitions on eMMC are like they was, so 5 of them. But the SSD I’ve created like that:
1st partition Ubuntu x64 for Intel
2nd partition data in ext4
3rd partition Rock’s Ubuntu copied from 5th eMMC partition, so these are all filesystem files and folders beside boot folder

So should I understand that partitions on SSD should be exactly like on eMMC?
I don’t see a need like that here.

Can’t be the root filesystem only on SSD?

Rest of the files (extlinux.conf, fstab) were edited by me accordingly but this does not make the system start.

Also: should the SSD be GPT? Is msdos like partition table ok for Rock?

Also: should the SSD be GPT? Is msdos like partition table ok for Rock?

Not necessary. As long as you can mount the SSD under Linux, you can use it as rootfs. Maybe you can check if the rootfs is good by chroot to it booting from eMMC. Also, add console=tty1 to the comnadline helps to check what’s happening if you don’t have serial console.

No relevant error I see. Rock just stops after few seconds. See picture.

Chroot works fine to /media/sda3 folder with SSD (copy of eMMC). Some warnings only.

Emptying /etc/fstab still boots eMMC but didn’t helped with SSD.

I believe we need some driver for the usb device, maybe we should enable the ramdisk. Try to edit

/boot/extlinux/extlinux.conf

add line after kernel line

initrd /initrd.img-4.4.154-90-rockchip-ga14f6502e045

or the kernel ramdisk you use. reboot to check if it works.

:smiley: It is working! Great! Thank you! :slight_smile:

/boot/extlinux/extlinux.conf now looks like that:

timeout 10
menu title select kernel

label kernel-4.4.154-95-rockchip-gd2ab1f26e1b3
    kernel /vmlinuz-4.4.154-95-rockchip-gd2ab1f26e1b3
    initrd /initrd.img-4.4.154-95-rockchip-gd2ab1f26e1b3
    devicetreedir /dtbs/4.4.154-95-rockchip-gd2ab1f26e1b3
    append earlyprintk console=tty1 rw init=/sbin/init rootfstype=ext4 rootwait root=/dev/sda3

Now I have write speed to / at levels of 241-264 MB/s! That’s fantastic!

1 Like

And how exactly did you get those numbers? Which tells nothing …

My (properly made) tests (on similar RK3399 based hardware) shows from 50 MB/S (4k) up to 1200 MB/s (16k)