USB storage, How on current image (8/6/14)

Posted by battletux 
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, How on current image (8/6/14)
June 08, 2014 02:13PM
Hello,

Trying to get usb storage working but I'm a little lost. Had a look over older entries but they look to have been for when the raspberry pi image was based on Raspbian and I'm not familiar with Arch (so don't want to break anything).

From looking at previous threads, here are the requested command outputs:

mount

[root@alarmpi ~]# mount
/dev/mmcblk0p5 on / type ext4 (rw,relatime,data=ordered)
devtmpfs on /dev type devtmpfs (rw,relatime,size=85060k,nr_inodes=21265,mode=755)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620)
tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct,cpu)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_prio)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=22,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
tmpfs on /tmp type tmpfs (rw)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime)
configfs on /sys/kernel/config type configfs (rw,relatime)
/dev/mmcblk0p1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,size=47348k,mode=700)
[root@alarmpi ~]#

mount | grep sd | awk '{print $3;}' | xargs -I [] ls -l []

[root@alarmpi ~]# mount | grep sd | awk '{print $3;}'  | xargs -I []   ls -l []
[root@alarmpi ~]#

ls -l /opt/piratebox


[root@alarmpi ~]# ls -l /opt/piratebox
total 36
drwxr-xr-x 3 root   root    4096 Jun  6 03:08 bin
drwxr-xr-x 3 root   root    4096 Jun  8 05:12 conf
drwxr-xr-x 2 root   root    4096 Jun  5 06:31 init.d
drwxr-xr-x 2 root   root    4096 Jun  8 05:12 python_lib
drwxr-xr-x 5 nobody nogroup 4096 Dec 31  1969 share
drwxr-xr-x 2 root   root    4096 Jun  5 06:31 src
drwxr-xr-x 2 nobody nogroup 4096 Dec 31  1969 tmp
-rw-r--r-- 1 root   root      19 Jun  5 06:31 version
drwxr-xr-x 4 nobody nogroup 4096 Jun  8 05:12 www
[root@alarmpi ~]#

ls -l /opt/piratebox/share

[root@alarmpi ~]# ls -l /opt/piratebox/share
total 16
drwxr-xr-x  2 nobody nogroup 4096 Dec 31  1969 Shared
drwxr-xr-x 11 nobody nogroup 4096 Dec 31  1969 board
-rw-rw-rw-  1 root   root      13 Jun  8 08:05 timesave_file
drwxr-xr-x  2 nobody nogroup 4096 Jun  5 06:34 tmp
[root@alarmpi ~]#

ls -l /opt/piratebox/www

[root@alarmpi ~]# ls -l /opt/piratebox/www
total 168
lrwxrwxrwx 1 nobody nogroup    27 Jun  5 06:34 Shared -> /opt/piratebox/share/Shared
lrwxrwxrwx 1 nobody nogroup    26 Jun  5 06:34 board -> /opt/piratebox/share/board
drwxr-xr-x 2 nobody nogroup  4096 Jun  5 06:31 cgi-bin
-rw-r--r-- 1 nobody nogroup   289 Dec 31  1969 chat_content.html
-rwxr-xr-x 1 nobody nogroup  1406 Jun  5 06:31 favicon.ico
-rw-r--r-- 1 nobody nogroup     0 Jun  8 05:12 forban_link.html
-rwxr-xr-x 1 nobody nogroup   254 Jun  5 06:34 forum.html
-rw-r--r-- 1 nobody nogroup  3773 Jun  5 06:31 index.html
-rwxr-xr-x 1 nobody nogroup 94840 Jun  5 06:31 jquery.min.js
drwxr-xr-x 3 nobody nogroup  4096 Jun  5 06:31 library
-rw-r--r-- 1 nobody nogroup  2992 Jun  5 06:31 menu.png
-rw-r--r-- 1 nobody nogroup    15 Jun  5 06:31 ncsi.txt
-rw-r--r-- 1 nobody nogroup  6607 Jun  5 06:31 piratebox-logo-horizontal-white.png
-rwxr-xr-x 1 nobody nogroup 12637 Jun  5 06:31 piratebox-logo-small.png
-rwxr-xr-x 1 nobody nogroup   201 Jun  5 06:31 redirect.html
-rwxr-xr-x 1 nobody nogroup  3715 Jun  5 06:31 scripts.js
-rw-r--r-- 1 nobody nogroup     0 Jun  5 06:31 station_cnt.txt
-rw-r--r-- 1 nobody nogroup  5056 Jun  5 06:31 style.css
[root@alarmpi ~]#

Also for luck here's my lsusb output:

[root@alarmpi ~]# lsusb
Bus 001 Device 005: ID 148f:3070 Ralink Technology, Corp. RT2870/RT3070 Wireless Adapter
Bus 001 Device 004: ID 0781:5571 SanDisk Corp. Cruzer Fit
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. SMC9512/9514 USB Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[root@alarmpi ~]#

The only connected devices are my Tenda W311U+ (which works OOTB but is painfully slow, 818mb in an hour) and the Sandisk Cruzier Fit, which I want to use for the storage.

Thanks in advance.
Re: USB storage, How on current image (8/6/14)
June 09, 2014 07:04PM
Hi,
I will report back to your soon.... please be a bit patient.

According to my idea, you need to add an entry in /etc/fstab
and move the folder /opt/piratebox/share
and then link /opt/piratebox/share --> new location.

