Kornelius777
Posts: 4
Joined: Fri Dec 02, 2022 5:14 pm

[Solved:] Move mmcblk0p1 to sda1

Fri Dec 02, 2022 5:23 pm

Dear all,

on my RPi4, I used to have /boot on a SD Card. (The rest is on a SSD)
However, after two SD Cards with a Sudden Death, I want to migrate the /boot-Partition to /dev/sda1 of my SSD.
Space is already reserved.
But...
I just cannot get it managed.

I've tried rsync
I've tried dd

However, whenever I want to boot, all my RPi does is: Blink four times ("kernel not found") and stay silent.

Is there anyone out there who might give me a helping hand?

Kind regards,
Last edited by Kornelius777 on Sat Dec 03, 2022 9:20 am, edited 2 times in total.

User avatar
thagrol
Posts: 8557
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK

Re: Move mmcblk0p0 to sda1

Fri Dec 02, 2022 6:20 pm

Check your firmware version and boot order settings. Early 4B that haven't had the firmware updated can't boot from USB. If they have had the firmware update they may stil need to boot order to be set correctly. Check the official docs for that.

If you want help with rsync and/or dd start by posting the actual commands you used.

This has worked for me in the past but YMMV:

Code: Select all

sudo mount /dev/sda1 /mnt
sudo rsync -axrvH /boot /mnt
Then edit /etc/fstab to have the correct PARTUUID for /boot. Don't use /dev/sda1 as that can change if more than one USB device is present at boot time.
Knowledge, skills, & experience have value. If you expect to profit from someone's you should expect to pay for them.

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

Kornelius777
Posts: 4
Joined: Fri Dec 02, 2022 5:14 pm

Re: Move mmcblk0p0 to sda1

Fri Dec 02, 2022 7:42 pm

Thank you for your fast reply!

I immediately tried your proposal - however,
yet again - only the emergency blink code

Let me show you, what I have - maybe you spot something

Code: Select all

root@proxmox-3:~# fdisk -l /dev/sda
Disk /dev/sda: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: SSD PLUS 1000GB 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 33553920 bytes
Disklabel type: dos
Disk identifier: 0x21e60f8c

Device     Boot      Start        End    Sectors   Size Id Type
/dev/sda1             8192     532479     524288   256M  c W95 FAT32 (LBA)
/dev/sda2           532480  134748159  134215680    64G 83 Linux
/dev/sda3        134748160 1587804159 1453056000 692.9G 83 Linux
/dev/sda4       1587804160 1953523711  365719552 174.4G 83 Linux

Code: Select all

root@proxmox-3:~# rpi-eeprom-update
BOOTLOADER: up to date
   CURRENT: Tue 26 Apr 10:24:28 UTC 2022 (1650968668)
    LATEST: Tue 26 Apr 10:24:28 UTC 2022 (1650968668)
   RELEASE: default (/lib/firmware/raspberrypi/bootloader/default)
            Use raspi-config to change the release.

  VL805_FW: Dedicated VL805 EEPROM
     VL805: up to date
   CURRENT: 000138a1
    LATEST: 000138a1

Code: Select all

root@proxmox-3:/etc# cat /boot/cmdline.txt 
console=serial0,115200 console=tty1 root=PARTUUID=21e60f8c-02 rootfstype=ext4 fsck.repair=yes rootwait cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1

Code: Select all

root@proxmox-3:/etc# cat /etc/fstab 
proc            /proc           proc    defaults          0       0
PARTUUID=885bab69-01  /boot           vfat    defaults          0       2
# PARTUUID=21e60f8c-01	/boot		vfat	defaults	0	2
PARTUUID=21e60f8c-02  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
(N.B.: This is only the fallback fstab. I booted with the second (commented) /boot entry)

Might there be the necessity to install the grub loader on /dev/sda?

Code: Select all

root@proxmox-3:~# grub-install /dev/sda
Installing for arm64-efi platform.
grub-install: error: cannot find EFI directory.
Could that be the missing link?

But... Here, I'm stuck.
How would I achieve that?

Kind regards,

User avatar
thagrol
Posts: 8557
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK

Re: Move mmcblk0p0 to sda1

Fri Dec 02, 2022 10:37 pm

First, do not install grub. It's not required and won't be used if present.

Next:
  • Post the output of

    Code: Select all

    lsblk
  • Is that your entire fstab? There are two partitiuons on that device that aren't in there.
  • Provided cmdline.txt is correct and pointing at the correct root aprtition the system should boot without an entry for /boot in fstab. AIUI the only automatic writes to it during boot are to remove any ssh or ssh.txt; wpa_supplicant, or userconf.txt files after they have been processed.
  • On your problem boots was the SD card present or absent?
  • I'm a litle confused. As posted with the second fstab entry for /boot commented out did the Pi boot or not? Did it boot with the first commented and the second uncommented?
  • I suspect that even though you have, apparently, copied the root partition to /dev/sda, you've not updated cmdline.txt not fstab so have been running from SD card. But that's a guess as you've not posted the UUIDs and PARTUUIDs for all devices.
Knowledge, skills, & experience have value. If you expect to profit from someone's you should expect to pay for them.

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

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

Re: Move mmcblk0p0 to sda1

Sat Dec 03, 2022 1:48 am

Kornelius777 wrote:
Fri Dec 02, 2022 5:23 pm
Is there anyone out there who might give me a helping hand?

