Forum

Full Version: Cubox-i and RPi 2 booting from USB (WARNING)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I successfully used the xbian-copier on the CB and changed the boot.scr.txt to point to sda1. Rebooted and all worked as expected.

However, (This was reported in the CB thread) that when additional USB drives were attached the CB failed to boot.

It seemed that the drive locations change during a reboot - possibly USB hub get's priority over the CB USB port.

Removing all additional USB drives, the CB booted off of the USB boot drive successfully.

So I tried it on the RPI2 with full updates.

NB: **** The Xbian-copier works on copy and image creation (I restored from the img file created)

All went well. Used the Xbian-copier to write to a USB flash drive, changed cmdline.txt to point to sda1 and it booted successfully.

******** THIS IS WHERE IT ALL WENT WRONG **********

I then attached a USB HDD and a USB Flash drive and rebooted.

The boot USB was in the RPi2 (Slot 1 if 1 is top left as looking at the 4 ports) and the others on a USB HUB.

The system seemed to boot with the xbian init screen and then I saw resize, copying root directory and then it hung.

Checking the USB drives, I saw that my USB Flash drive now had xbian files written to it.

It would seem that "somewhere" the kernel is favouring another port as sda1 when additional USB ports are used.

BUT what is more worrying is that XBian started writing files to my USB Flash drive and even began to partition it.

Has anyone managed to get the CB or RPi2 to boot from the USB in the same scenario?
Couldn't that be easily resolved with udev?
This is pretty normal - see http://www.ibm.com/developerworks/library/l-boot-rootfs/ for a ~detailed explanation.

Use the label or UUID of the partition. So change "root=/dev/something" in cmdline.txt to root=LABEL=xbian or root=UUID=123456.
Both are shown in the output of "blkid":
Terminal
xbian@xbian ~ $ sudo blkid
/dev/mmcblk0p1: SEC_TYPE="msdos" LABEL="xbianboot" UUID="E79D-A183" TYPE="vfat"
/dev/mmcblk0p2: LABEL="xbian" UUID="9852b9d5-35a5-4132-964f-e07532dad70f" UUID_SUB="94ba7d57-7ac1-44d3-b149-8f179d339959" TYPE="btrfs"
/dev/root: LABEL="xbian" UUID="9852b9d5-35a5-4132-964f-e07532dad70f" UUID_SUB="94ba7d57-7ac1-44d3-b149-8f179d339959" TYPE="btrfs"

See also the wiki: http://wiki.xbian.org/doku.php/installation_usb#to_another_device
@menakite Nice diagnosis.
Wonderful. That was my thought to use the UUID but I didn't know how. Will give it a go.
Ok, It's now running on the Flash Drive.
However, I have noticed that the original swap partition (on the SD card) is still being used. Is there a way to stop it being used? There's nothing in FSTAB. I guess I could just reformat it but then I'd have issues if I wanted to go back to the SD card for whatever reason.
I think I tried removing the swap partition and it was regenerated, I could be mistaken though. I have just been using 'sudo swapoff - a' since I rarely reboot.
Add "noswap" to your cmdline.txt. It prevents the creation of a swap partition on boot (but existing ones should be deleted manually).
I didn't need it even on a Pi 1 (512 MB).
Ok, thanks. Looks like the best way is to delete the swap partition on the SD card as it looks like XBian (Debian) allocates all drives that are classed as "SWAP".

I still want "some" swap but not on the SD card or at least as a last resort. I can't see a way to lower the priority on just one swap partition. So it will swap to the flash drive first and only if necessary to the SD card.

On another note: I tried "many times" to create a boot partition on a SSD USB "Hard drive" without success. It gets as far as init and then just reboots.

I've tried dev/sda1 UUID=xxxx but without any success. Is this because it's not recognised as a USB drive?
(18th Mar, 2015 08:04 PM)IriDium Wrote: [ -> ]I still want "some" swap but not on the SD card or at least as a last resort. I can't see a way to lower the priority on just one swap partition. So it will swap to the flash drive first and only if necessary to the SD card.

It seems a swap priority problem
You can set different priorities in fstab or with swapon

/dev/sda1 none swap defaults,pri=100 0 0
/dev/sdb2 none swap defaults,pri=10 0 0

# swapon -p 100 /dev/sda1

But maybe I'm mistaken since I don't kwown Cubox
Reference URL's