Haemogoblin
Posts: 182
Joined: Mon Sep 24, 2012 12:13 pm
Location: United Kingdom
Contact: Website

Booting from usb advice needed

Tue Feb 13, 2018 6:22 pm

So I decided I wanted to boot my RPi2 model B from USB flash drive. However the guide I was following doesn't explain what to do if your usb partition has the same PARTUUID as the SD card

Booting from USB is easy on a Pi1, Pi2, or Pi3:

1. Write the latest Raspbian image to an SD card and boot it.

2. Write the latest Raspbian image to a USB drive and plug it into the Pi.

3. Run blkid to determine the PARTUUID of the USB drive.

4. Edit /boot/cmdline.txt and change root=PARTUUID=xxxxxxxx to match the PARTUUID of the USB drive.

5. Reboot. The Pi should be running from the USB drive.

blkid produces the following result.

/dev/mmcblk0p1: LABEL="boot" UUID="CDD4-B453" TYPE="vfat" PARTUUID="0de7b4f8-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="72bfc10d-73ec-4d9e-a54a-1cc507ee7ed2" TYPE="ext4" PARTUUID="0de7b4f8-02"
/dev/sda1: LABEL="boot" UUID="CDD4-B453" TYPE="vfat" PARTUUID="0de7b4f8-01"
/dev/sda2: LABEL="rootfs" UUID="72bfc10d-73ec-4d9e-a54a-1cc507ee7ed2" TYPE="ext4" PARTUUID="0de7b4f8-02"
Blackadder: Right Baldrick, let's try again, shall we? This is called adding. If I have two beans, and then I add two more, what do I have?
Baldrick: Some beans

asandford
Posts: 1996
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: Booting from usb advice needed

Wed Feb 14, 2018 1:00 am

Haemogoblin wrote:
Tue Feb 13, 2018 6:22 pm
So I decided I wanted to boot my RPi2 model B from USB flash drive. However the guide I was following doesn't explain what to do if your usb partition has the same PARTUUID as the SD card

Booting from USB is easy on a Pi1, Pi2, or Pi3:

1. Write the latest Raspbian image to an SD card and boot it.

2. Write the latest Raspbian image to a USB drive and plug it into the Pi.

3. Run blkid to determine the PARTUUID of the USB drive.

4. Edit /boot/cmdline.txt and change root=PARTUUID=xxxxxxxx to match the PARTUUID of the USB drive.

5. Reboot. The Pi should be running from the USB drive.

blkid produces the following result.

/dev/mmcblk0p1: LABEL="boot" UUID="CDD4-B453" TYPE="vfat" PARTUUID="0de7b4f8-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="72bfc10d-73ec-4d9e-a54a-1cc507ee7ed2" TYPE="ext4" PARTUUID="0de7b4f8-02"
/dev/sda1: LABEL="boot" UUID="CDD4-B453" TYPE="vfat" PARTUUID="0de7b4f8-01"
/dev/sda2: LABEL="rootfs" UUID="72bfc10d-73ec-4d9e-a54a-1cc507ee7ed2" TYPE="ext4" PARTUUID="0de7b4f8-02"
You don't have to use PARTUUID, you can specify the device, here's mine:

Code: Select all

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/sda1 rootfstype=ext4 elevator=deadline rootwait
This Pi still has an SD card with the bootloader (/boot) on it, only linux (/) is on the hdd

n67
Posts: 839
Joined: Mon Oct 30, 2017 4:55 pm

Re: Booting from usb advice needed

Wed Feb 14, 2018 5:55 am

You don't have to use PARTUUID, you can specify the device, here's mine:
Yes, but that's cheating.

I.e., the way I read the OP, the goal was to get it working with PARTUUID. Anyone can do it the easy/cheating way...

But, seriously, the point of the PARTUUID thing is so that if you have more than one /dev/sd* device connected, it will find the right one.

That all said, you are absolutely right that OP should get it working first with /dev/sda1 (or whatever it is), and then worry about PARTUUID stuff later on.

(Unless, of course, he's already done so and is now onto the next step already...)
"L'enfer, c'est les autres"

If a post offends you, just put that poster on your foes list, and be done with it (and with them).

To do otherwise, risks being banned.

User avatar
PeterO
Posts: 4257
Joined: Sun Jul 22, 2012 4:14 pm

Re: Booting from usb advice needed

Wed Feb 14, 2018 7:47 am

Am I missing something here... Why would it be a problem when booting from the USB drive as the SD card has to be removed (otherwise it will boot from t the SDCard).

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),Aeromodelling,1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
davidcoton
Posts: 3189
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Booting from usb advice needed

Wed Feb 14, 2018 10:29 am

PeterO wrote:
Wed Feb 14, 2018 7:47 am
Am I missing something here... Why would it be a problem when booting from the USB drive as the SD card has to be removed (otherwise it will boot from t the SDCard).

PeterO
@PeterO, I think you are missing two things:
  1. The OP talks about
    Booting from USB is easy on a Pi1, Pi2, or Pi3
    which implies inuitial booting from SDCard and transferring to the USB system during the boot process
  2. PARTUUID allows correct selection of the expected USB mass storage device even if more than one is connected.
"Thanks for saving my life." See https://www.raspberrypi.org/forums/viewtopic.php?p=1327656#p1327656
“Raspberry Pi is a trademark of the Raspberry Pi Foundation”

Haemogoblin
Posts: 182
Joined: Mon Sep 24, 2012 12:13 pm
Location: United Kingdom
Contact: Website

Re: Booting from usb advice needed

Sat Feb 17, 2018 6:57 pm

Hey guys

As I did mention I was following something I saw on the forum. A fellow user was the one who posted;

"Booting from USB is easy on a Pi1, Pi2, or Pi3:

1. Write the latest Raspbian image to an SD card and boot it.

2. Write the latest Raspbian image to a USB drive and plug it into the Pi.

3. Run blkid to determine the PARTUUID of the USB drive.

4. Edit /boot/cmdline.txt and change root=PARTUUID=xxxxxxxx to match the PARTUUID of the USB drive.

5. Reboot. The Pi should be running from the USB drive."

I didn't write that, i was simply quoting lol

But yes, I do think i need to use PARTUUID as this is being implemented on my mini pi file server which will have the following configuration.

1x wifi adapter
1x 16gb flash drive (system disk)
2x 64gb San disk flash drives (file storage)

The 64gb flash drives will spend much of their life connected to the Oi, however I will remove them occasionally for backing up purposes. The last thing I want is for one of the storage drives to suddenly become SDA1 when its reconnected to the Pi.

p.s Yes I got it working fine with the /dev/sda1 method, however after reading how it might not be suitable for my setup, I was seeking a more permanent solution.
Blackadder: Right Baldrick, let's try again, shall we? This is called adding. If I have two beans, and then I add two more, what do I have?
Baldrick: Some beans

n67
Posts: 839
Joined: Mon Oct 30, 2017 4:55 pm

Re: Booting from usb advice needed

Sat Feb 17, 2018 7:18 pm

The 64gb flash drives will spend much of their life connected to the Oi, however I will remove them occasionally for backing up purposes. The last thing I want is for one of the storage drives to suddenly become SDA1 when its reconnected to the Pi.
That can't happen. All that matters is what's connected when the machine is booted.

The only potential problem area is if more than one USB mass storage device is attached at boot time.

So, if you follow this procedure:

1) Boot with only the one USB device (the one you want to boot from) connected.

2) Once booted, you can plug or unplug whatever you like to your heart's content.

You'll have no problems.
"L'enfer, c'est les autres"

If a post offends you, just put that poster on your foes list, and be done with it (and with them).

To do otherwise, risks being banned.

Haemogoblin
Posts: 182
Joined: Mon Sep 24, 2012 12:13 pm
Location: United Kingdom
Contact: Website

Re: Booting from usb advice needed

Sat Feb 17, 2018 9:01 pm

That will prove really inconvenient, as it is sometimes necessary to reboot the system remotely. So I wont physically be able to unplug the devices. This is why i wanted to use the PARTUUID to avoid this very problem, hence my original post.
Blackadder: Right Baldrick, let's try again, shall we? This is called adding. If I have two beans, and then I add two more, what do I have?
Baldrick: Some beans

User avatar
PeterO
Posts: 4257
Joined: Sun Jul 22, 2012 4:14 pm

Re: Booting from usb advice needed

Sat Feb 17, 2018 9:25 pm

davidcoton wrote:
Wed Feb 14, 2018 10:29 am
[
@PeterO, I think you are missing two things:
  1. The OP talks about
    Booting from USB is easy on a Pi1, Pi2, or Pi3
    which implies inuitial booting from SDCard and transferring to the USB system during the boot process
  2. PARTUUID allows correct selection of the expected USB mass storage device even if more than one is connected.
And of course the OP is missing the point that you CANT actually boot from just a USB device on those PIs! This thread's title is wrong as the OP is not talking about booting from USB, but booting from SDcard them mounting the root filesystem from a USB device.
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),Aeromodelling,1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Haemogoblin
Posts: 182
Joined: Mon Sep 24, 2012 12:13 pm
Location: United Kingdom
Contact: Website

Re: Booting from usb advice needed

Sat Feb 17, 2018 11:02 pm

Well so for I've been able to sort the problem out and get the pi booting from the flash drive, i was also able to sort out what was going on the the identical PARTUUID's. Because I'm burning the same image of Raspbian Lite to SD and Flash Drive, it would appear they share the same PARTUUID. The way I got around this initially is by temporarily changing the cmdline.txt so that root = /dev/sda2

The Pi will then boot up and continue the boot sequence from USB, from there I perform a sudo blkid and discovered that suddenly the two devices has different PARTUUID's. I went back and updated the cmdline.txt file to reflect the change and the system continued to boot fine even with additional usb drives added.

Not sure I can say this is solved yet as i'm now having issue with the USB devices not automatically mounting, which is a bit annoying.

PeterO - As I stated in my initial post, from the beginning I was trying to boot a RPI2 from usb. I'd have thought it was pretty much a given that I'm using an SD card initially, as only the Pi3 can use USB device as a primary boot device.
Blackadder: Right Baldrick, let's try again, shall we? This is called adding. If I have two beans, and then I add two more, what do I have?
Baldrick: Some beans

User avatar
PeterO
Posts: 4257
Joined: Sun Jul 22, 2012 4:14 pm

Re: Booting from usb advice needed

Sat Feb 17, 2018 11:18 pm

Haemogoblin wrote:
Sat Feb 17, 2018 11:02 pm
PeterO - As I stated in my initial post, from the beginning I was trying to boot a RPI2 from usb. I'd have thought it was pretty much a given that I'm using an SD card initially, as only the Pi3 can use USB device as a primary boot device.
So, if you knew that, why did you use a misleading thread title that makes it look like you didn't understand the real situation ?

If you want help from people you should always try to be as accurate as possible with the language you use to describe your situation and problem.

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),Aeromodelling,1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Haemogoblin
Posts: 182
Joined: Mon Sep 24, 2012 12:13 pm
Location: United Kingdom
Contact: Website

Re: Booting from usb advice needed

Sat Feb 17, 2018 11:29 pm

Because it was an error and because I'd seen so many threads on the forum that had "booting rpi from usb" in the title and were not aimed at the pi3, that i didn't think it would matter.

Now with the semantics out the way, on to the issue at hand :-)
Blackadder: Right Baldrick, let's try again, shall we? This is called adding. If I have two beans, and then I add two more, what do I have?
Baldrick: Some beans

n67
Posts: 839
Joined: Mon Oct 30, 2017 4:55 pm

Re: Booting from usb advice needed

Sat Feb 17, 2018 11:38 pm

Now with the semantics out the way, on to the issue at hand :-)
For some of the posters here, it is all about semantics.
"L'enfer, c'est les autres"

If a post offends you, just put that poster on your foes list, and be done with it (and with them).

To do otherwise, risks being banned.

asandford
Posts: 1996
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: Booting from usb advice needed

Sun Feb 18, 2018 12:38 am

n67 wrote:
Wed Feb 14, 2018 5:55 am
You don't have to use PARTUUID, you can specify the device, here's mine:
Yes, but that's cheating.
When that sd card was created, that was the only way you could do it; PARTUUID wasn't a valid parameter.

