Uncategorized

How to change memory card on an Android-phone

Android_logo

Many upgrade their memory cards in their Android phones to a bigger
one, and as many of those I thought it was just to insert the new one,
and copy back all the data. For many reasons, that is not just so
easy:

1) Your old card most likely contains more than one partition – a
swap, an ext2/3 partition and the big fat32-partition with your files
on it.
2) Your applications might depend on the data on your old partitions
to start, and your phone might not boot up without it being present

So, here is how to do it (with linux anyway):
1) Turn off your phone
2) Insert the new memory card
3) Start your phone in rescue mode by holding down the volume down
while turning it on
4) Partition it through rescue mode
5) Format it through rescue mode

Now we are ready to move your old data over to the new memory card.
If you have two card readers, you can do it directly from card to
card, if not, you need to go through an extra step. But the steps are
basicly the same.

If you have two card readers:
1) dd if=/dev/old_memory_card_partition
of=/dev/new_memory_card_partition conv=notrunc,noerror

If you only have one card reader:
1) Insert the old memory card
2) dd if=/dev/old_memory_card_partition
of=/location/to/save/memory_file.dd conv=notrunc,noerror
3) dd if=/location/to/save/memory_file.dd
of=/dev/new_memory_card_partition conv=notrunc,noerror

Repeat the dd-process for each partition (except swap).

At this point the new memory card has all your old data, and will work
if you insert it. However, since we copied the whole partition with
dd, it includes file system information like the size of the
partition. Which means that even though the new partition might be a
lot bigger than your old, it will only use up to the same space as the
old partition. You can see this if you insert the new memory card in
your card readser/linux machine and do a df – it will show a total
size that is right, use space is right, but free space is very small.
So we need to resize the filesystem(s):

1) Insert your new memory card
2) Start ‘parted’
3) Write ‘print devices’
4) Write ‘select ‘ and the device name for your memory card
5) Write ‘print’
6) Write ‘resize’ and follow the step by step choices it gives you.
Just resize it to fill the whole partition. It should be rather quick
to do
7) Repeat step 6 for each partition you copied over with dd
8) Write ‘quit’

At this point you should be able to mount your new partitions on the
linux machine and see that you have the right amount of free disk
space. You can unmount it, insert it into your phone and turn it on
and use it all 🙂

Good Luck!

32gb_memory_card

Leave a Reply

Your email address will not be published. Required fields are marked *