You may find Migrating Hybrid SD/USB Booting to Direct USB Booting on the Raspberry Pi 4 : Made Easy helpful.

Kornelius777
Posts: 4
Joined: Fri Dec 02, 2022 5:14 pm

Re: Move mmcblk0p0 to sda1

Sat Dec 03, 2022 8:08 am

thagrol wrote:
Fri Dec 02, 2022 10:37 pm
Post the output of

Code: Select all

lsblk

Code: Select all

root@proxmox-3:~# lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0 931.5G  0 disk 
├─sda1        8:1    0   256M  0 part 
├─sda2        8:2    0    64G  0 part /
├─sda3        8:3    0 692.9G  0 part 
└─sda4        8:4    0 174.4G  0 part 
mmcblk0     179:0    0  58.9G  0 disk 
├─mmcblk0p1 179:1    0   256M  0 part /boot
└─mmcblk0p2 179:2    0  58.7G  0 part 
zd0         230:0    0   1.5G  0 disk 
zd16        230:16   0    64M  0 disk 
zd80        230:80   0     8G  0 disk 
├─zd80p1    230:81   0   512M  0 part 
├─zd80p2    230:82   0   7.1G  0 part 
└─zd80p3    230:83   0   454M  0 part
thagrol wrote:
Fri Dec 02, 2022 10:37 pm
Is that your entire fstab? There are two partitiuons on that device that aren't in there.
There are two more lines binding nfs partitions into proxmox.
Not required for the boot process.
The other partitions are zfs partitions only used within proxmox.
thagrol wrote:
Fri Dec 02, 2022 10:37 pm
On your problem boots was the SD card present or absent?
When I took the SD Card out, the Pi wouldn't boot any more. Before that, I made fstab point to the correct SSD /boot partition.
thagrol wrote:
Fri Dec 02, 2022 10:37 pm
I'm a litle confused. As posted with the second fstab entry for /boot commented out did the Pi boot or not? Did it boot with the first commented and the second uncommented?

Code: Select all

PARTUUID=885bab69-01  /boot           vfat    defaults          0       2            <--- pointing to /dev/mmcblk0p1
# PARTUUID=21e60f8c-01	/boot		vfat	defaults	0	2            <--- pointing to /dev/sda1
I always comment out the line which isn't required for the current boot process.
thagrol wrote:
Fri Dec 02, 2022 10:37 pm
I suspect that even though you have, apparently, copied the root partition to /dev/sda, you've not updated cmdline.txt not fstab so have been running from SD card. But that's a guess as you've not posted the UUIDs and PARTUUIDs for all devices.
Since only my boot partition is on the SD Card, there shouldn't be the neet to change anything at cmdline.txt, should it?
And as I wrote - I always edit fstab to reflect the currently needed situation.

Here is the block device list:

Code: Select all

/dev/mmcblk0p1: LABEL_FATBOOT="boot" LABEL="boot" UUID="0F92-BECC" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="885bab69-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="41c98998-6a08-4389-bf74-79c9efcf0739" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="885bab69-02"
/dev/sda1: SEC_TYPE="msdos" LABEL_FATBOOT="boot" LABEL="boot" UUID="55EB-C274" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="21e60f8c-01"
/dev/sda2: LABEL="rootfs" UUID="41c98998-6a08-4389-bf74-79c9efcf0739" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="21e60f8c-02"
/dev/sda3: LABEL="ZFSPool" UUID="3454891705822538731" UUID_SUB="10474167219404143301" BLOCK_SIZE="4096" TYPE="zfs_member" PARTUUID="21e60f8c-03"
/dev/zd80p1: SEC_TYPE="msdos" UUID="E4D8-A601" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="1f618207-30a8-46b0-bb25-e2d03b7a2557"
/dev/zd80p2: UUID="8369930a-ff91-4811-b32a-9aaade004e76" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="2f43180b-ff29-44d0-8ad8-b302271a50a3"
/dev/zd80p3: UUID="92a3070b-e0b0-4fa9-84f5-bccf9ff8ba04" TYPE="swap" PARTUUID="c9a41bb4-fd70-4555-9a66-aeb82492458d"
/dev/sda4: PARTUUID="21e60f8c-04"

Kornelius777
Posts: 4
Joined: Fri Dec 02, 2022 5:14 pm

Re: Move mmcblk0p0 to sda1

Sat Dec 03, 2022 8:30 am

thagrol wrote:
Fri Dec 02, 2022 6:20 pm
Check your firmware version and boot order settings.
Incredible! In your very first post, you actually had the solution at hand!
I just read over it. Apologies!

Code: Select all

root@proxmox-3:~# rpi-eeprom-config
[all]
BOOT_UART=0
WAKE_ON_GPIO=1
POWER_OFF_ON_HALT=0
DHCP_TIMEOUT=45000
DHCP_REQ_TIMEOUT=4000
TFTP_FILE_TIMEOUT=30000
TFTP_IP=
TFTP_PREFIX=0
BOOT_ORDER=0x1                      <--- That was the bad guy!
SD_BOOT_MAX_RETRIES=3
NET_BOOT_MAX_RETRIES=5
[none]
FREEZE_VERSION=0
I changed the boot order to 0xf41 and now, everything is fine.
Bummer!

Thank you kindly!

Return to “Advanced users”