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

Re: Running Raspbian from USB Devices : Made Easy

Wed Nov 04, 2020 11:24 pm

alexcarter wrote:
Wed Nov 04, 2020 9:15 pm
Now,i have a new challenge,
Put PINN (PINN is not NOOBS) on sd card and clone ton my large hard drive.
I test the same way with usb-boot but it just copy only 2 partition.
not all partition fron Pinn.
If anyone know how i can do it.

usb-boot only handles the BOOT/ROOT partitions of normal RaspiOS installations. I'm not familiar with PINN, but usb-boot will replicate the RaspiOS system from a NOOBS installation to a USB device.

scottuf
Posts: 8
Joined: Tue Nov 03, 2020 1:24 am

Re: Running Raspbian from USB Devices : Made Easy

Sat Nov 07, 2020 10:02 pm

Ron, curious why you chose vfat and not fat32 for the filesystem? Or is it and I just don't get how Linux works. Gussing you used FAT over EXT4 so we can plug into a Windows or Mac and get to the files.

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

Re: Running Raspbian from USB Devices : Made Easy

Sat Nov 07, 2020 10:34 pm

scottuf wrote:
Sat Nov 07, 2020 10:02 pm
Ron, curious why you chose vfat and not fat32 for the filesystem? Or is it and I just don't get how Linux works. Gussing you used FAT over EXT4 so we can plug into a Windows or Mac and get to the files.

VFAT is FAT32.

usb-boot creates a VFAT/FAT32 BOOT partition and an EXT4 ROOT partition. The resulting layout/format is the same as what's created by writing a RaspiOS image.

scottuf
Posts: 8
Joined: Tue Nov 03, 2020 1:24 am

Re: Running Raspbian from USB Devices : Made Easy

Sat Nov 07, 2020 10:41 pm

Like I said, just curious. I was playing around trying to learn some stuff and ran sudo file -sL /dev/sda1 and at the end of the output it says FAT (16 bit). I would've thought it'd be 32 bit if FAT32?

pi@raspberrypi:~ $ sudo file -sL /dev/sda1
/dev/sda1: DOS/MBR boot sector, code offset 0x3c+2, OEM-ID "mkfs.fat", sectors/cluster 8, reserved sectors 8, root entries 512, Media descriptor 0xf8, sectors/FAT 256, sectors/track 63, heads 255, hidden sectors 2048, sectors 524288 (volumes > 32 MB), reserved 0x1, serial number 0x6e0d4e61, unlabeled, FAT (16 bit)

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

Re: Running Raspbian from USB Devices : Made Easy

Sat Nov 07, 2020 10:56 pm

scottuf wrote:
Sat Nov 07, 2020 10:41 pm
Like I said, just curious. I was playing around trying to learn some stuff and ran sudo file -sL /dev/sda1 and at the end of the output it says FAT (16 bit). I would've thought it'd be 32 bit if FAT32?

pi@raspberrypi:~ $ sudo file -sL /dev/sda1
/dev/sda1: DOS/MBR boot sector, code offset 0x3c+2, OEM-ID "mkfs.fat", sectors/cluster 8, reserved sectors 8, root entries 512, Media descriptor 0xf8, sectors/FAT 256, sectors/track 63, heads 255, hidden sectors 2048, sectors 524288 (volumes > 32 MB), reserved 0x1, serial number 0x6e0d4e61, unlabeled, FAT (16 bit)

I'm not sure what the story is with the 'file' utility, but fdisk reports correctly:

Code: Select all

root@raspberrypi:~# fdisk -l /dev/sdb
Disk /dev/sdb: 29.9 GiB, 32080200192 bytes, 62656641 sectors
Disk model: Flash Drive
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf70b83dd

Device     Boot  Start      End  Sectors  Size Id Type
/dev/sdb1         2048   526335   524288  256M  c W95 FAT32 (LBA)
/dev/sdb2       526336 62656640 62130305 29.6G 83 Linux

scottuf
Posts: 8
Joined: Tue Nov 03, 2020 1:24 am

Re: Running Raspbian from USB Devices : Made Easy

Sat Nov 07, 2020 11:15 pm

This is what it gives me, but now I see the data partition is the EXT4 one.

Code: Select all

Disk /dev/sda: 3.7 TiB, 4000752599040 bytes, 7813969920 sectors
Disk model: Elements 2620   
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: C078AA90-BDBC-42D9-A4C2-2C268DB8EBEE

Device      Start        End    Sectors  Size Type
/dev/sda1    2048     526335     524288  256M Microsoft basic data
/dev/sda2  526336 7813969886 7813443551  3.7T Linux filesystem

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

Re: Running Raspbian from USB Devices : Made Easy

Sun Nov 08, 2020 12:04 am

scottuf wrote:
Sat Nov 07, 2020 11:15 pm
This is what it gives me, but now I see the data partition is the EXT4 one.

Code: Select all

Disk /dev/sda: 3.7 TiB, 4000752599040 bytes, 7813969920 sectors
Disk model: Elements 2620   
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: C078AA90-BDBC-42D9-A4C2-2C268DB8EBEE

Device      Start        End    Sectors  Size Type
/dev/sda1    2048     526335     524288  256M Microsoft basic data
/dev/sda2  526336 7813969886 7813443551  3.7T Linux filesystem

You're using GPT instead of MBR (as needed for your 4TB drive). When GPT is used, there's a HYBRID MBR created for the BOOT partition as Raspberry Pi bootloader's prior to the 4 don't understand GPT. usb-boot creates it with an ID=0x0c (FAT32), but for whatever reason, this isn't being interpreted as such by the 'file' utility.

scottuf
Posts: 8
Joined: Tue Nov 03, 2020 1:24 am

Re: Running Raspbian from USB Devices : Made Easy

Sun Nov 08, 2020 12:06 am

RonR wrote:
Sun Nov 08, 2020 12:04 am
You're using GPT instead of MBR (as needed for your 4TB drive). When GPT is used, there's a HYBRID MBR created for the BOOT partition as Raspberry Pi bootloader's prior to the 4 don't understand GPT. usb-boot creates it with an ID=0x0c (FAT32), but for whatever reason, this isn't being interpreted as such by the 'file' utility.
That makes sense. Thanks!

User avatar
rpdom
Posts: 17946
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Running Raspbian from USB Devices : Made Easy

Sun Nov 08, 2020 5:00 am

RonR wrote:
Sat Nov 07, 2020 10:56 pm
scottuf wrote:
Sat Nov 07, 2020 10:41 pm
Like I said, just curious. I was playing around trying to learn some stuff and ran sudo file -sL /dev/sda1 and at the end of the output it says FAT (16 bit). I would've thought it'd be 32 bit if FAT32?

pi@raspberrypi:~ $ sudo file -sL /dev/sda1
/dev/sda1: DOS/MBR boot sector, code offset 0x3c+2, OEM-ID "mkfs.fat", sectors/cluster 8, reserved sectors 8, root entries 512, Media descriptor 0xf8, sectors/FAT 256, sectors/track 63, heads 255, hidden sectors 2048, sectors 524288 (volumes > 32 MB), reserved 0x1, serial number 0x6e0d4e61, unlabeled, FAT (16 bit)

I'm not sure what the story is with the 'file' utility, but fdisk reports correctly:

Code: Select all

root@raspberrypi:~# fdisk -l /dev/sdb
Disk /dev/sdb: 29.9 GiB, 32080200192 bytes, 62656641 sectors
Disk model: Flash Drive
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf70b83dd

Device     Boot  Start      End  Sectors  Size Id Type
/dev/sdb1         2048   526335   524288  256M  c W95 FAT32 (LBA)
/dev/sdb2       526336 62656640 62130305 29.6G 83 Linux
Just because the partition table entry says the partition is FAT32, doesn't mean it is. It could be formatted as anything. In this case it is formatted as FAT16.

I have a similar situation with the SD card on one of my older Pis:

Code: Select all

root@raspi2:~# file -sL /dev/mmcblk0p1
/dev/mmcblk0p1: DOS/MBR boot sector, code offset 0x3c+2, OEM-ID "mkfs.fat", sectors/cluster 4, reserved sectors 4, root entries 512, Media descriptor 0xf8, sectors/FAT 120, sectors/track 16, heads 4, hidden sectors 2048, sectors 120832 (volumes > 32 MB) , reserved 0x1, serial number 0xc0dad596, unlabeled, FAT (16 bit)
root@raspi2:~# fdisk -l /dev/mmcblk0 

Disk /dev/mmcblk0: 7.2 GiB, 7744782336 bytes, 15126528 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x7ee80803

Device         Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk0p1        2048   122879   120832   59M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      122880 15126527 15003648  7.2G 83 Linux
So in this case fdisk is not reporting correctly. It is just showing what it knows, which is what the partition table was set to.
Unreadable squiggle

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

Re: Running Raspbian from USB Devices : Made Easy

Sun Nov 08, 2020 6:11 am

rpdom wrote:
Sun Nov 08, 2020 5:00 am
Just because the partition table entry says the partition is FAT32, doesn't mean it is. It could be formatted as anything. In this case it is formatted as FAT16.

I have a similar situation with the SD card on one of my older Pis:

Code: Select all

root@raspi2:~# file -sL /dev/mmcblk0p1
/dev/mmcblk0p1: DOS/MBR boot sector, code offset 0x3c+2, OEM-ID "mkfs.fat", sectors/cluster 4, reserved sectors 4, root entries 512, Media descriptor 0xf8, sectors/FAT 120, sectors/track 16, heads 4, hidden sectors 2048, sectors 120832 (volumes > 32 MB) , reserved 0x1, serial number 0xc0dad596, unlabeled, FAT (16 bit)
root@raspi2:~# fdisk -l /dev/mmcblk0 

Disk /dev/mmcblk0: 7.2 GiB, 7744782336 bytes, 15126528 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x7ee80803

Device         Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk0p1        2048   122879   120832   59M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      122880 15126527 15003648  7.2G 83 Linux
So in this case fdisk is not reporting correctly. It is just showing what it knows, which is what the partition table was set to.

Good catch!

usb-boot formats the partition using mkfs.vfat (no options). A read of the man page reveals:

-F FAT-SIZE
Specifies the type of file allocation tables used (12, 16 or 32 bit). If nothing is specified, mkfs.fat will automatically select between 12, 16 and 32 bit, whatever fits better for the filesystem size.

A FAT16 filesystem is actually being created, presumably because of the small volume size (256 MB). Only 256 sectors/FAT are created using FAT16 whereas FAT32 creates 4033 sectors/FAT.

otraver
Posts: 12
Joined: Mon Nov 23, 2020 2:44 pm

Re: Running Raspbian from USB Devices : Made Easy

Mon Nov 23, 2020 3:40 pm

Hi RonR and all of the world
Firstly, excuse me for my bad english.
I started reading this tread because I have problems to clone mi SD to a Pendrive. I not haver read that the thread are dated in november/2017. I only read nov/3 and I suposed 2020 and not 2017.
I'm still reading page 5 but I leave my query here to advance work.
If I see that my query is resolved as of page 6, I will edit or delete it.
I'm very interested in your metod to copi a bootable SDcard to another usb device.
I make mi first installation in my Pi4b in june 2020 and installed and configured plex server + Rclone, Pi-Hole, OpenVPn, etc. etc.
For that first installation it seems that I used NOOBS that came pre-installed on the SD-card that I bought as a kit with the Pi4b: motherboard + box + card + microhdmi to hdmi cables ...
Last week I saw in a video that you could boot from an SSD, PenDrive, etc. via USB.
Following the tutorial in said video, I updated the eeprom and everything necessary to boot the pi via USB.
My first test was creating a bootable pendrive with raspi-imager and a minimal installation with Pixel Desktop
Once I verified that the pi was booting from USB, I tried to clone the installed and configured SD card to the same pendrive, which I was sure was bootable.
But it does not work. It stayed on a black screen that made small flashes.
Reading and asking colleagues in a telegram group they told me that the culprit was the installation with noobs that created additional partitions to those that are created in a normal installation.
With noobs, a 2.40GB Fat16 (RECOVERY) partition is created, an extended partition that occupies the rest of the SD (64GB) and the following partitions are created in that extended partition:
- 32MB EXT4 partition (SYSTEM)
- 256mb Fat32 partition (/boot)
- 56.79GB EXT partition (/)
Reading and testing, I finally managed to convert my SD with 5 partitions to a traditional bootable one with only 2 partitions:
- 256MB "/boot"
- 59.44GB "/"
I have tried cloning this card to my USBdrive and it doesn't work either. Sometimes it returns error 00000044 (I have tried to copy the 14 files in boot, without success) and other times it continues with the black screen and with small flashes.
I will try to use the script and comment on results

otraver
Posts: 12
Joined: Mon Nov 23, 2020 2:44 pm

Re: Running Raspbian from USB Devices : Made Easy

Mon Nov 23, 2020 5:14 pm

How long does it take to copy 64GB SD to 128GB pendrive?
I'm waiting almost 60 minutes while the script runs and it still shows "Replicating BOOT / ROOT contents from / dev / mmcblk0 to / dev / sda (this will take a while)"

otraver
Posts: 12
Joined: Mon Nov 23, 2020 2:44 pm

Re: Running Raspbian from USB Devices : Made Easy

Mon Nov 23, 2020 5:35 pm

As the scrit not finish I cancelled the scritp.
Shutdown Pi4b, extracted 128GB pendrive, booted pi4
In a win10 pc I deleted the partitions in the pendrive. Expulsed and inserted in Pi4b.
inner the folder /home/pi/Desktop/usb-boot i make in terminal:

Code: Select all

sudo ./usb-boot
The scrip started.
Can you boot from SD Card ----> No
Boot from UBS selected.
MBR selected
Duplicate boot/root in USB - yes
All data erased - yes
"Replicating BOOT/ROOT contents from /dev/mmcblk0 to /dev/sda (this will take a while)"

otraver
Posts: 12
Joined: Mon Nov 23, 2020 2:44 pm

Re: Running Raspbian from USB Devices : Made Easy

Mon Nov 23, 2020 6:05 pm

still
"Replicating BOOT/ROOT contents from /dev/mmcblk0 to /dev/sda (this will take a while)"

40 minuts

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

Re: Running Raspbian from USB Devices : Made Easy

Mon Nov 23, 2020 6:36 pm

otraver wrote:
Mon Nov 23, 2020 3:40 pm
Reading and asking colleagues in a telegram group they told me that the culprit was the installation with noobs that created additional partitions to those that are created in a normal installation.
With noobs, a 2.40GB Fat16 (RECOVERY) partition is created, an extended partition that occupies the rest of the SD (64GB) and the following partitions are created in that extended partition:
- 32MB EXT4 partition (SYSTEM)
- 256mb Fat32 partition (/boot)
- 56.79GB EXT partition (/)
Reading and testing, I finally managed to convert my SD with 5 partitions to a traditional bootable one with only 2 partitions:
- 256MB "/boot"
- 59.44GB "/"
I have tried cloning this card to my USBdrive and it doesn't work either. Sometimes it returns error 00000044 (I have tried to copy the 14 files in boot, without success) and other times it continues with the black screen and with small flashes.
I will try to use the script and comment on results

usb-boot should replicate a RaspiOS installation in NOOBS to a USB device without any special intervention.

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

Re: Running Raspbian from USB Devices : Made Easy

Mon Nov 23, 2020 6:41 pm

otraver wrote:
Mon Nov 23, 2020 5:14 pm
How long does it take to copy 64GB SD to 128GB pendrive?
I'm waiting almost 60 minutes while the script runs and it still shows "Replicating BOOT / ROOT contents from / dev / mmcblk0 to / dev / sda (this will take a while)"

It's a function of the model of Raspberry Pi, the amount of data, and the speed of the devices.

Which Raspberry Pi are you using? Are you using a USB 3 pendrive?

otraver
Posts: 12
Joined: Mon Nov 23, 2020 2:44 pm

Re: Running Raspbian from USB Devices : Made Easy

Mon Nov 23, 2020 7:02 pm

RonR wrote:
Mon Nov 23, 2020 6:41 pm
otraver wrote:
Mon Nov 23, 2020 5:14 pm
How long does it take to copy 64GB SD to 128GB pendrive?
I'm waiting almost 60 minutes while the script runs and it still shows "Replicating BOOT / ROOT contents from / dev / mmcblk0 to / dev / sda (this will take a while)"

It's a function of the model of Raspberry Pi, the amount of data, and the speed of the devices.

Which Raspberry Pi are you using? Are you using a USB 3 pendrive?
Hi, thank's to quick reply...
I'm usign a Pi 4b 4GB, a Sandisk Ultra A1 HCI 1 64GB SDcard and a SanDisk Ultra Fit, flash USB 3.1 128 GB connected in one of the two blue usb 3.0
In the last attempt have more tan 120 minutes have passed...
I not shee any progress bar and nothing other text than "Replicating BOOT / ROOT contents from / dev / mmcblk0 to / dev / sda (this will take a while)"
Last edited by otraver on Mon Nov 23, 2020 7:38 pm, edited 1 time in total.

otraver
Posts: 12
Joined: Mon Nov 23, 2020 2:44 pm

Re: Running Raspbian from USB Devices : Made Easy

Mon Nov 23, 2020 7:05 pm

