21

How can I set up a USB HDD to extend the life of my SD Card and maximize the performance of my Raspberry Pi?

Related: How can I extend the life of my SD card?

Andrew Fogg
  • 5,913
  • 8
  • 25
  • 28

1 Answers1

14

If you're going to have a HDD that's always attached to the Pi, then you can mount the sections of your filesystem that incur the largest number of read/writes directly from it.

These directories are probably the culprits:

/home/
/var/
/tmp/

You are able to mount partitions on your external hard drive to these directories automatically at boot. Let's say your HDD is /dev/sdb, and it has four partitions. You can append your /etc/fstab to look something like this:

/dev/sdb1       /var        ext4   defaults    0  1
/dev/sdb2       /home       ext4   defaults    0  1
/dev/sdb3       /tmp        ext4   defaults    0  1
/dev/sdb4       none        swap   sw          0  0 

I've also included a swap partition. Though you might want to research how effective swap can be over USB. I really wouldn't expect much from it.

More information about swap in this question: How to set up swap space?

Jivings
  • 22,538
  • 11
  • 90
  • 139