Rein Posted July 22, 2017 Posted July 22, 2017 Hi, I am running Armbian Jessie (4.11.6-sunxi) on Banana Pi M1. For reading and writing SD cards I use linux dd cmd on another box. I do not have a Windows system. My question is this: My SD card is a 16Gb device. With gparted I can reduce the size of the system to a partition that would easily fit on a 4Gb device. But when writing the .img file dd will still see and write an image of 16 Gb There must be a way to make an image that can be written to and booted from a smaller device to save resources on the backup disk. Can anyone point me in the right direction ?
martinayotte Posted July 22, 2017 Posted July 22, 2017 Using "truncate" with the "endsect" number shown by fdisk after gparted shrinking. Here is the sequence : sudo modprobe loop sudo losetup -f sudo losetup /dev/loop0 myimage.img sudo partprobe /dev/loop0 sudo gparted /dev/loop0 sudo losetup -d /dev/loop0 fdisk -l myimage.img sudo truncate --size=$[(endsect+1)*512] myimage.img 1
Rein Posted July 23, 2017 Author Posted July 23, 2017 Thank you, martinayotta, I'll try this today ! As I understand it I still have to make an imagefile of the full 16Gb before I can shrink it to below 4Gb. Maybe you can confirm this?
martinayotte Posted July 23, 2017 Posted July 23, 2017 Yes, unless you shrink the partition directly on the source media ...
Recommended Posts