In my opinion, it should work on the same way like on Raspian. maybe you can post the tutorial you found.

Matthias
Re: USB storage, How on current image (8/6/14)
June 17, 2014 08:40AM
Hi ,
I spent the last few hours trying to use a FAT32 formatted USB Drive to store the shared files. Although I can successfully mount the drive with something like the following in /etc/fstab

UUID=XXXX-XXXX /mnt/usbdrive vfat user,rw, exec,uid=0,gid=0,umask=000 0 0

When I go and try and create a symbolic link I get an 'operation not permitted' error. I can create folders etc on the mounted drive but not a symbolic link. I am no linux guru but I suspect its to do with the fact that its FAT32 formatted. When I get a chance I am going to try it with an ext2/3 formatted drive and I'll report back.

Cheers,
John
Re: USB storage, How on current image (8/6/14)
June 19, 2014 12:19AM
Hi ,
Got it working. I was using the ln -s command wrong (as I said I am no linux guru). Here is my setup - note I only store files the user uploads to piratebox on the usb stick (not forum and chat data):

The /etc/fstab file has an entry like:

UUID=xxxx-xxxx /mnt/usbdrive vfat user,exec,uid=0,gid=0,rw,umask=000 0 0

Then in /opt/piratebox/share I linked Shared to /mnt/usbdrive with the command

ln -s /opt/piratebox/share/Shared /mnt/usbdrive

I moved the original Shared folder first so as to have a backup and then I copied all the .txt files into my new Shared folder (i.e. my usb drive)/

Hope this helps someone,
john
JJBean
Re: USB storage, How on current image (8/6/14)
July 11, 2014 08:49PM
Having a hard time with this still. Just wondering if you did anything else after mounting the /mnt/usbdrive. Once I add the symlink "ln -s /opt/piratebox/share/Shared /mnt/usbdrive " . My piratebox service doesnt start up. All the text files are in place, i'm guessing it's something to do with the atheros usb wireless.
Re: USB storage, How on current image (8/6/14)
July 30, 2014 12:53AM
How did you create the symbolic link? If I use "ln -s /opt/piratebox/share/Shared /mnt/usbdrive" I only get "operation not permitted"

EDIT:
Instead of creating a symbolic link I changed the variable UPLOADFOLDER in the piratebox.conf file to UPLOADFOLDER="mnt/usbdrive/Shared".

EDIT 2:
Ok, that also doesn't work, it still uses the /opt/piratebox/share/Shared folder.



Edited 3 time(s). Last edit at 07/30/2014 02:29AM by Tobias.
Re: USB storage, How on current image (8/6/14)
July 30, 2014 07:02PM
Hi Tobias,
the command should be with switched arguments:

mv  /opt/piratebox/share/Shared   /opt/piratebox/share/Shared_old
ln -s /mnt/usbdrive /opt/piratebox/share/Shared

Matthias


This is only my signature.
Re: USB storage, How on current image (8/6/14)
July 31, 2014 07:21AM
i got a bit lost in between
can u pl. post a step by step method of enabling usb storage?
thnx
So, as soon as I add a new entry to /etc/fstab and reboot, the piratebox service fails to start, and my wifi adapter goes dark.

I assume that I am pasting in

"UUID=xxxx-xxxx /mnt/usbdrive vfat user,exec,uid=0,gid=0,rw,umask=000 0 0"

and then replacing xxxx-xxxx with the value I get for my USB flash drive when I run "lsusb"? What I'm seeing there is "0781:5571"

Forgive me if I'm missing something obvious, still very much a linux novice. I appreciate all the contributions on here so far!
I got it working!

See full process below:

[root@alarmpi ~]# lsblk -p
NAME             MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
/dev/sda           8:0    1 14.9G  0 disk 
`-/dev/sda1        8:1    1 14.9G  0 part 
/dev/mmcblk0     179:0    0 14.9G  0 disk 
|-/dev/mmcblk0p1 179:1    0   90M  0 part /boot
|-/dev/mmcblk0p2 179:2    0    1K  0 part 
`-/dev/mmcblk0p5 179:5    0  1.7G  0 part /
[root@alarmpi ~]# mkdir /mnt/usbdrive
[root@alarmpi ~]# mount /dev/sda1 /mnt/usbdrive
[root@alarmpi ~]# ln -s /mnt/usbdrive /opt/piratebox/share/Shared

Did not require a reboot to take effect. Not sure if I'll need to repeat this process each time I start up; I'm sure that, if so, there's a way to automate it.
Re: USB storage, How on current image (8/6/14)
August 01, 2014 07:15PM
You wont have to do the linking each time, however you need to mount the device at startup.
To achieve that, add an entry in the
/etc/fstab

Good Luck! ;-)
Yep!

Added the line

/dev/sda1 /mnt/usbdrive vfat user 0 0

to /etc/fstab; pi starts up fine, and storage is automatically mounted.

Thanks!
Hi! How do you add that line to the /etc/fstab? I can not seem to access it.

Thanks.
Re: USB storage, How on current image (8/6/14)
September 27, 2014 06:29PM
Hi,
use "vi" or you can add it like this

echo "/dev/sda1 /mnt/usbdrive vfat user 0 0" >> /etc/fstab
Make sure that you have two > !

Matthias


This is only my signature.