I used to change the root=PARTUUID= setting in cmdline.txt of the (micro) 
sd-card of RPI 1B and 2B models to the PARTUUID of the USB-disk.
Then the RPI will run with root on the SDA parttion.

When raspbian buster (or the latest version of stretch) is written with 
balenaEtcher, both sd-card and usb-disk get the same PARTUUID. See below.

blkid
/dev/mmcblk0p1: LABEL_FATBOOT="boot" LABEL="boot" UUID="4BBD-D3E7" 
TYPE="vfat" PARTUUID="738a4d67-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="45e99191-771b-4e12-a526-0779148892cb" 
TYPE="ext4" PARTUUID="738a4d67-02"
/dev/sda1: LABEL_FATBOOT="boot" LABEL="boot" UUID="4BBD-D3E7" TYPE="vfat" 
PARTUUID="738a4d67-01"
/dev/sda2: LABEL="rootfs" UUID="45e99191-771b-4e12-a526-0779148892cb" 
TYPE="ext4" PARTUUID="738a4d67-02"
/dev/mmcblk0: PTUUID="738a4d67" PTTYPE="dos"

With the set-ptuuid script downloaded 
from:https://www.raspberrypi.org/forums/viewtopic.php?t=253562 we can 
change the PARTUUID of the USB-disk (or the sd-card).
The script also changes the PARTUUID settings in cmdline.txt and other 
files.

Example
=====
Boot from the sd-card with the usb-disk connected

Now change the PTUUID of the USB-disk
./set-ptuuid /dev/sda random
Set PTUUID on /dev/sda to e4f3c2c9 (y/n)?
PTUUID on /dev/sda is set to e4f3c2c9

blkid
/dev/mmcblk0p1: LABEL_FATBOOT="boot" LABEL="boot" UUID="4BBD-D3E7" 
TYPE="vfat" PARTUUID="738a4d67-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="45e99191-771b-4e12-a526-0779148892cb" 
TYPE="ext4" PARTUUID="738a4d67-02"
/dev/sda1: LABEL_FATBOOT="boot" LABEL="boot" UUID="4BBD-D3E7" TYPE="vfat" 
PARTUUID="e4f3c2c9-01"
/dev/sda2: LABEL="rootfs" UUID="45e99191-771b-4e12-a526-0779148892cb" 
TYPE="ext4" PARTUUID="e4f3c2c9-02"
/dev/mmcblk0: PTUUID="738a4d67" PTTYPE="dos"

cat cmdline.txt
console=serial0,115200 console=tty1 root=PARTUUID=e4f3c2c9-02 
rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet 
init=/usr/lib/raspi-config/init_resize.sh

Now reboot the RPI with the sd-card and USB-disk still connected
The RPI will now have it's root set to /dev/sda2

cat /etcfstab
proc            /proc           proc    defaults          0       0
PARTUUID=e4f3c2c9-01  /boot           vfat    defaults          0       2
PARTUUID=e4f3c2c9-02  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
=====

Luc

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/69b6640f-7752-430b-8fe9-d50539243ff9%40googlegroups.com.

Reply via email to