Saturday, November 7, 2015

Upgrading the SD Card on a Raspberry Pi

Well this turned out to be a whole lot easier than I thought :-)

I had an old card from a version 1 Raspberry Pi and had just moved it to a version 2 board. It's a little mail, DNS etc server and stalls occasionally especially when fail2ban is starting as that goes through all the syslogs etc looking for failed logins.  Top showed way too much waiting for disk time so it was time to investigate.

I brought a new SDCard (bigger was my first goal as mail expands) and an SDCard reader and started playing.  Well, boy is SDCards one of those things you don't know what you don't know. It's just a little card you chuck in your phone or camera?  No way.

There is so much forwards, backwards compatibility and huge variations in speed.

I bought a MicroSD HC UHS class 3 card. Benchmarking showed this seemed to be limited by USB2 speed but was already three to five times faster than the old card but would the Ra Pi read it?

The easy part was moving the data from the old card to the new one.  There are 3 partitions (well 3 actual,  4 logical) on the old card. Oddly you have

RECOVERY a 1.5 GB fat32 partition then
and extended partition that has
BOOT a 64MBish fat32 logical partition and
root a 6GB ext4 logical partition and
SETTINGS a small ext4 partition.

They could have avoided using logical partitions all together but I guess it give easy expansion.

The actual transfer from the old card to the new card was as easy as mounting both, starting GParted and copy and paste the partitions.  That is a fantastic piece of software. Literally right click, copy from /dev/sde and paste /dev/sdf and adjust the size of the root partition to use the rest of the free space and it's done.

Plugged the card into the Raspberry Pi 2 and started it up.  Looked good! The disk light flashed and it seemed to boot.  The access seemed briefer if that is the right word.  It used to flash and stay on a few seconds at a time during boot but it was less than a second for each pulse now.

By the time I logged in (it's headless in the garage so this is about 1 minute later)  it had started and fail2ban had started so it was way quicker.

This is all anecdotal but it feels quicker and the Ra Pi 2 seems to be happy with the new cards.  I'm not sure how much the Ra Pi wears an SD card so replacing them every so often seemed sensible.


No comments: