Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Accessing USB disks through SSH/(S)FTP
#1
Hello,
I wonder whether it is possible to access USB disks (those visible under /media) by means of FTP.
There are plenty of tutorials on how to set up ssh/sftp. Unfortunately these do not take account of MoodeAudio specifities (e.g. re. users, passwords, etc.)
Could anybody here with minimum linux-related knowledge explain what steps should be taken in order to activate such functionalities?
I would find it quite nice to be able to copy files onto the USB disks mounted on MoodeAudio directly from remote locations.
Thanks in advance
Regards
Pierre M.
Reply
#2
By default the hostname is moode.local, the user is pi, the password is moodeaudio.
This should be enough information to use sftp if you have tutorials to read.

From a Mac or Linux terminal

Code:
sftp pi@moode.local

If you've changed you hostname substitute it for "moode" in the above command.
The default password is moodeaudio.

This will open an interactive sftp session so refer to the online tutorials.
However to navigate to your mounted drives

Code:
cd /media

To list use the command ls and use cd to navigate 

To navigate to files on the sd card
Code:
cd /mnt/SDCARD/

If you can navigate you can then use the get and put commands to move files from and to your drive.

However it may be easier to use the samba share and drag and drop?
The moode samba share appears in finder on Mac and I imagine should be easy to find by browsing your network in windows file manager or whatever it's called nowadays.
This allows you to browse all the mounted drives (usb or network) and access the local files on the sd card. You should be able to drag n drop and copy n paste as needed.
Reply
#3
(09-29-2018, 04:41 PM)FizzyTea Wrote: [...]
If you can navigate you can then use the get and put commands to move files from and to your drive.

However it may be easier to use the samba share and drag and drop?
The moode samba share appears in finder on Mac and I imagine should be easy to find by browsing your network in windows file manager or whatever it's called nowadays.
This allows you to browse all the mounted drives (usb or network) and access the local files on the sd card. You should be able to drag n drop and copy n paste as needed.

Dear FizzyTea,

Thank you very much for the guidelines. 

The reason why I  asked this question about the use of sftp is that I have already tried to reach the mounted drives through Samaba and the Windows File Manager as described here https://www.computeraudiophile.com/forum...ent=634528

What I observe with this procedure is that there are frequent error messages (it seems that the network connection gest lost) and that, for unkown reasons, the transfer rate is very low. I have received similar feedback from another user.

Regarding the explanations you gave, yes, indeed, I managed to reach the mounted drive with a tool like Filezilla (using these guidelines here http://filezilla.fr/filezilla-sftp-security/)

Unfortunately, there are issues of file/folder ownership and permissions that I did to manage to solve (I am definitely not confortable with Linux, hence my post on this forum)

Regards

Pierre
Reply
#4
You are accessing moode from a windows machine?

I booted Windows 10 and was quickly able to see the moode samba shares in file explorer by viewing the network section and also by typing \\moode into the address bar. Perhaps you should try troubleshoot that issue?
Reply
#5
Hello,

I have a config based on Rpi3 + Moode Audio on the one hand and a Windows machine on the other. I am currently in the process of copying lots of files onto a USB disk that will be/is connected to the Rpi3. And I would like to find a way for transferring those files where I would not have to constantly unplug the USB disk from the RPi, replug it in the Windows Machine, copy some files, and then unplug it from the Windows machine, re-replug it into the RPi and so forth.

As explained above, I had already noticed this recommendation by Tim Curtis to use the Windows file explorer where SAMBA makes visible the mounting points of storage devices attached to the Rpi. However, for me as well as for some few other users/friends facing the same needs, this method for transferring files is a total nightmare : the transfer begins with a very high transfer rate, then it freezes and finally a pop-up message indicates that there has been a networking error. Sometimes, there are no networking errors, all the files are copied onto the USB disk, but the transfer rate drops to a ridiculous 700 B/s. Hence my post and my question of whether using FTP would not be a better alternative option (rather than SAMBA). 

Since nobody replied to this particular question, I have kept on investigating the use of SAMBA+Windows file explorer and come to conclusions that I would like to share with you.

If you google this problem of low file transfer rate, you will probably quickly come to the conclusion that the problem is not simple and that 3 types of solutions are regularly suggested : (1) include a relevant option in the SAMBA config file (TCP_NODELAY), (2) include a relevant option for better managing network traffic congestion (tcp_congestion_control) and (3) format EXT rather than NTFS.

My config is OK with regards to the first two enhancements. Then, I tried to reformat my USB disk as follows:
1. connect to the RPi through SSH (userid pi and password moodeaudio)
2. sudo fdisk /dev/sda (after checking with sudo fdisk -l)
3. d (for erasing the current partition)
4. n (for creating a new primary partition)
5. defaults values for sectors and partition number
6. 83 (for selecting linux file system)
7. w (for writing all the above to the disk)
8. sudo mkfs.ext4 -b 4096 /dev/sdd1 to format the disk

This solves the problem related to the low transfer rate. I am now able to copy lots of files from the Windows explorer directly to the EXT4-formatted USB disk connected to the RPi (transfer rate of about 16 Mb/s)

However, there remains a problem visible in the graphical interface of Moode Audio. What I observe is that although the newly created disk is properly automounted and appears in under "USB" in the music tab of the moode audio interface, no music files at all appears after launching a rescan or an update.

Did I do something wrong? And, alternatively, why does it seem that moode audio does not recognize/handle EXT4 formatted USB disk?

Than you very much for any help in this respect.

Regards

Pierre
Reply
#6
Hi Pierre,

Probably permissions
https://www.musicpd.org/doc/html/user.ht...leshooting

Look in the MPD log for errors.
cat /var/log/mpd/log

You can try something like below on your ext4 drive.
sudo chmod -R 0755 /media/<usb_disk_name>

You might want to try Fat32 partition format then you will be able to also read it in windows and most likely you won't have to mess with permissions.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#7
Hi Tim,

Thanks for your help.

sudo chmod -R 0755 /media/<usb_disk_name> made it work when using FTP.

However, after some promising preliminary tests, I tried to transfer a batch of about 15 folders each containing the equivalent of a "CD" 24 bits, 96 kbps and in the middle of the transfer, I received an error meesage indicating that the network distant location had reportedly become unavailable.

Observations :
When this kind of messages appears, the RPi suddenly reboots
When it reboots, there is a cycle of several restarts before the RPi gets finally up
When it is up, I see in /media the same USB-disk several times, with underscores appended :

WD-MUSIC
WD-MUSIC_
WD-MUSIC__
WD-MUSIC___
etc.

I see all the files in that label with the largest number of underscores and nothing in the others.

The RPi has become higly unstable and restarts quite frequently.

Do you have any valuable ideas as how to investigate this issue? I am out of my basic knwoledge of linux here...

Thanks

Regards

P.
Reply
#8
Dear all,

I am suspecting a problem with the NIC of the RPi. When I unplug the RJ45 cable, there are no reboots at all.

I will keep you posted.
Reply
#9
(10-10-2018, 08:37 AM)latomus Wrote: Dear all,

I am suspecting a problem with the NIC of the RPi. When I unplug the RJ45 cable, there are no reboots at all.

I will keep you posted.

Dear all,

I have replaced what definitely seemed to be failed hardware. Everything fine since!

Regards
Reply


Forum Jump: