I use 32gb micro sd card for my raspibian. I use dd this command to backup it. But, I found it is too large. How to shrink it before I backup it? Thanks.
Add words:
I had used a 16gb sd card. Then, I used sudo dd if=/dev/sdx of=~/myraspibianbackup.img bs=1m
for backup. Later, I just used 32gb card for recovering image.
The df -h
show me as below:
<code>
Filesystem Size Used Avail Use% Mounted on
/dev/root 15G 5.2G 8.6G 38% /
devtmpfs 458M 0 458M 0% /dev
tmpfs 462M 0 462M 0% /dev/shm
tmpfs 462M 13M 450M 3% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 462M 0 462M 0% /sys/fs/cgroup
/dev/mmcblk0p1 63M 22M 42M 35% /boot
</code>
But, why my /dev/root is still 15G, not 31G. (eg. 16gb card=>15G 32gb card=>31G)
dd
togzip
. This will be the same size as if you shrunk it first. Shrinking an image (strictly a partition on the image) is not straightforward and cannot be done on a mounted partition.dd if=/dev/sda | gzip -9 > /mnt/backup.gz
, where sda is where your system is.sudo fdisk -l /dev/mmcblk0