-1

I can see there are several similar threads on same.However I am running into a problem where reading an image from sd-card using dd or Win32diskimager copies whole card rather than actual image. Because of this, we are running in to a problem where we cannot copy cloned image to a card of theoretically same size (say 8G to 8G) but practically slightly lesser than 8GB.

My search lead me to How can I copy the same image to many SDs? , I was trying to use script mkimg.sh. But as I run it using command , am running into an error:

sudo bash mkimg.sh /dev/sdb sdcard.zip

e2fsck 1.42 (29-Nov-2011)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdb2: 204406/394352 files (0.3% non-contiguous), 1585523/1596128 blocks

mkimg.sh: line 56: let: long.: syntax error: invalid arithmetic operator (error token is ".")

this is how err line looks :

let bytes=`resize2fs -M ${linux_partition} 2>&1 | grep -i -e "The filesystem .*is .*blocks long" | sed -e 's/.*is [^ ]* \([0-9]*\) (4k) blocks.*/\1*4096/'`

I made some trial but as am not bash expert , i am unable to understand where is error in this statment.

1 Answers1

0

You say "copies whole card rather than actual image". What do you think the "actual image" is? An image is usually a copy of the whole. You can copy portions using dd but this usually requires manual editing of the partition table to match the target.

You can use the SD Copy which is available in the GUI of latest Raspbian to make a copy to an empty SD Card mounted in a SD Card reader. This works to a larger or smaller card.

Milliways
  • 59,890
  • 31
  • 101
  • 209
  • Hi Milliways, actual image means "bootable Raspbian with customised rootfs image excluding empty sectors of source sd-card" as that unnecessary bloat the image size making it unable to migrate to other cards who are smaller than source sd-card but large enough to hold bootable raspbian image. – shallyverma Oct 18 '16 at 05:40
  • I was trying to use above shell script but getting error on this line – shallyverma Oct 18 '16 at 05:41
  • @shallyverma What about the Partition table? You have to decide whether you want to copy the card, or debug someone's bash script which contains a lot of random assumptions. It is not that difficult to shrink the root partition, and copy the card, ignoring the free space, but why bother when the Foundation has given you an ideal tool. – Milliways Oct 18 '16 at 07:39
  • Milliways .. are you referring to sd-copier tool that comes with raspbian image? – shallyverma Oct 20 '16 at 05:48