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?

1 Answer 1


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:


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?

  • Would you add a swap partition/file to the HDD (assuming it was not an SSD) and if so how? Jun 18, 2012 at 22:15
  • I probably wouldn't bother with swap. It's not going to be very quick over USB. But by all means try it out. I'll edit my answer.
    – Jivings
    Jun 18, 2012 at 22:17
  • 1
    I wonder if the pi will continue to boot when the USB HDD is disconnected?
    – faulty
    Jun 11, 2013 at 12:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.