Odroid C2, boot from SD, root from SSD

Hello

I tried since a few days to boot my odroid from the sd card and write and read from the SSD Card, because the SD card will be always damged after a few months.
So i try a lot of things…

  1. i copied the sd to the ssd (ext4)
  2. i passed the UUID number in the dietpiEnv.txt and fstab file.
  3. i set a rootdelay to 30 sec,

When i start the booting, the odroid start and stopps for a few millicseconds and start again.
I checked it, because i use a fan on the usb port, and i hear the fan not works for a short second…
After this, the odroid continue the boot and stops with: UUID not found.

When i read the console output, i saw a error message:

ONBOARD-USB error, usb disconnected. can’t read “usb” “descriptor”
onboard usbhub can’t set config #1, error -71

any idea?

There is a script that can do that…

It should boot from SD, then point the OS to the main running kernel and use the SSD as the root / partition

just make sure you enter the command line to the correct device

I guess SD card is still needed to some parts, maybe just rootFS can be moved to USB

okay, i bought a active usb hub and testet the script from github.
The script runs to the end and showed only one fail:
cp boot/cmdline not work because it didn’T exist.
so i searched and found out, that it never exists on diet pi.

next step was to edit the boot/dietpiEnv.txt and set the correct uuid from the ssd partition. The same i did with the etc/fstab file on the sd card.

It doesn’t work. After rebooting , when i enter df -h the ssd isn’t mounted and the root system is not in the list…
i have no ieda…
i added a rootdelay=30 to the dietpiEnv but it didn’t help.

the script seems to modify the fstab in the new drive
so try to modify also in the sd card

i did it, but it didn’t work

i think i found the solution (see Step 8)

Step 1:
Erase and format the SSD, GPT, ext4

  • Run the following command:
sudo parted /dev/sdX

Step 2:
Mount the SSD

sudo mkdir /mnt/ssd sudo mount /dev/sdX1 /mnt/ssd

Step 3:
Copy the SD card contents to the SSD using rsync

sudo rsync -aAXv /mnt/sd/ /mnt/sdX1/

Step 4:
Check if the data is copied to the SSD

Step 5:
Find the PARTUUID

  • Use the blkid command:
sudo blkid
  • Example output:

/dev/mmcblk0p1: UUID="2a4e89e0-dde6-4878-b9f6-b2d1962d4263" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="d0f20000-01" /dev/sda1: UUID="7a08758e-4cdd-48ce-88de-448c54ee0c8a" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="d0f20000-01"

Step 6:
Update the fstab file:
Comment out the old SD card entry and add the UUID of the new SSD below it:
sudo nano /etc/fstab

- Example entry in /etc/fstab:
# PHYSICAL DRIVES
#-----------------------------------------------------------
#old SD card  #UUID=2a4e89e0-dde6-4878-b9f6-b2d1962d4263 / ext4 noatime,lazytime,rw 0 1
UUID=7a08758e-4cdd-48ce-88de-448c54ee0c8a / ext4 defaults,nofail 0 1  # new SSD

Step 7:
Update dietpiEnv.txt:
Comment out the SD card and specify the mount point or UUID of the SSD.

sudo nano /boot/dietpiEnv.txt
  • Example:

#rootdev=UUID=2a4e89e0-dde6-4878-b9f6-b2d1962d4263 rootdev=/dev/sda1

Done!
If it doesn’t work:
If after “loading kernel,” all USB devices are disconnected, here’s the solution:

You need to update the initramfs to reset the USB devices during boot.

Step 8:
Create a script in the init-premount directory:

sudo nano /etc/initramfs-tools/scripts/init-premount/usb-reset.sh

Paste the following script:

#!/bin/sh

# USB reset script for initramfs

# Wait a few seconds to ensure all devices are available
sleep 5

# Iterate through USB devices
for device in /sys/bus/usb/devices/*; do
    # Check if the device exists
    if [ -d "$device" ]; then
        # Try to get the bus and device information
        busnum=$(cat "$device/busnum" 2>/dev/null)
        devnum=$(cat "$device/devnum" 2>/dev/null)

        # Check if values were found
        if [ -n "$busnum" ] && [ -n "$devnum" ]; then
            # Get Vendor and Product ID
            vendor_id=$(cat "$device/idVendor" 2>/dev/null)
            product_id=$(cat "$device/idProduct" 2>/dev/null)

            echo "Resetting USB device $devnum on bus $busnum"
            echo "Vendor ID: $vendor_id, Product ID: $product_id"

            # Disconnect the device
            echo "0" > "$device/authorized" 2>/dev/null
            sleep 1  # Wait a moment

            # Reconnect the device
            echo "1" > "$device/authorized" 2>/dev/null
            sleep 1  # Wait a moment
        fi
    fi
done

# Wait 60 seconds to view the output
echo "Waiting for 60 seconds to view output..."
sleep 60

# Show Vendor and Product IDs for all devices after the reset
echo "Connected USB devices after reset:"
for device in /sys/bus/usb/devices/*; do
    if [ -d "$device" ]; then
        vendor_id=$(cat "$device/idVendor" 2>/dev/null)
        product_id=$(cat "$device/idProduct" 2>/dev/null)
        
        if [ -n "$vendor_id" ] && [ -n "$product_id" ]; then
            echo "Vendor ID: $vendor_id, Product ID: $product_id"
        fi
    fi
done

Step 9:
Make the file executable:

sudo chmod +x /etc/initramfs-tools/scripts/init-premount/usb-reset.sh

Step 10:
Update the initramfs:

sudo update-initramfs -u

Done!
Reboot your system:
sudo reboot

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.