Bosse_B
Posts: 966
Joined: Thu Jan 30, 2014 9:53 am

SDcard Copier - shrink size of image?

Mon Feb 10, 2020 11:02 pm

So I know that the SD Card Copier that comes with Raspbian nowadays can make a backup of the RPi disk to another SD-card in a USB caddy.
I also think I know that it can make the copy even to a smaller SD-card as long as the files involved will fit on the target.

But I would like to know if it can be configured to save the files to a smaller image than the size of the target SD-card in the USB caddy?

I would like to make a backup of a working system and make that image as small as possible so that it can be used as a master when creating working clones on various sized SD-cards.
Is that possible or must I use some Linux tool to reduce the size of the created partition on the target after the SD-card Copy is ready?

This is how my disk (a 32 GB SD) is used right now (it contains several kinds of software development tools so it can be even smaller):

Code: Select all

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        30G   12G   17G  42% /
devtmpfs        1.8G     0  1.8G   0% /dev
tmpfs           2.0G     0  2.0G   0% /dev/shm
tmpfs           2.0G   17M  1.9G   1% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/mmcblk0p1  253M   53M  200M  21% /boot
tmpfs           391M     0  391M   0% /run/user/1000
Ideally I would like to be able to make an image that just fits all the source system files and then when cloning the unit later use raspi-config to expand the file system to the actual size of the individual SD-card used. They vary in size even though they are labeled the same, I have found the hard way.
Bo Berglund
Sweden

rjbook51
Posts: 45
Joined: Sun Jul 28, 2019 12:14 pm

Re: SDcard Copier - shrink size of image?

Tue Feb 11, 2020 2:52 am

Create your sd card backup, then use gparted to shrink the size of the data partition to as small as your data will allow.
Use gnome disk utilties to create an image of that sd card.
You can then always use gnome disk utilities to restore that image on another sd card, and the disk utilities will always fill the cards free space.
I have trouble seeing how your going to create an sd card smaller than 8gig and even use it...if you can even find an 8gig card now these days.
I don't know why you would want to, but you could always use gparted again to shrink the partition on the 8gig drive.

I guess you could always use fdisk and dd to do it, but I am lazy and prefer simple GUI interfaces.
No longer active on this forum

RonR
Posts: 1194
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: SDcard Copier - shrink size of image?

Tue Feb 11, 2020 3:50 am

Bosse_B wrote:
Mon Feb 10, 2020 11:02 pm
I would like to make a backup of a working system and make that image as small as possible so that it can be used as a master when creating working clones on various sized SD-cards.

Take a look at image-backup. It will create a full backup as well as do incremental backups. The images are shrunk to the smallest size possible and will auto-expand when first run.

Return to “General discussion”