Image for smaller sd-cards

We have the following problem:

We installed the jetpack version of Ubuntu 18.04 LTS on a Sandisk sd-card with 64 GB (exact 63.8 GB). Additional we installed some software like OpenCV and ROS and some scripts for systemchecks. Reading an Image and writing it to an equal sd-card was not a problem. Now we have some sd-cards from verbatim with 64 GB (exact 62.2 GB). The original Image could not be flashed on these devices, based on diffferent block sizes.

What we tried:

Clonzilla Images also fails to the same reasons. shrinking the partition (example sda1) and using dd for the blocktransfer doesn’t work either. The Problem in my opinion are the partiotions sda2 to sda12 that are some unknown bitlocker format.

hello matti.kaupenjohann,

please double confirm you had enough storage.
may I know had you format the sd-card from verbatim? please refer to Write Image to the microSD Card to prepare your microSD card.
thanks

Maybe there is a misunderstanding. The Installation works fine and the fully installed OS is about 32 GB. I also tried some tricks with shrinking the first partition sda1 to around 55 GB, so I left over with a 7-8 GB unallocated space. This trick is somehow not working, because dd always tries do copy first the partition sda1 that failes (as excepted) but it also missed the partitions sda2 to sda12.

hello matti.kaupenjohann,

I’m still confused about what you would like to done.
could you please share the commands and also the report failures for reference.
thanks

I did following that was promising:

  1. Installed regular the OS
  2. setting up paths for cuda
  3. installing OpenCV
  4. installing ROS
  5. setting up script to check fan speed

until here everthing works fine. The installation was done on the bigger sized sd-card (63.8 GB)

Now I wanted to clone the sd-card (63.8 GB) to another (62.2 GB). This should regulary fail because of different block counts.

The following should work on a system with maybe one or two partitions

  1. reducing the second partition with
    • umount /dev/sda1 && umount /dev/sda2
    • resize2fs -p /dev/sda2 55G
  2. copying the sd-card
    • dd if=/dev/sda of=/local-dir/image bs=4K
  3. switching sd-cards and copying the image back
    • dd if=/local-dir/image of=/dev/sda bs=4K

More deeper informations (sadly in german) https://www.duschblog.de/2015/07/09/raspberry-pi-karte-auf-kleinere-sd-karte-klonen/

This should also Work for the sd-card from the nano the problem is that sda2 to sda12 from the installation are not shrinkable. It is also not possible to just copy partitionwise because I dont know the correct format for sda2 to sda12.

hello matti.kaupenjohann,

BTW,
you might working with flash script to back-up the original images,
please refer to discussion thread for the Nano cloning fix, Topic 1064479.
thanks