Which command to see what device is booted from? #129
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hi, I've cloned to USB and rebooted, the SD still inserted, now how can I determine from which device has booted? There is any command "sudo rpi-clone -check" that may tell me the situation? Thanks
I've opened cmdline.txt but there is nothing interesting there, only "root=PARTUUID=b6b3f6b9-02" but what it is I don't know
Use
mount
andblkid
thanks, may you please write me step by step ech command to type? sorry I'm not really expert here
With mount you detect which partitions are used for
/boot
and/
(rootfs). Withblkd
you get the UUIDs used by these partitions.Example I executed on one of my Raspberries:
Example of a PXE booted Raspberry:
thank you for your kind answer :)
May I also ask, how exacly rpi-clone works? For example:
I have cloned with "sudo rpi-clone -f -v sda"
This is helpful to understand how I can quickly manage a failure with a backup. Thank you!
EDIT: reading back instructions I think here is the trick, but sorry I can't understand it well, maybe better rewriting it in a more clear way.
-l - leave SD card to USB boot alone when cloning to SD card mmcblk0
from a USB boot. This preserves a SD card to USB boot setup
by leaving the SD card cmdline.txt using the USB root. When
cloning to USB from SD card this option sets up the SD card
cmdline.txt to boot to the USB disk.
so if I?m cloning from SD to USB and I use -l the next reboot will use the boot partition of SD, but the rootfs partition od USB. Will the SD rootfs be mounted too?
From USB to SD, it keeps as well the rootfs of USB.
Now if I want to change just the boot method, should I do a full clone or there is a quicker way to set only boot flags?
And, as before, if for example I set the USB for rootfs but it is not present, they system will not boot?
I haven't checked the code in detail. I wrote my own backup tool.
I've checked myself, to be honest the author explained it, but maybe too deep )) I mean, there are too many concepts and words, and it's easy to get in trouble/don't be sure. In this care are better the examples in my opinion, what I understood is:
the parameter -l will always set the boot to USB, to do that, as the Pi always will use SD (if present) as the first boot device, it's needed to change the boot on SD to tell the raspbian to jump suddenly on USB. That means the USB will always work as boot device, even if the SD is extracted, as a second valid priority boot device, but to make the SD boot on itself again it's needed to change back its boot.
Luckly the author made it really easy, just rename the original cmdline.txt.boot to cmdline.txt, (backup the existing one to cmdline.txt.usb if you want to boot again from usb in future).
As the author used PARTUUID to identify the boot device, and as the PARTUUID changes for every device (it's like a serial number) I suppose the system will be bootable with only that USB, if the SD card will still inserted (remove it then, to use another USB, ot repeat the clone to a new USB again with -l)
To check which device is used for boot, I typically run
lsblk
, which if I have a USB drive plugged in but am booting off microSD or eMMC looks like:Typically the
MOUNTPOINT
is/
and/boot
for the two partitions the boot device is using (in this casemmcblk0
).After I used rpi-clone to clone to
sda
, shut down, pulled out the microSD card, and rebooted, I saw: