1

My scenario is simple: my android phone has internal microSD card with size of 2Gb and I run out of space. Now I bought a new 16Gb microSD card where I want to migrate.

Steps: 1. Insert old sd card, use dd to make backup

# dd if=/dev/mmcblk0 of=backup.img bs=1M
  1. Insert new sd card, dd old image
# dd if=backup.img of/dev/mmcblk0 bs=1M
  1. Resize the partition...wait I can't see partitions there
# fdisk /dev/mmcblk0 
Welcome to fdisk (util-linux 2.21.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): p

Disk /dev/mmcblk0: 16.0 GB, 16001269760 bytes
4 heads, 16 sectors/track, 488320 cylinders, total 31252480 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: 0x00000000

        Device Boot      Start         End      Blocks   Id  System

Command (m for help): 

Ok, let's try resize?

# resize2fs /dev/mmcblk0 
resize2fs 1.42.3 (14-May-2012)
resize2fs: Bad magic number in super-block while trying to open /dev/mmcblk0                                                                                                                                                                 
Couldn't find valid filesystem superblock.        

GParted shows 16Gb fat16 partition, but the available size is still old 2Gb size from old microSD.

What I'm doing wrong?

4
  • 1
    Why do you need to bit-for-bit copy that...? Seems very unnecessary. But the issue is that you're bit-for-bit copying 2gb to 16gb, so it will just be 2gb. You can resize that in gParted but you may need to eject and reinitialize for it to work (I have had that same issue in the past)
    – nerdwaller
    Feb 11, 2013 at 20:40
  • Some questions - 1. If you pop the 16 gig card in your phone, does it work (as a 2 gig one ?). 2. Are you sure you need to use resize2fs - some variants of linux use resize4fs to resize ext4 partitions.
    – davidgo
    Feb 11, 2013 at 20:50
  • @nerdwaller I ejected the sd card, but gparted still did not see 2Gb partition. What do you mean by reinitialize? How did you solved your issue in the past?
    – LukasT
    Feb 12, 2013 at 8:29
  • @davidgo When I insert the 16 gig card into the phone, it works. As Justin pointed out below, I need to try fatresize maybe.
    – LukasT
    Feb 12, 2013 at 8:53

1 Answer 1

1

Create a new file system, rsync files over. You don't need dd and rsync will be quicker and copy everything anyway if you use '-a' option.

It is odd that you cannot either resize2fs or see a partition. The only thing is, is this a FAT32 SD card? It is unlikely it is ext2/3/4, which is the only filesystems resize2fs supports. Have you tried fatresize instead?

2
  • I used dd because I wanted to know the general solution, e.g. you are copying image to SDCard for Raspberry Pi and in that case there is already some script bundled that resize the card for you. I don't know which filesystems are supported by my old Android phone (2.3 android), so I dd the data so that partition is created for me (it seems to be FAT16)
    – LukasT
    Feb 12, 2013 at 8:31
  • I accept @Justin solution. Original SD Card had FAT16 partition,that can be only 4Gb so I would have to create more partitions and don't want that. So I created new FAT32 partition and used rsync to migrate data.
    – LukasT
    Feb 12, 2013 at 19:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .