Raspian SD Card Image

Hi…

Can anyone tell me how to make a new raspian image… I have made modifications and added some code to the current factory image (DRTLS_raspbian_R2.0.img) and now I want to create a fresh img file so that my changes can be deployed to all our new devices. I tried ‘dd’ as per a few web sites. That seemed to create a 15 GB copy of the img. But I always run into errors when the shrinking stages comes along. I will continue to try googling for an answer… But if anyone can point me in the right direction I would really appreciate it.

Thanks,
Pat

ok. I managed to get it working…

Note: These are the steps I used based on the equipment I had. I had a Windows 7 PC with an SD Card reader running a Ubuntu Linux VM. Your equipment may differ so you may have to adjust these steps accordingly.

  1. Insert the SD card with the image to copy in the PC card reader…

  2. Start a Linux VM from the Window host (VM needs enough space for 2 copies of the image + VM. I used 32GB SD cards so I need 64GB + VM… I used 100 GB VM)
    https://www.virtualbox.org/
    Get Ubuntu | Download | Ubuntu

  3. mount the SD card as a drive…
    Accessing SD Card from Linux VirtualBox Guest on Windows Host

  4. Use fdisk -l in the VM to determine the device identifier of the SD card…

  5. Use “dd” to write a copy of the device to an img file


    Note! Use the whole device. Eg “/dev/sdb”… not just the Linux partition “/dev/sdb2”

  6. Shrink the image with this shrinker script…


Some of these steps were derived from …

So thanks to the article written by Nilesh Jayanandana. I found it very helpful.

1 Like