If you have a small portable 2.5″ hard drive that draws power from the USB port, you can make this work without the need for an external power supply with the Raspberry Pi Model B+. You will be modifying how the GPIO pins on the Pi work, specifically turning pin 38 on (represented by 1). This means you can double the current over the USB bus from 600mA to 1200mA so you can actually power external USB devices through the Raspberry Pi itself. I tested this with the latest Raspbian September 2014. The hard drives I used were a USB 3.0 device and a USB 2.0 device with a Y adapter which has two USB male outputs, one for power and one for data transfer. Some of the devices were in generic external enclosures, all 4 disks and their enclosures worked suggesting the Pi will not be picky.
This guide also solves the ‘my hard drive is making a clicking sound when I plug it in' error by fixing the USB current. If it doesn't you may need additional power from a USB hub or your hard drive may be defective. You must be using a 5V 2A Micro USB Power Adapter to fix the clicking issue.
If you are trying to figure out which hardware would work best for you, consider reading the Pi benchmarks.
Pi Unit | ||||||||
---|---|---|---|---|---|---|---|---|
Raspberry Pi 3 | Quad Core | |||||||
Raspberry Pi 2 | Quad Core | |||||||
Raspberry Pi | Single Core | |||||||
Banana Pi | Dual Core | |||||||
Banana Pi Pro | Dual Core |
Power 2.5″ Hard Drive with Raspberry Pi 2 and B+
You will require these items for the process to work
- A 2.5” hard drive, USB 2.0 or 3.0 will work with or without a Y adapter
- A 5V 2A Micro USB Power Adapter
- Raspberry Pi Model B+ or Pi 2
This will fix the error when the Pi says the hard drive is spinning up but you were unable to mount it
You will only be able to mount 1 drive using this method, additional USB hard drives will require external power so make sure you buy a large hard drive like 1 or 2 TB (terabytes). If you have several smaller hard drives you want to use then consider a powered USB hub which will allow several hard drives.
- D-Link Hi-Speed USB 2.0 4-Port Powered Hub for Raspberry Pi
- BobjGear 4 Port USB 3.0 Powered Hub for Raspberry Pi
Here are some good Amazon deals on 2.5 inch USB portable hard drives for the Raspberry Pi
- Western Digital 1TB Portable USB 3.0 Hard Drive
- Seagate Expansion 1TB Portable USB 3.0 Hard Drive
- Western Digital 2TB Portable USB 3.0 Hard Drive
Use 2.5″ Hard Drive with Raspberry Pi B+ and Pi 2
Use this command while the hard drive is connected to the Pi
sudo blkid
It only shows the SD card partitions
/dev/mmcblk0p1: SEC_TYPE="msdos" LABEL="boot" UUID="787C-2FD4" TYPE="vfat"
/dev/mmcblk0p2: UUID="3d81d9e2-7d1b-4015-8c2c-29ec0875f762" TYPE="ext4"
Now update the Raspberry Pi's firmware, this may not be necessary but is good practice. It will be necessary, if you have an older version of Raspbian installed.
You can just jump down to editing the config.txt file and rebooting, if that doesn't work you will need to rpi-update
sudo rpi-update
You will have to reboot afterwards
sudo reboot
Now edit the config.txt file
sudo nano /boot/config.txt
Add this line to the bottom of the file, it replaces the old safe_mode_gpio=4
max_usb_current=1
Ctrl+X, Y and Enter to save
Reboot the Pi again to enable the GPIO pin 38
sudo reboot
Now check to see if the hard drive is visible
sudo blkid
You should now see a /dev/sda1 device
/dev/mmcblk0p1: SEC_TYPE="msdos" LABEL="boot" UUID="787C-2FD4" TYPE="vfat"
/dev/mmcblk0p2: UUID="3d81d9e2-7d1b-4015-8c2c-29ec0875f762" TYPE="ext4"
/dev/sda1: LABEL="HTPCGuides" UUID="30AADDC8AADD8AAC" TYPE="ntfs"
If it doesn't show up verify that the GPIO pin is enabled.
Install git first
sudo apt-get install git-core -y
Clone the program Wiring Pi from git
git clone git://git.drogon.net/wiringPi
Enter the Wiring Pi folder and build it
cd wiringPi && ./build
Now check the GPIO 38 Pin
gpio -g read 38
It should return 1 meaning ‘on'
1
If the value it returns is 0 meaning off, tell it to be 1 with this command
gpio -g write 38 1
If it doesn't show up you likely have an issue with your power adapter or your power in your house, try attaching the power straight to the wall without any multipliers and retest.
Now you are all set to mount the drive properly and manage your hard drive's power since it will not power down automatically on Linux.
This guide was pieced together from Gordon's projects and Ben Stienstra's Polaire Wiki