# PiShrink

##### Dumping existing image

Install cockit on Raspberry Pi

```shell
sudo apt install cockpit
```

Shutdown Raspberry PI, take out the SD card, and connect it to your PC.

The `boot`- and `rootfs`-partitions were automatically mounted at the mentioned mount points. Before you proceed, unmount them with :

```shell
umount /dev/mmcblk0p1
umount /dev/mmcblk0p2
```

Now we copy the contents of the SD card to our file system.

```shell
sudo dd if=/dev/mmcblk0 of=/home/alang/worktmp/PiShrink/my_rasp.v2.img bs=32M
```

Download the PiShrink

[https://github.com/Drewsif/PiShrink ](https://github.com/Drewsif/PiShrink)

Now invoke the script by typing:

```shell
sudo ./pishrink.sh my_rasp.v2.img
```

##### Flash the image to the SD card

- [BalenaEtcher](https://www.balena.io/etcher/)
- [SD Cards and Writing Images](https://learn.sparkfun.com/tutorials/sd-cards-and-writing-images/)