RonR wrote:
Mon Nov 23, 2020 6:36 pm
otraver wrote:
Mon Nov 23, 2020 3:40 pm
Reading and asking colleagues in a telegram group they told me that the culprit was the installation with noobs that created additional partitions to those that are created in a normal installation.
With noobs, a 2.40GB Fat16 (RECOVERY) partition is created, an extended partition that occupies the rest of the SD (64GB) and the following partitions are created in that extended partition:
- 32MB EXT4 partition (SYSTEM)
- 256mb Fat32 partition (/boot)
- 56.79GB EXT partition (/)
Reading and testing, I finally managed to convert my SD with 5 partitions to a traditional bootable one with only 2 partitions:
- 256MB "/boot"
- 59.44GB "/"
I have tried cloning this card to my USBdrive and it doesn't work either. Sometimes it returns error 00000044 (I have tried to copy the 14 files in boot, without success) and other times it continues with the black screen and with small flashes.
I will try to use the script and comment on results

usb-boot should replicate a RaspiOS installation in NOOBS to a USB device without any special intervention.
I have used the metod explained in my blog (sorry is in spanish) https://elpatopatu.wordpress.com/2020/1 ... rry-pi-4b/ because in a spanish telegram group many people have similars problems.
Actually I'm usign a SDcard with only 2 partitions as the new raspbian installation have.
/dev/mmbclk0p1 /boot
/dev/mmbclk0p2 /root

otraver
Posts: 12
Joined: Mon Nov 23, 2020 2:44 pm

Re: Running Raspbian from USB Devices : Made Easy

Mon Nov 23, 2020 7:07 pm

Normally a SD to pendrive clone using the "SD card copier" delays 20 - 30 minuts and a

Code: Select all

sudo dd if=/dev/mmcblk0p of=/dev/sda status=progress bs=1M
about 30 minuts also...
The /root partition in SDcard is 59.23GB and only 14GB used

otraver
Posts: 12
Joined: Mon Nov 23, 2020 2:44 pm

Re: Running Raspbian from USB Devices : Made Easy

Mon Nov 23, 2020 7:11 pm

Can be that I not killed the Rclone service with a gdrive team mounted?

Edit:
I killed the rclone service and started once.

Code: Select all

pkill rclone

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

Re: Running Raspbian from USB Devices : Made Easy

Mon Nov 23, 2020 7:18 pm

@otraver,

usb-boot simply uses rsync to copy the running system to the USB device.

image-backup (with the -x option) will extract a RaspiOS installation from NOOBS to a standard image file that can be written to an SD card or USB device with Etcher.

otraver
Posts: 12
Joined: Mon Nov 23, 2020 2:44 pm

Re: Running Raspbian from USB Devices : Made Easy

Mon Nov 23, 2020 7:44 pm

RonR wrote:
Mon Nov 23, 2020 7:18 pm
@otraver,

usb-boot simply uses rsync to copy the running system to the USB device.

image-backup (with the -x option) will extract a RaspiOS installation from NOOBS to a standard image file that can be written to an SD card or USB device with Etcher.
Thank's for the info.

It is already very difficult for me to read so much information about Linux in Spanish, much more difficult to do it in English.
I defend myself quite well on windows but linux is completely new to me.
I have learned more in these last days than in the previous 50 years ...
It's a shame we didn't discover viewtopic.php?f=29&t=247568 a little earlier.
I spent a lot of time searching for the information needed to convert a noobs installation to a standard raspbian installation.
I've learned quite a bit, that's interesting

otraver
Posts: 12
Joined: Mon Nov 23, 2020 2:44 pm

Re: Running Raspbian from USB Devices : Made Easy

Mon Nov 23, 2020 7:48 pm

I think that the problem are rclone service not killed.
in this last attempt it was barely 20 minutes and I already have
"

Code: Select all

BOOT / ROOT contents replicated from / dev / mmcblk0 to / dev / sda
SD card must be removed to boot the USB device
"
Fingers crossed and rebooting

otraver
Posts: 12
Joined: Mon Nov 23, 2020 2:44 pm

Re: Running Raspbian from USB Devices : Made Easy

Mon Nov 23, 2020 7:55 pm

👏
Working booting from Sandisk pendrive.

Thank you very very much...
The USB-boot is already working.
I am eager to test on the ssd (samsung 850) that I have already bought, and with its orico box https://es.aliexpress.com/item/32731090 ... 63c0J1FGkI

JPICentral
Posts: 65
Joined: Wed Jul 18, 2018 3:22 am
Location: Next to the Mojave Desert at 100+ Degree Fahrenheit

Re: Running Raspbian from USB Devices : Made Easy

Thu Dec 03, 2020 10:47 am

[[ Somehow jumped threads DELETE ]]

Return to “Advanced users”