[Solved] Use two USB sticks at same time?

Hi,

Raspyfi handled multiple USB sticks well, assigning them to ‘usb1’, ‘usb2’ etc. Volumio doesn’t seem to do that. From what I can make out (having experimented a bit), if you put a second USB stick in the second USB port (of the Raspberry Pi B), it overwrites the mounting of the USB stick in the first USB port. Typing ‘mount’ shows both sticks assigned to ‘USB’, but the music from only one shows up in the ‘Browse’ window. I’ve swopped the sticks around to check whether there was a problem with one stick, but the same thing seems to happen. Having two USB sticks in seems to get Volumio confused.

For the time being I’ve copied the music from one stick to my SD card (which is big enough), and assigned that to ‘LOCAL’ in the /var/lib/mpd/music’ folder. However I have had the SD card corrupt on me recently, so I’d prefer not to put my music on there. It’s simpler just to reflash with Volumio only.

I was just wondering if this behaviour in Volumio is by design, and is there a way to get it to handle two USB stcks? Note these are USB sticks, not USB hard-drives.

I searched the forums for an answer. There was one guy asking a similar question, but he didn’t get an answer.

Colin

Yes, Volumio mounts all USB sticks to USB. So, when you plug the second USB stick, just update DB and you should see all your files…

That’s what I’d like to see happen, but it doesn’t. Only one USB stick is apparently indexed by MPD. Mostly I’ve been booting with both sticks in to start with, but I tried your suggestion of plugging in the second USB stick when Volumio was running, but it made no difference.

Colin

The same thing is happening to me. I have connected 2 USB storage devices to both USB ports of the Raspberry and once I update the database only the content of the device plugged to the lower port is shown. I have tried all the possible combinations, but I’ve got the same result every time. Any suggestion?

I got this working.

Volumio uses usbmount to mount USB drives. usbmount will mount the first USB drive it sees to the path setup in its conf file and ignore others. To mount more than one, you have to have additional mountpoints set up in the conf file.

So, I created a USB2 directory under /mnt. Now there is a USB and a USB2 directory there.

In /etc/usbmount/usbmount.conf, I changed the MOUNTPOINTS line to this:

MOUNTPOINTS="/mnt/USB /mnt/USB2"

I then created a symbolic link from my new USB2 directory to the mpd music directory.

[code]su pi

ln -s /mnt/USB2 /var/lib/mpd/music/[/code]

After that, I did a ls -l /var/lib/mpd/music/ to make sure the links to USB and USB2 were there.

I rebooted and both USB drives mounted and mpd saw them both.

Hope this helps.

Hello!

I did exactly as descriped, but it does not work.

The symbolic links are there:

lrwxrwxrwx 1 pi pi 8 Jul 30 2013 USB -> /mnt/USB
lrwxrwxrwx 1 pi pi 9 Apr 29 19:34 USB2 -> /mnt/USB2

And there is some Content in it:

ls -l /mnt/USB
total 4
drwxrwxr-x 3 root root 4096 Apr 26 16:45 Paolo Conte

ls -l /mnt/USB2
total 32
drwxrwxr-x 3 root root 32768 Apr 26 17:56 Dolly Parton

But in Volumio, I see only the Files in /mnt/USB

Tried to reboot, rebuild the DB… nothing.

If I only plug in only ONE USB-Stick, I see the content of this one. With both USB-Sticks…

Can anyone help me?

Not solved - for me anyway.
Can’t find any solutions through searching.
I have exactly the same result as Pesche above.
So pleased with volumio otherwise but it is a shame I am unable to further expand my storage by adding another USB stick.
Any suggestions please?
Thank you.
resusdoc
:question:

Im having similar problems, Volumio 1.55 doesnt discover my usb thumb drive, i also have a wifi dongle plugged in. I have unplugged the dongle but it still,doesnt discover the usb stick!

Hi,

Not sure if this is the case but when I corrected ownership of the folders and symbolic links things started working. The newly created USB2, USB3, … folders in /mnt should be owned by user root and the symlinks in /var/lib/mpd/music should be owned by user pi.

This makes all USB drives visible by my mpd client MPdroid run on my phone but in the volumio web interface only the drive mounted to /mnt/USB is visible. Does anybody know what I can do to make all drives visible in the web interface?

After poking around with this issues appear to be three fold:
One us that the USB folder from the perspective of the UI is hard coded.
Two is that they have two systems (udev and usbmount) mounting usb sticks.
Three is that I think the developers are under the impression that you can mount multiple file systems onto one mount point without clobbering the existing directory structure mounted or otherwise.
I haven’t had the time to figure out an elegant solution yet though. I simply created /mnt/USB/USB1, /mnt/USB/USB2 etc., made soft links to /car/lib/mpd/music/USB/USB1 etc and manually umounted /mnt/USB until the directory isn’t mounted upon.

I could be wrong in my understanding but I hope that helps someone anyway.

I was playing with this too, this is what I found out, while trying to get it to work.

