USB storage, again.

Posted by Clym5 
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.
Now, this forum is in read-only mode. You find details Details hereContinue on /r/PirateBox
USB storage, again.
May 17, 2014 05:17AM
Hi all!

I've just put together a Piratebox and I was wondering how to use a external USB flash drive as the upload destination?

I've read a few threads here, and I couldn't get the solutions in them to work. (Most likely user error on my side!)

My SD card is only 4gb, which won't be enough, and I have a 32gb USB pen drive I'd like to use.

I've tried to do a symlink, and change the upload folder in piratebox.conf. The symlink does nothing, and the changed config causes uploads to fail.

Many thanks for reading, and even more so if you can help!



Edited 3 time(s). Last edit at 05/17/2014 09:11AM by Clym5.
Re: USB storage, again.
May 18, 2014 08:43PM
Hi,
how is your usb stick formatted?
How is it configured to be mounted correctly?
can you please provide the output of

mount
mount | grep sd | awk '{print $3;}'  | xargs -I []   ls -l []
ls -l /opt/piratebox
ls -l /opt/piratebox/share
ls -l /opt/piratebox/www

regards Matthias
Re: USB storage, again.
May 19, 2014 08:49AM
Hi Matthias! Thanks for the speedy reply!

The USB stick is formatted as fat32.

It seems to automatically mount in /media/USBNAME. I can read and write files to it. USBNAME being the name of the drive.

Here's the output of those commands in order.
pi@raspberrypi ~ $ mount
/dev/root on / type ext4 (rw,noatime,data=ordered)
devtmpfs on /dev type devtmpfs (rw,relatime,size=216132k,nr_inodes=54033,mode=755)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=44880k,mode=755)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=89740k)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620)
/dev/mmcblk0p1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=ascii,shortname=mixed,errors=remount-ro)
The 2nd one does nothing.
pi@raspberrypi ~ $ ls -l /opt/piratebox
total 36
drwxr-xr-x 3 root   root    4096 Feb  9 11:09 bin
drwxr-xr-x 3 root   root    4096 Feb  9 06:39 conf
drwxr-xr-x 2 root   root    4096 Jun  7  2013 init.d
drwxr-xr-x 2 root   root    4096 Feb  9 03:43 python_lib
drwxr-xr-x 5 nobody nogroup 4096 Feb  9 03:43 share
drwxr-xr-x 2 root   root    4096 Jun  7  2013 src
drwxr-xr-x 2 nobody nogroup 4096 Feb  9 12:30 tmp
-rw-r--r-- 1 root   root      18 Jun  7  2013 version
drwxr-xr-x 4 nobody nogroup 4096 Feb  9 05:52 www
pi@raspberrypi ~ $ ls -l /opt/piratebox/share
total 20
drwxr-xr-x 2 nobody nogroup 4096 Feb  9 03:43 board
-rwxr-xr-x 1 root   root    4318 Feb  9 03:43 index.html
drwxr-xr-x 2 nobody nogroup 4096 Feb  9 12:20 Shared
drwxr-xr-x 2 nobody nogroup 4096 Feb  9 03:43 tmp
pi@raspberrypi ~ $ ls -l /opt/piratebox/www
total 180
lrwxrwxrwx 1 root   root       26 Feb  9 03:43 board -> /opt/piratebox/share/board
drwxr-xr-x 2 nobody nogroup  4096 Jun  7  2013 cgi-bin
-rw-r--r-- 1 nobody nogroup   637 Feb  9 12:30 chat_content.html
-rwxr-xr-x 1 nobody nogroup  1518 Jun  7  2013 chat.html
-rwxr-xr-x 1 nobody nogroup  1406 Jun  7  2013 favicon.ico
-rw-r--r-- 1 nobody nogroup     0 Feb  9 03:43 forban_link.html
-rwxr-xr-x 1 nobody nogroup   172 Jun  7  2013 forum.html
-rwxr-xr-x 1 nobody nogroup  4323 Feb  9 05:33 index.html
-rw-r--r-- 1 nobody nogroup 94840 Jun  7  2013 jquery.min.js
drwxr-xr-x 3 nobody nogroup  4096 Jun  7  2013 library
-rw-r--r-- 1 nobody nogroup    15 Jun  7  2013 ncsi.txt
-rwxr-xr-x 1 nobody nogroup 16453 Jun  7  2013 piratebox-logo.png
-rwxr-xr-x 1 nobody nogroup 12637 Jun  7  2013 piratebox-logo-small.png
-rwxr-xr-x 1 nobody nogroup   201 Jun  7  2013 redirect.html
lrwxrwxrwx 1 root   root       16 Feb  9 05:52 shared -> /media/PIRATEBOX
lrwxrwxrwx 1 root   root       27 Feb  9 03:43 Shared -> /opt/piratebox/share/Shared
-rw-r--r-- 1 nobody nogroup   122 Feb  9 12:32 station_cnt.txt
-rwxr-xr-x 1 nobody nogroup   298 Jun  7  2013 style.css



Most of the issues I've had I have been able to fix, but there's one that I cant get going, and that is the Connected clients counter. I've made it appear, and report how many connected users, but after 2 minutes since boot, it goes back to 0. I have to manually run
sudo /opt/piratebox/bin/install_piratebox.sh /opt/piratebox/conf/piratebox.conf station_cnt
Every time I want it to update once.

Thanks for taking the time to help!

Clym5.
Re: USB storage, again.
May 19, 2014 11:53AM
Did you grab the output, while the usb stick was connected?

You made some mistakes while linking.

You should do the following commands now, assuming, that the USB-Stick is named "PIRATEBOX", like you created the link.

rm  /opt/piratebox/www/shared    #remove the false link
mkdir /media/PIRATEBOX/PirateBox
mv -v /opt/piratebox/share  /media/PIRATEBOX/PirateBox/ 
ln -s /media/PIRATEBOX/PirateBox/share  /opt/piratebox/share

If the nobody user is able to read-write to the usb-Stick, that should do the trick.

About the station_cnt script: did you enable your cron service on the RPi? That one is responsible for creating the station_cnt file

Hope that helps
regards Matthias
Re: USB storage, again.
May 20, 2014 09:05AM
Well, aren't I silly! I didn't have the USB stick connected... I also lost it. I'll try find it when I can! Bah..

I'll run those commands as soon as I can! Thanks!


I'm pretty sure the cron service is running, I can see it listed in the output of "top". The station_cnt file reports how ever many people are connected, but then goes to 0 after 2 min. I'd think that it must be running if it resets to 0 when it should update, instead of just staying as the number of the first check. Just a thought.

Thanks again!

Clym5.
Re: USB storage, again.
May 20, 2014 12:27PM
For which user did you setup the crontask ?
How did you run the "crontab" command ?

Maybe it is a permission problem.
Re: USB storage, again.
May 22, 2014 08:03AM
Eheheheh.. I don't recall running those commands at all!

I'm away from my box for a few days, so I wont be able to try anything for a bit.

I'll definitely post back when I can though!

Thanks for taking the time to help so far!