I just realised that provided you don't need to resize any partitions you can actually do it on the Mac.
WARNING Make doubly sure that you don't accidentally write in the wrong place.
The following script I wrote to rearrange Ubuntu MATE partitions and you should be able to adapt this to copy your data.
NOTE All care BUT no responsibility, and you really need to understand partitioning!
#!/bin/bash # script to create a Ubunutu MATE image with properly aligned partitions # 2015-11-06 echo #INPUT_IMG="ubuntu-mate-15.10-desktop-armhf-raspberry-pi-2.img" INPUT_IMG="PiMate1510back20151106_small.img" OUTPUT_IMG="ubuntu-mate-15.10.img" # Partition details of input image P1START=2048 P1SIZE=131072 P2START=133120 P2SIZE=7546880 # Partition details of output image P1NEW=8192 P2NEW=139264 # End of user configuration #let IMG_END=$P2NEW+$P2SIZE+140000 let IMG_END=$P2NEW+$P2SIZE echo -e $P1START - $P1NEW $P1SIZE echo -e $P2START - $P2NEW $P2SIZE echo -e $IMG_END # Create an empty image file dd if=/dev/zero of=$OUTPUT_IMG count=$IMG_END # Create partitions echo -e " e 1 0C n $P1NEW $P1SIZE e 2 83 n $P2NEW $P2SIZE quit" | fdisk -e $OUTPUT_IMG echo "Finished Create partitions" # Copy partitions dd if=$INPUT_IMG skip=$P1START of=$OUTPUT_IMG seek=$P1NEW count=$P1SIZE dd if=$INPUT_IMG skip=$P2START of=$OUTPUT_IMG seek=$P2NEW count=$P2SIZE #fdisk $OUTPUT_IMG
rsyncthe contents from the original into the new smaller version. You'll need to useddandfdiskto create the new versions, see here. Beware that Milliway's scripted version is likely to loose data if the system has been used much since it does not copy the contents, it just copies raw blocks.ddcopies/moves blocks but the mapping of these blocks to physical storage is a function of the SD Card firmware (as I am sure you pointed out to me in the past when I raised the issue of data loss with another questioner)dd. However, the filesystem is structured using them, and does assign them specific content. Whether they are real or virtual on the device is irrelevant. So if you have a filesystem 20 blocks in size and you've only used 7, those 7 may be dispersed. They are not necessarily 1-7.ddand copy half the blocks, you copy 1-10. Again, it does not matter whether those are "real" or "virtual" numbers with respect to the physical device. They are real to filesystem. So if 13, 14, and 19 were 3 of the 7 blocks used, you just lost 3/7 of the data in the filesystem.