After some Googling  I could not find a working recipe for this issue.

NB!! Make a backup of your original SD card with dd !!
(e.g. when you made a ‘mistake’ ; -)

I borrowed a 8GB (mini) SD card for my Raspberry Pi, but after some time
the owner wanted it back.

It seemed that my new 8GB card was somewhat smaller (around 60 MB)
than the borrowed one. I could not clone the cards with dd.

The recipes for this issue all use (g)parted, but parted gave a fatal error as the
data partition was too large for the size of the new card.
fdisk was the only tool not impressed with this situation (cfdisk also gave a fatal error).

Here’s how I solved this problem after some fiddling on a seperate computer
where the partitions are unmounted.

First I cloned the card with dd, which gave an error that the new card was too small.

The situation:

Borrowed 8 GB (mini) SD card, fdisk -lcu :

Disk /dev/mmcblk0: 8010 MB, 8010072064 bytes
4 heads, 16 sectors/track, 244448 cylinders, total 15644672 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0002c262
Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            8192      122879       57344    c  W95 FAT32 (LBA)
/dev/mmcblk0p2          122880    15644671     7760896   83  Linux

New 8 GB SD card, fdisk -lcu :

Disk /dev/sdf: 7948 MB, 7948206080 bytes
245 heads, 62 sectors/track, 1021 cylinders, total 15523840 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0002c262
Device Boot      Start         End      Blocks   Id  System
/dev/sdf1            8192      122879       57344    c  W95 FAT32 (LBA)
/dev/sdf2          122880    15644671     7760896   83  Linux

The new card is  15644672 – 15523840 = 120832 512-byte sectors (60412 KB) too small.
The size of the new ext4 filesystem has to be 7760896 – 60412 = 7700480 KB.

First check the file system:  e2fsck -f /dev/sdf2.

Secondly, resize the filesystem:  resize2fs /dev/sdf2 7700480K

Thirdly enter fdisk and do the following:

List the partitions (‘p’)

Delete partition 2  (‘d’ and then ’2′)

Create a partition (‘c’, then ‘p’ (primary partition), then ’2′

Startblock has to be 122880 (‘enter’)

Endblock is the last block suggested (‘enter’)

Write the partition table to disk (‘w’)

Remove the SD card from your computer and insert it into the Raspi.

My result was:

sudo fdisk -l /dev/mmcblk0

Disk /dev/mmcblk0: 7948 MB, 7948206080 bytes
4 heads, 16 sectors/track, 242560 cylinders, total 15523840 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0002c262

Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            8192      122879       57344    c  W95 FAT32 (LBA)
/dev/mmcblk0p2          122880    15523839     7700480   83  Linux