Hack to make pi USB jacks more powerful

Software you wrote

Hack to make pi USB jacks more powerful

Postby Doug Coulter » Thu Nov 26, 2015 4:57 pm

While not software, exactly, I wanted to put an always-on pi on my network (well, another one), in order to have a big shared space. For that, of course you don't use the SD card unless you want to be replacing them, and big USB sticks aren't all that cheap - or as big as I want.

Knowing my old "thai vibrator" (no disrespect to the Milwaukee one) laptop spinner would use too much power, I bit the bullet and got a $amsung 850 evo pro 500gb drive for that. And, even that wouldn't power up off the pi's USB, even with the magic undocumented edit to /boot/config.txt. I suspect the power draw measurements in the review I saw were only for post-boot, not peak inrush during setup.

I found this:
http://hackaday.com/2015/04/06/more-pow ... usb-ports/
Which is a hardware hack that actually maxes out the USB power supply at something around 2 amps. Even an SSD seems to draw a little extra at boot time.
This works! It will even do the older spinner drive (though my power supply does get warmer). It was kind of interesting to change that resistor as I only had 0602 size in that value - I had to put the new one on edge and scrape a little solder mask off the groundplane to do it, but hey...it works.

I'm using one of those cheap National Semi "simple switchers" you can find on ebay from china, and a wall wart, I suspect Ada's 5.1v 2a wart/switcher would do as well - after all, it's still all coming through that little fuse. In my case this will be running off the same 12v/60ah UPS system that keeps the ham rig ready no matter what, so the simple switcher is a better choice, and it'll run even if the inverter shuts off for some reason...for awhile, anyway.

I'm tempted to just copy it all (offline on another machine) and mount this over / and skip any worry about SD cards wearing out - but at the very least I will partition it and mount it over /home and /var, which normally take the most beating. Then I can just use the /home/pi/Public directory as a share for the rest of the LAN.

I already have an Amped WAP with a share - but it's dog-slow. Evidently the little CPU in there can only do around 1 mbit/second in that mode...and even with the pi sharing virtually all IO over USB - this should do substantially better (it will be wired ethernet, but then, so is the WAP)...
Posting as just me, not as the forum owner. Everything I say is "in my opinion" and YMMV -- which should go for everyone without saying.
User avatar
Doug Coulter
 
Posts: 3515
Joined: Wed Jul 14, 2010 7:05 pm
Location: Floyd county, VA, USA

Re: Hack to make pi USB jacks more powerful

Postby Doug Coulter » Fri Nov 27, 2015 8:27 pm

And...Now I have a 500gb drive mounted over root (/) on that pi. It worked on the first try!
I formatted the drive ext4 (create a master table and format the partition that is the size of the drive). I used gparted on another box.
The pi SD card has two partitions - one for UEFI and it's fat 32. I left that alone.
The other one the pi mounts over root and is ext4 - the original fstab for the pi looks like this:
Code: Select all
proc            /proc           proc    defaults          0       0
/dev/mmcblk0p1  /boot           vfat    defaults          0       2
/dev/mmcblk0p2  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
//192.168.1.240/mnt/   /home/pi/amped   cifs   guest,uid=1000   0   0

The third line mounts the second partition on the SD card over root.
(The last line mounts a network share from my WAP over a directory in pi's home)

Now it looks like this:
Code: Select all
proc            /proc           proc    defaults          0       0
/dev/mmcblk0p1  /boot           vfat    defaults          0       2
#/dev/mmcblk0p2  /               ext4    defaults,noatime  0       1
/dev/sda1   /      ext4   defaults,noatime   0   1

# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
//192.168.1.240/mnt/   /home/pi/amped   cifs   guest,uid=1000   0   0


I commented out the original mount over root, and substituted the same thing with /dev/sda1/ which is the first (and only) partition on the SSD drive.

To make this work - Obviously the SSD has to have all the junk the SD card second partition had on it already.
This was done in a separate machine, with the SD card in a reader and the SSD plugged into usb.
I had mint open me a terminal in the SSD second partition via the file browser so I wouldn't have to type that huge long pathname, then typed:
sudo cp -rp * /dev/sdc1

(* means "everything here" and /dev/sdc1 is the first partition of the SSD when plugged into my NUC - sda and sdb are existing drives on the NUC already, they get assigned in order)
I edited the /etc/fstab file on the pi's SD card, dismounted both from the NUC, attached both to the pi, and bingo - I now have a 500gb root on the pi. It's barely noticeably slower than the ultra high speed SD card (which is almost the only thing on a pi that doesn't go through USB) but it's plenty quick. Early tests show easy 10+ mb/sec transfers to other machines on the network (my crappy Amped WAP barely makes 1).

The big deal here - now a backup is a bulk copy of that SSD (rsync type stuff), no tricky bit copies. It has far better overprovision and wear leveling than any SD card...that's what's really important here.
I originally agonized over, gee, how to partition this so some amount is over /var (where logs and most databases wind up, as well as often web content), some over /tmp - which obviously gets written a lot, and /home and so on.
This way, no muss, no fuss - the rest of the distro eats a whole 4-5 gb (tops) out of the 500 - around 1%, and this way, the entire disk is available wherever needed - no arbitrary limits on this part or that.
Posting as just me, not as the forum owner. Everything I say is "in my opinion" and YMMV -- which should go for everyone without saying.
User avatar
Doug Coulter
 
Posts: 3515
Joined: Wed Jul 14, 2010 7:05 pm
Location: Floyd county, VA, USA


Return to Homebrew

Who is online

Users browsing this forum: No registered users and 1 guest

cron