Haemogoblin
Posts: 182
Joined: Mon Sep 24, 2012 12:13 pm
Location: United Kingdom
Contact: Website

Re: Booting from usb advice needed

Sun Feb 18, 2018 12:45 am

I've just been reading up on it, apparently my options are

A, delete the root partition and recreate it
B, possibly use parted to assign a knew partuuid (tried this and it didn't work)

There has to be a way around it

Could someone explain to me what this is on about

https://www.raspberrypi.org/documentati ... bootmodes/
For the original Raspberry Pi and the Raspberry Pi 2 (based on the BCM2835 and BCM2836 devices), and in situations where the Pi 3 fails to boot, there is a new method of booting from one of the new boot modes (MSD or ethernet).

Just format an SD card as FAT32 and copy on the latest bootcode.bin.

This will then enable the new bootmodes with some bug fixes for the failing Pi 3 cases.

If you have a problem with a mass storage device still not working even with this bootcode.bin, then please add a new file 'timeout' to the SD card. This should extend the time it waits for the mass storage device to initialise to six seconds.
I tried the above, blanked an SD card, popped the file on and then stuck it in the pi. Result, the thing just sat there with both power and activity lights on constantly.
Blackadder: Right Baldrick, let's try again, shall we? This is called adding. If I have two beans, and then I add two more, what do I have?
Baldrick: Some beans

asandford
Posts: 1996
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: Booting from usb advice needed

Sun Feb 18, 2018 12:58 am

Haemogoblin wrote:
Sun Feb 18, 2018 12:45 am
I've just been reading up on it, apparently my options are

A, delete the root partition and recreate it
B, possibly use parted to assign a knew partuuid (tried this and it didn't work)
You could always have fun with iscsi

RonR
Posts: 275
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Booting from usb advice needed

Sun Feb 18, 2018 1:38 am

Running Raspbian on USB Devices : Made Easy

viewtopic.php?t=196778&p=1230182#p1230182

asandford
Posts: 1996
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: Booting from usb advice needed

Sun Feb 18, 2018 2:26 am

RonR wrote:
Sun Feb 18, 2018 1:38 am
Running Raspbian on USB Devices : Made Easy

viewtopic.php?t=196778&p=1230182#p1230182
Good luck getting that working on a Pi1 (as the OP wanted).

Haemogoblin
Posts: 182
Joined: Mon Sep 24, 2012 12:13 pm
Location: United Kingdom
Contact: Website

Re: Booting from usb advice needed

Sun Feb 18, 2018 2:34 am

asandford wrote:
Sun Feb 18, 2018 2:26 am
RonR wrote:
Sun Feb 18, 2018 1:38 am
Running Raspbian on USB Devices : Made Easy

viewtopic.php?t=196778&p=1230182#p1230182
Good luck getting that working on a Pi1 (as the OP wanted).
Erm no, as my first post clearly states
So I decided I wanted to boot my RPi2 model B from USB flash drive
Blackadder: Right Baldrick, let's try again, shall we? This is called adding. If I have two beans, and then I add two more, what do I have?
Baldrick: Some beans

RonR
Posts: 275
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Booting from usb advice needed

Sun Feb 18, 2018 7:20 am

asandford wrote:
Sun Feb 18, 2018 2:26 am
RonR wrote:
Sun Feb 18, 2018 1:38 am
Running Raspbian on USB Devices : Made Easy

viewtopic.php?t=196778&p=1230182#p1230182
Good luck getting that working on a Pi1 (as the OP wanted).
O ye of little faith.

I just ran it on a Pi1 and it works perfectly:

Code: Select all

[email protected]:~# ./rpi-info

Raspberry Pi 1 Model B [512MB] / PCB v2.0 (2012 Q4 / Sony)

CPU - Temp: 51.382 C / Clock: 700.000 MHz
RAM - Arm: 480 M / Gpu: 32 M
Load: 0.12 0.28 0.17

Raspbian GNU/Linux 9.3 (stretch)

Code: Select all

[email protected]:~# mount
/dev/sda2 on / type ext4 (rw,noatime,data=ordered)
...
/dev/sda1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
Why shouldn't it work on a Pi1?

User avatar
PeterO
Posts: 4257
Joined: Sun Jul 22, 2012 4:14 pm

Re: Booting from usb advice needed

Sun Feb 18, 2018 8:13 am

n67 wrote:
Sat Feb 17, 2018 11:38 pm
Now with the semantics out the way, on to the issue at hand :-)
For some of the posters here, it is all about semantics.
It's all about the semantics because if you want the right answer to your problem you have to ask the right question !
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),Aeromodelling,1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Haemogoblin
Posts: 182
Joined: Mon Sep 24, 2012 12:13 pm
Location: United Kingdom
Contact: Website