As described by the others I made USB2 entries as follows:

$ ls -lah /mnt total 52K drwxrwxrwx 6 root root 4.0K Nov 15 18:19 . drwxr-xr-x 22 116 120 4.0K Apr 20 2015 .. drwxrwxrwx 2 pi pi 4.0K Nov 9 20:32 NAS drwxrwxrwx 2 root root 4.0K Apr 22 2014 UPNP drwxrwxr-x 7 root root 4.0K Jan 1 1970 USB drwxrwxr-x 63 root root 32K Jan 1 1970 USB2

and

$ ls -lah /var/lib/mpd/music/ total 12K drwxrwxrwx 3 root root 4.0K Nov 15 18:20 . drwxr-xr-x 5 mpd audio 4.0K Apr 21 2014 .. lrwxrwxrwx 1 root root 9 Jul 13 2013 NAS -> /mnt/NAS/ lrwxrwxrwx 1 root root 8 Apr 8 2014 RAMPLAY -> /run/shm lrwxrwxrwx 1 root root 9 Apr 22 2014 UPNP -> /mnt/UPNP lrwxrwxrwx 1 pi pi 8 Jul 30 2013 USB -> /mnt/USB lrwxrwxrwx 1 pi pi 9 Nov 15 18:20 USB2 -> /mnt/USB2 drwxrwxrwx 2 pi pi 4.0K Oct 28 21:37 WEBRADIO

And I changed /etc/usbmount/usbmount.conf listing the second USB2 directory,

[code]$ head -n 12 /etc/usbmount/usbmount.conf

Configuration file for the usbmount package, which mounts removable

storage devices when they are plugged in and unmounts them when they

are removed.

Change to zero to disable usbmount

ENABLED=1

Mountpoints: These directories are eligible as mointpoints for

removable storage devices. A newly plugged in device is mounted on

the first directory in this list that exists and on which nothing is

mounted yet.

MOUNTPOINTS="/mnt/USB/ /mnt/USB2/"[/code]

Problem remains that after rebooting, both USB sticks (/dev/sda1 and /dev/sdb1) are mounted on the same directory /mnt/USB !

You can unmount/remount one of them,

sudo umount /dev/sda1 sudo mount -o "rw,nodev,noexec,noatime,nodiratime,sync,fmask=0002,dmask=0002,allow_utime=0020,codepage=437,iocharset=utf8,shortname=mixed,errors=remount-ro" -t vfat /dev/sda1 /mnt/USB2

Rebuilding the library shows both directories only when connected directly to mpd, but not in the UI.

$ mpc ls USB USB2 WEBRADIO UPNP RAMPLAY NAS

I found where I could hack this in,

sudo vi /var/www/js/volumio.api.js

