Skip to main content

copy partition of sd card

dump partition of original sd card

sudo parted /dev/sdx print
sudo dd if=/dev/sdx1 of=tablet_sdx1.img bs=4M

restore to new sd card

sudo parted /dev/sdx print
sudo dd if=tablet_sdx1.img of=/dev/sdx1 bs=4M

confirm the size of filesystem

sudo mount /dev/sdb1 /media/tmp
df
sudo umount /media/tmp

extend the filesystem (if needed)

sudo apt install --no-install-recommends fatresize
sudo fatresize -i /dev/sdb1
max=$(expr $(sudo fatresize -i /dev/sdb1 | awk -F: '$1~/Max size/{print $2}') / 1024)
sudo fatresize -s ${max}k /dev/sdb1
sudo fatresize -i /dev/sdb1

confirm the size of filesystem

sudo mount /dev/sdb1 /media/tmp
df