11-27-2016, 03:31 PM
(This post was last modified: 11-27-2016, 03:33 PM by martinayotte.)
To shrink an image under Linux :
when gparted started, select "partion resize", resize it a bit bigger than space needed, the "apply".
"endsect" should be replace by end-sector display by fdisk.
Code:
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
truncate --size=$[(endsect+1)*512] myimage.img
when gparted started, select "partion resize", resize it a bit bigger than space needed, the "apply".
"endsect" should be replace by end-sector display by fdisk.