and search for USB, duplicate the if clause

} else if (inputArr[i].directory == 'USB') {

for USB2 and after some reloading you will see it in the browse library tab.

If only the correct mounting could be done automatically :wink:

Sven

I have a workaround with only one awkward detail.

The above solution of creating /mnt/USB2 did not work for me but some late-night tinkering gave me an idea - symlink the two USB drives to a folder and then have the symlink in /var/lib/mpd/music/ point to that folder.
It works well! the only problem is that I have to mount the second USB drive manually over SSH.

First I look at the dmesg output to determine what designation (sd[a-z][0-9]) the second USB drive has been given.

Then the following commands, using /dev/sdc1 in THIS particular instance:

root@volumio:/var/lib/mpd/music# mount -t vfat -o uid=root,gid=users /dev/sdc1 /mnt/USB2

root@volumio:/var/lib/mpd/music# rm USB
root@volumio:/var/lib/mpd/music# su pi
pi@volumio:/var/lib/mpd/music$ mkdir /home/pi/USB

pi@volumio:/var/lib/mpd/music$ ln -s /mnt/USB /home/pi/USB
pi@volumio:/var/lib/mpd/music$ ln -s /mnt/USB2 /home/pi/USB

pi@volumio:/var/lib/mpd/music$ ln -s /home/pi/USB /var/lib/mpd/music/

The resulting file lists are then:

volumio@volumio:~$ ls -l /mnt
total 44
drwxrwxrwx 2 pi   pi     4096 Aug  5  2014 NAS
drwxrwxrwx 2 root root   4096 Apr 22  2014 UPNP
drwxrwxr-x 3 root users 32768 Jan  1  1970 USB
drwxr-xr-x 9 root users  4096 Jan  1  1970 USB2

volumio@volumio:~$ ls -l /home/pi/USB
total 0
lrwxrwxrwx 1 pi pi 8 Apr  2 09:05 USB -> /mnt/USB
lrwxrwxrwx 1 pi pi 9 Apr  2 09:14 USB2 -> /mnt/USB2

volumio@volumio:~$ ls -l /var/lib/mpd/music/
total 4
lrwxrwxrwx 1 root root    9 Jul 13  2013 NAS -> /mnt/NAS/
lrwxrwxrwx 1 root root    8 Apr  8  2014 RAMPLAY -> /run/shm
lrwxrwxrwx 1 root root    9 Apr 22  2014 UPNP -> /mnt/UPNP
lrwxrwxrwx 1 pi   pi     12 Apr  2 09:16 USB -> /home/pi/USB
drwxrwxrwx 2 pi   pi   4096 Sep  7  2013 WEBRADIO

Then in the Volumio browser page goto Library -> Update Library.

Voila - both USB drives are listed under USB in the browse page!

NOTE: When I created /mnt/USB2 I used chgrp to make it ‘users’ like /mnt/USB was. Don’t know if that matters.

I put the commands described in my previous post (above) into a bash script and then added a line in crontab to run the script at boot.
It works great.

USB Remounting Script - /home/pi/rmntUSB.sh

#!/bin/sh

# /home/pi/rmntUSB.sh
#
# Remount usb drives on volumio after boot
# because sdb gets mounted over sda on /mnt/USB
 
umount /dev/sdb1
umount /dev/sda1
mount -t vfat -o uid=root,gid=users /dev/sda1 /mnt/USB
mount -t vfat -o uid=root,gid=users /dev/sdb1 /mnt/USB2
ls -l /mnt/USB
ls -l /mnt/USB2

#update mpd database
mpc udpate

As root crontab -e and enter at the end of the file: @reboot /home/pi/rmntUSB.sh

The folder listing commands aren’t necessary but they are nice for confirmation if I run the script manually.

One could of course extend the changes described in my first post and the script here to deal with using more USB drives.

excellent thread!

The solution outlined above does not completely work for me because I use MPDroids file listing and not those based on tags. This means that I need to know which mount the files I’m interested in resides. I have made an addition to the script to map multiple directories into a single one (only symlinks).

I have created a new directory in /home/pi/USB so it now looks like this:

volumio@volumio:/home/pi$ ls -l /home/pi/USB total 4 drwxr-xr-x 10 pi pi 4096 Sep 23 23:16 USB lrwxrwxrwx 1 root root 8 Sep 23 23:12 USB1 -> /mnt/USB lrwxrwxrwx 1 pi pi 9 Sep 23 21:21 USB2 -> /mnt/USB2

I point mpd to this folder instead of the above USB folder:

[code]volumio@volumio:/home/pi$ ls -l /var/lib/mpd/music/
total 4
lrwxrwxrwx 1 root root 8 Apr 8 2014 RAMPLAY -> /run/shm
lrwxrwxrwx 1 root root 9 Apr 22 2014 UPNP -> /mnt/UPNP
lrwxrwxrwx 1 volumio volumio 16 Sep 23 23:14 USB -> /home/pi/USB/USB
drwxrwxrwx 2 pi pi 4096 Sep 7 2013 WEBRADIO

[/code]

In the script I added the symlink copying from the 2 mounts to the new folder:

#!/bin/sh

# /home/pi/rmntUSB.sh
#
# Remount usb drives on volumio after boot
# because sdb gets mounted over sda on /mnt/USB
 
umount /dev/sdb1
umount /dev/sda1
mount -t vfat -o uid=root,gid=users /dev/sda1 /mnt/USB
mount -t vfat -o uid=root,gid=users /dev/sdb1 /mnt/USB2
ls -l /mnt/USB
ls -l /mnt/USB2

# mirror content of usb drives into a virtual folder
rm -r /home/pi/USB/USB/*
cp -ansv /home/pi/USB/USB1/* /home/pi/USB/USB/
cp -ansv /home/pi/USB/USB2/* /home/pi/USB/USB/
chown -R pi:pi /home/pi/USB/USB
ls /home/pi/USB/USB/

#update mpd database
mpc update

I just made this and have only tested it with small amounts of data. It seems to do the trick now the two folders appear as a single folder in Volumio and MPDroid.

edit: I modified the solution above to rename my new folder USB instead of another name I chose. The symlink /var/lib/mpd/music/USB has to be called USB or the Volumio interface will not show it.

br,
Jannik

I assume this refers to Volumio1 right?

Under credits I see release version 1.55. It sounds like I need to update myself on the development of Volumio?

br,
Jannik

Wait a few days before updating, trust me :wink:

I’m looking forward to see what’s new. I’m guessing it has better USB handling :slight_smile:

In the mean time I can report for people seeing something useful in the solution I submitted that it is fast enough. The copying takes a second or two in my setup with 5091 files in 621 folders. Total size is ~140 GB but I guess that shouldn’t have a direct influence on performance in this case.

I have today updated my system from 1.55 to latest and it seems that the problem is still there with multiple usb drives not appearing as one drive in the music library?

I do not want to use the Artist or Albums view because it doesn’t list the way I want it. I want to have my usb drives merged so I can view the files in the structure I have organized in the filesystems.

Can Volumio do this or do I need to reinstall the old script I made which does this?

Thank you.

What you ask will never happen, because its not the way I would expect to work. If you have 2 usb drives, they should be seen as two different drives, and not be merged into one…