2

I have a new Raspbery Pi 3 B+ which actually boots from a 8 Gb SD Card. Now I want to toggle to a 32 Gb USB flash drive, so I wanted to clone the SD Card.

I think it should work, but I can't succeed. The USB flash drive is usable for the Pi (I can copy Noobs on it, install Raspbian to the Pi and boot like that).

That's what I do:

  • Lauch SD Card Copier

    from device : N/A (/dev/mmcblk0)

    to Device : Generic Flash Disk (/dev/sda)

After the copy, lsblk says

NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda           8:0    1 29,7G  0 disk 
├─sda1        8:1    1  1,6G  0 part 
├─sda2        8:2    1    1K  0 part 
├─sda5        8:5    1   32M  0 part /media/pi/SETTINGS
├─sda6        8:6    1   69M  0 part /media/pi/boot
└─sda7        8:7    1   28G  0 part /media/pi/root
mmcblk0     179:0    0  7,5G  0 disk 
├─mmcblk0p1 179:1    0  1,6G  0 part 
├─mmcblk0p2 179:2    0    1K  0 part 
├─mmcblk0p5 179:5    0   32M  0 part /media/pi/SETTINGS1
├─mmcblk0p6 179:6    0   69M  0 part /boot
└─mmcblk0p7 179:7    0  5,8G  0 part /

That seems not bad, but when I boot from USB

It doesn't work the first time

The second time it tries, it's long, and it blocks after this:

sda: sda1 sda2 <sda5 sda6 sda7>
usb 1-1.1.3.1: new full-speed USB device number 10 using dwc_otg
usb 1-1.1.3.1: device not accepting address 10, error -32
usb 1-1.1.3.1: new full-speed USB device number 11 using dwc_otg
usb 1-1.1.3.1: device not accepting address 11, error -32
usb 1-1.1.3-port1: unable to enumerate USB device
random: crng init done

What could be the problem here?

FredericP
  • 145
  • 1
  • 1
  • 9

3 Answers3

2

The script on this site will do as you require https://github.com/billw2/rpi-clone

You will also need to set the pi to boot from usb instructions on the raspberry site https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/msd.md

keith
  • 51
  • 1
  • My Pi is a 3B+, so it boots directly from USB, when no SD card is inside. I tried the script, and it gives the same type of result. At first boot in USB, a message telling that "Cannot find the drive with NOOBS files", and for the second boot, the pi tries to start Raspbian, but stopped exactly at the same line "random: crng init done" – FredericP Dec 02 '18 at 18:06
1

I wanted to migrate my system from SD Card to USB, now I understand that it can't be done directly. I tried lots of things and it never worked. In fact, it worked, it's just that a system for SD Card can't boot on USB. Even just booting the SD Card in a USB Reader doesn't work. I think there's something to do with the file /etc/fstab in particular, and possibly others.

So I found a solution, in three steps. Please note that I have stollen most of the commands from this thread Can a Raspberry Pi be used to create a backup of itself? . Thanks to https://raspberrypi.stackexchange.com/users/8697/milliways

  1. Format the USB stick, copy the NOOBS files in it
  2. Install Raspbian on the USB stick. Boot from the USB stick to verify that it works.There's no need to update the system when asked, lots of system files will be overwritten later.
  3. Now shutdown the Pi, install the SD Card, boot the Pi (it will boot from the SD Card).

Create the file /usr/bin/rsync-exclude.txt with

sudo nano /usr/bin/rsync-exclude.txt

enter this in the file

/proc/*
/sys/*
/dev/*
/boot/*
/tmp/*
/run/*
/mnt/*
/media/*

.Trashes
._.Trashes
.fseventsd
.Spotlight-V100
.DS_Store
.AppleDesktop
.AppleDB
Network Trash Folder
Temporary Items

.bash_history
/etc/fake-hwclock.data
/var/lib/rpimonitor/stat/
/etc/fstab

I just added the line /media/* (to prevent copying in recursion: I was surprised I had to do it!), and /etc/fstab . If fstab is copied from SD to USB stick (and I think the same from USB stick to SD card), the system won't boot.

Now, I lauched RSYNC like this (the system of my USB stick appears in /media/pi/root/)

sudo rsync -avH --delete-during --exclude-from=/usr/bin/rsync-exclude.txt / /media/pi/root/

It worked fine for me, I was able to boot now from the USB stick, and retrieved the system as is I booted from the SD card, just a little slower, but with extra 'disk' space now!

FredericP
  • 145
  • 1
  • 1
  • 9
0

I just used the open source software Balena Etcher on Windows 10 to clone a Raspberry OS SD card to an USB stick.

The USB stick could directly be used for booting into my Raspberry Pi 4B - same setup as in the SD card, all data copied.

The Raspberry Pi 4B's bootloader (which is located in a dedicated EEPROM, separate from SD card or USB stick) needs to be of a newer version to allow booting from USB. The official Raspberry Pi documentation explains how to update the EEPROM bootloader.

My bootloader version is (command: vcgencmd bootloader_version)

2022/04/26 11:24:28
507b2360eb46af23c05844b289dc5ae4ecfc3cca (release)

(Bootloader release notes)

Abdull
  • 101
  • 1