Posts Tagged ‘hardware’

How to change memory card on an Android-phone



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

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!


The stress of disk failure



A few weeks ago my ZFS raid containing 12 1.5tb Western Digital green
drives was degraded due to a drive failure. As I have a hot spare
added to the raid as well, the raid was quickly rebuilt and has been
working fine through the problems and afterwards. I ordered two new
drives, and today I thought I would change the defective drive, and
let the replacement-drive become the new hot spare. Before I started,
I did a detach of the defective drive to make the hot spare
permanently stay in place of the defective drive: ‘zpool detach DATA



Before I started, I thought it would be a good idea to reboot the
server, just to see if the server works as it should before I started
tinkering. I reboot, and the server starts beeping loudly about a
drive missing (this was from the raid controller before the OS had
started). I thought nothing of it, thinking that it was the one that
was defective. So, I started the OS to see if everything worked as it

A quick ‘zpool status’ showed me that I had indeed a new problem: A
new drive had failed, and one of the three raidz1-groups was now
degraded as I did not have any hot spare free to rebuild the raid.
While doing some ‘zpool status’ my heart suddenly skipped a few beats
as I noticed a second drive in the same raidz1-group missing, and the
message was now that the zpool did not have enough replicas to
function at all. Luckily I have been in tough situations when it
comes to drives and hardware before, so I thought this was not a good
time to panick. I descended from the attic, and took a break with
some coca cola.


I thought, why would two “new” drives fail at the same time, before I
had even touched anything? I got back up to the attic, and now one of
the drives missing was suddenly working again and some data had been
resilvered. This made me think that maybe the drives were not
defective after all, maybe they just had some bad cables. I turned
off and opened the server, and checked every cable thouroughly.
Having close to 20 hard drives in this server, there are as you can
understand quite a few power splits. One of them was going to the two
drives that were missing (of which one had luckily come back). I
changed out the powersplit, and also changed the defective drive that
was the original problem. I booted the server and did the changes in
the raid controller, making new volumes for the new drive and the
changed one. Then booted the OS in single user mode.

Luckily drive number two of the two that went missing was still
working, and I did a ‘zpool replace DATA c0t3d0 c0t3d0’ to get the
zpool to rebuild and start using the first drive that had been
missing. Then I added the new hot spare to the zpool:
‘zpool add DATA spare c3t5d0’ After about 1.5 hours the raid had
been rebuilt, and was back in normal mode with no faults.

Hopefully the problem with the two drives that went missing is only
the power splits, and that they don’t give any new problems. And also
that it will be a long, long time before the new hot spare is needed

Thank God for raid and hot spares, I do not even want to think about
loosing the 12tb raid. I do have backups of the most important stuff,
but backing up all of the data is quite impossible at home with such
amounts. Starting from scratch with all of my ripped movies and music
and so on would be a nightmare.




%d bloggers like this: