Image file does not work on larger SD card

Hello everybody.
I have a SDcard 64gb with all to boot XAVIER NX.
I made a image of that SD card on my laptop and I flashed it on a SDcard of 128gb.
The 64 sdcard works fine and boot ok, but the SDcard 128gb does not boot.
To create the image on my laptop I used:

sudo dd if=/dev/sdb64 of=~/SDCardBackup.img`

And to flash the 128gb card I used:

sudo dd bs=4M if=~/SDCardBackup.img of=/dev/sdb128.

I unmount the SDcard in all operations and I also used gparted to expand the SDcard filesystem.

Any idea of what is bringing this problem?

Thanks in advance

Do you really use path “/dev/sdb64” or “/dev/sdb128”? These are not valid. If you are just illustrating and naming which card, that’s fine, but actual command lines would require something like “/dev/sdb1” for the first partition.

Hi @linuxdev.
In fact this is only for illustration. I am using the paths given by the system.
Do you think if I try to copy one sdcard direct to other I will get a different result?

Copying to a host PC image file, then to the SD, should not differ versus directly from SD to SD. However, not all content is partition content. I will suggest setting up all partitions to the correct size, and then copying the image of each partition from one SD to the other, but only if this is to be used on the same NX.

The idea is that if the SD has partitions created ahead of time with something like gdisk, then all metadata will be correct for that partition layout. After that you could use a resizing app (provided it is aware of preserving ext4 and not corrupting it) if needed.

Thank you @linuxdev.
Maybe a silly question regarding partitions:
When I check the sdcard with GParted for example, I only see one partition on sdcard. I quite did not understand what partitions you are referring. Can you, please, explain it a little more ?

Hello @linuxdev.
I made it work.
This is what I did.
I followed the steps given here:

https://developer.nvidia.com/embedded/learn/get-started-jetson-xavier-nx-devkit#write.

I dowloaded the image from Nvidia website and flashed it on the 128gb Sdcard using balena etcher sw.
I pluged the sdcard on the board and made the initial configurations.
After that, without formating the sdcard, I used the procedure:

sudo dd bs=4M if=~/SDCardBackup.img of=/dev/sdb128

After that, I pluged again on the board and it booted.

As you proposed, I used gparted to extend the partition preserving the fylesystem.

I believe that, when I flashed the sdcard with Nvidia image, maybe I have restored the partition table that was not properly set before.

Thank you for your support.

On an eMMC system you would only see one partition on an SD card used for boot. On a dev kit with only SD card, the SD would have a lot of partitions. Example (this is from 2 different SD card models/installs):

Number  Start (sector)    End (sector)  Size       Code  Name
   1           28672       124733439   59.5 GiB    8300  APP
   2            2048            2303   128.0 KiB   8300  TBC
   3            4096            4991   448.0 KiB   8300  RP1
   4            6144            7295   576.0 KiB   8300  EBTNumber  Start (sector)    End (sector)  Size       Code  Name
   1              40        29360167   14.0 GiB    0700  APP
   2        29360168        29491239   64.0 MiB    0700  kernel
   3        29491240        29622311   64.0 MiB    0700  kernel_b
   4        29622312        29623207   448.0 KiB   0700  kernel-dtb
   5        29623208        29624103   448.0 KiB   0700  kernel-dtb_b
   6        29624104        29753127   63.0 MiB    0700  recovery
   7        29753128        29754151   512.0 KiB   0700  recovery-dtb
   8        29754152        29754663   256.0 KiB   0700  kernel-bootctrl
   9        29754664        29755175   256.0 KiB   0700  kernel-bootctrl_b
  10        29755176        29959975   100.0 MiB   0700  RECROOTFS
  11        29959976       124735454   45.2 GiB    0700  UDA

   5            8192            8319   64.0 KiB    8300  WB0
   6           10240           10623   192.0 KiB   8300  BPF
   7           12288           13055   384.0 KiB   8300  BPF-DTB
   8           14336           14463   64.0 KiB    8300  FX
   9           16384           17279   448.0 KiB   8300  TOS
  10           18432           19327   448.0 KiB   8300  DTB
  11           20480           22015   768.0 KiB   8300  LNX
  12           22528           22655   64.0 KiB    8300  EKS
  13           24576           24735   80.0 KiB    8300  BMP
  14           26624           26879   128.0 KiB   8300  RP4
# OR:
Number  Start (sector)    End (sector)  Size       Code  Name
   1              40        29360167   14.0 GiB    0700  APP
   2        29360168        29491239   64.0 MiB    0700  kernel
   3        29491240        29622311   64.0 MiB    0700  kernel_b
   4        29622312        29623207   448.0 KiB   0700  kernel-dtb
   5        29623208        29624103   448.0 KiB   0700  kernel-dtb_b
   6        29624104        29753127   63.0 MiB    0700  recovery
   7        29753128        29754151   512.0 KiB   0700  recovery-dtb
   8        29754152        29754663   256.0 KiB   0700  kernel-bootctrl
   9        29754664        29755175   256.0 KiB   0700  kernel-bootctrl_b
  10        29755176        29959975   100.0 MiB   0700  RECROOTFS
  11        29959976       124735454   45.2 GiB    0700  UDA

Without those non-rootfs (not “APP”) partitions boot will fail. The location of the non-rootfs partitions depends on the Jetson model. Typically an eMMC model would use those on eMMC, and if booting a rootfs on SD, then only the APP/rootfs partition would be on SD. An image of rootfs on an SD card of a non-eMMC model will fail to boot.

You are probably correct that the steps you took restored a partition table, and that this is why it now boots correctly. When people manually install and do not allow the other software to reinstall there is a chance that the surrounding non-rootfs content will be broken in some way.