1

I have have 32GB SD card Cloned Image of Raspberry PI, I want to make it small size as Flashing back to another SD card takes more time using DD command, I need a small size image so that i can place it in 64GB server Raspberry pi booted through network and flash the image to Client SD card, please guide on how to convert the Cloned Image to small size and flash using DD command

Milliways
  • 59,890
  • 31
  • 101
  • 209
abhi
  • 23
  • 4
  • Are you ACTUALLY using berryboot? – Milliways Aug 12 '23 at 07:15
  • i have used the truncate command. Following steps got from ChatGPT app:
    1. Open a terminal on your Linux system.
    2. Identify the path and filename of your 32GB SD card cloned image. Let's assume the path is /path/to/original_image.img.3. Determine the desired size for the new, smaller image.
    – abhi Aug 14 '23 at 10:03
  • For example, if you want to reduce it to 16GB, calculate the size in bytes: 16GB * 1024MB/GB * 1024KB/MB * 1024B/KB = 17179869184 bytes.4. Run the truncate command to shrink the image. Replace /path/to/original_image.img with the path to your original image file, and 17179869184 with the desired size in bytes:
    shell truncate --size=17179869184 /path/to/original_image.img
    – abhi Aug 14 '23 at 10:03
  • With the truncate i am able cut unused space so 32GB - 5 GB(OS Apace) = 27GB unused space i have removed, now i converted from 32gb to 5gb...when i did recompressed using 7z its became 1gb, is there any further operation to convert 1gb to 100 or 200mb? – abhi Aug 14 '23 at 10:07
  • truncating a file will omit vital parts of the image. it may be OK if you shrink the root partition first. The simple fact is dd is a poor backup tool. – Milliways Aug 14 '23 at 11:56
  • i am able to Shrink the pi image to pishrink of 6.5GB, – abhi Aug 26 '23 at 11:22

1 Answers1

0

One solution is to install image-utils on your RPi, and make a backup image file (*.img). The .img file takes only a few minutes to create, and can easily be used to create clones of your system to an SD card. Ref this other answer for details.

Seamus
  • 21,900
  • 3
  • 33
  • 70
  • Thanks for the response Seamus, i have not got proper download link for image-utils , below is my compression methods 1 ) i did truncate of 32 GB SD card Clone to 5GB 2 ) converted 5GB to 1GB using 7zip and i tried tar, zip, xd, iso but i got Approx1GB , even if i try recompress of already compress is 1GB, i expect around 400MB – abhi Aug 17 '23 at 07:49
  • @abhi: Downloads for image-utils: 1) from the RPi forum page, 2) from GitHub – Seamus Aug 17 '23 at 07:55