Re: Booting from usb advice needed

Sun Feb 18, 2018 4:48 pm

PeterO if you have nothing to contribute to the thread, other then continued criticism, could you please leave it for others to reply, thank you.


RonR - Thanks for the link, I've downloaded the file and will give it a shot :-) Fingers crossed!
Blackadder: Right Baldrick, let's try again, shall we? This is called adding. If I have two beans, and then I add two more, what do I have?
Baldrick: Some beans

Haemogoblin
Posts: 182
Joined: Mon Sep 24, 2012 12:13 pm
Location: United Kingdom
Contact: Website

Re: Booting from usb advice needed

Sun Feb 18, 2018 7:01 pm

RonR wrote:
Sun Feb 18, 2018 7:20 am
asandford wrote:
Sun Feb 18, 2018 2:26 am
RonR wrote:
Sun Feb 18, 2018 1:38 am
Running Raspbian on USB Devices : Made Easy

viewtopic.php?t=196778&p=1230182#p1230182
Good luck getting that working on a Pi1 (as the OP wanted).
O ye of little faith.

I just ran it on a Pi1 and it works perfectly:

Code: Select all

[email protected]:~# ./rpi-info

Raspberry Pi 1 Model B [512MB] / PCB v2.0 (2012 Q4 / Sony)

CPU - Temp: 51.382 C / Clock: 700.000 MHz
RAM - Arm: 480 M / Gpu: 32 M
Load: 0.12 0.28 0.17

Raspbian GNU/Linux 9.3 (stretch)

Code: Select all

[email protected]:~# mount
/dev/sda2 on / type ext4 (rw,noatime,data=ordered)
...
/dev/sda1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)

RonR, thanks for posting that link. That program worked like a charm, the pi is booting from USB drive without issue. I've yet to try introducing another USB pen in to the mix, hopefully it won't cock things up *fingers crossed*

Why shouldn't it work on a Pi1?
Blackadder: Right Baldrick, let's try again, shall we? This is called adding. If I have two beans, and then I add two more, what do I have?
Baldrick: Some beans

fbe
Posts: 347
Joined: Thu Aug 17, 2017 9:08 pm

Re: Booting from usb advice needed

Sun Feb 18, 2018 8:06 pm

RonR wrote:
Sun Feb 18, 2018 7:20 am
O ye of little faith.

I just ran it on a Pi1 and it works perfectly:

Code: Select all

[email protected]:~# ./rpi-info

Raspberry Pi 1 Model B [512MB] / PCB v2.0 (2012 Q4 / Sony)

CPU - Temp: 51.382 C / Clock: 700.000 MHz
RAM - Arm: 480 M / Gpu: 32 M
Load: 0.12 0.28 0.17

Raspbian GNU/Linux 9.3 (stretch)

Code: Select all

[email protected]:~# mount
/dev/sda2 on / type ext4 (rw,noatime,data=ordered)
...
/dev/sda1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
Why shouldn't it work on a Pi1?
I wonder if a system with your configuration will survive a kernel update without manually synchronizing the boot partition on the SD card.

Haemogoblin
Posts: 182
Joined: Mon Sep 24, 2012 12:13 pm
Location: United Kingdom
Contact: Website

Re: Booting from usb advice needed

Sun Feb 18, 2018 9:16 pm

Does a kernal update happen during a sudo apt-get upgrade? or only through a raspi-update?
Blackadder: Right Baldrick, let's try again, shall we? This is called adding. If I have two beans, and then I add two more, what do I have?
Baldrick: Some beans

Return to “Advanced users”