субота, 01. јул 2017.

Odroid XU4 boot from hard disk

I have Odroid XU4 computer. It is a nice piece of machine. It has 8 cores, Gigabit Ethernet, USB3.0. It can boot from uSD card, or eMMC module. However, I have experienced frequent uSD card crashes, so severe, that the Odroid wouldn't boot afterwards. It would happen when Odroid does some intensive write to the file system. It would simply mess up the file system beyond repair.

That is why I have decided to find instructions how to boot this device from a hard disk.

First of all, you cannot make your Odroid XU4 completely boot from the hard disk. It will start the boot process from the uSD card, and then it will mount the root file system on the hard disk, instead on the uSD card.

There is a nice post on the official Odroid forum. It says that you need to write the image on your uSD card and then boot the Odroid. When it boots successfully, you can then connect the external USB hard disk. Then you need to format that external hard disk to ext4 file system:

mkfs.ext4 /dev/sda1

Now you need to copy the content of the uSD root partition to the external hard disk:

mkdir /tmp/sda1
mount /dev/sda1 /tmp/sda1
rsync -avx / /tmp/sda1
umount /dev/sda1

After that, type blkid to see UUIDs of all disks connected to your Odroid. The output would be like this:

/dev/sda1: UUID="86135-2ba3-45cf-bda0-317b" TYPE="ext4" PARTUUID="ab57-01"
/dev/mmcblk0: PTUUID="3ceda53" PTTYPE="dos"
/dev/mmcblk0p1: SEC_TYPE="msdos" LABEL="boot" UUID="5A5A-6868" TYPE="vfat" PARTUUID="3cd53-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="e139-fe3-99859" TYPE="ext4" PARTUUID="3cd53-02"

Hard disk is /dev/sda1. You need to remember its UUID, since you need to put it in two places: /media/boot/boot.ini file, and /etc/fstab file (before unmounting the temporary mount, it was: /tmp/sda1/etc/fstab).

Make copies of both files, then edit the /media/boot/boot.ini file first. Find the line in which the root file system is mounted:

setenv bootrootfs “console=tty1
console=ttySAC2,115200n8 root=UUID=e139-fe3-99859 rootwait ro”

Substitute the original UUID with the UUID of the hard disk. This way, the Odroid will continue boot from the hard disk instead from the uSD card:

setenv bootrootfs “console=tty1
console=ttySAC2,115200n8 root=UUID=86135-2ba3-45cf-bda0-317b rootwait ro”

Next, open the /etc/fstab file (before unmounting the temporary mount, it was: /tmp/sda1/etc/fstab). Change the original UUID to the UUID of the hard disk:

UUID=86135-2ba3-45cf-bda0-317b / ext4 errors=remount-ro,noatime 0 1
LABEL=boot /media/boot vfat defaults 0 1

With this change, you will have the external hard disk permanently mounted.

I have written couple of instructions about setting up Raspberry Pi here.

2 коментара:

  1. I think I have the same problem with my SD card.
    Thank you, the rootfs migration worked perfectly!

    ОдговориИзбриши
  2. You are welcome. I have used the same strategy for my Raspberry Pi 3 to boot it from the USB hard disk, but without that One-Time-Programmable Memory stuff (program_usb_boot_mode=1 and so on). I just didn't want to permanently set my RPI to boot from USB hard disk, it loads kernel from the SD card, and then mounts hard disk as a rootfs, just like the Odroid.

    ОдговориИзбриши