1

I've got USB drive (SD-card reader to be exact) connected to the RPi. What I want is to access it's files while in console mode/CLI.

The problem is that RPi doesn't see files stored on SD card - not until I run GUI by startx command.

  • When I go to /media/my-usb in CLI and hit ls command it doesn't list any files.
  • When in run file manager in graphic interface mode, the files are listed as they should.

The funny thing is that the files are also visible from console launched in graphic interface mode. But as soon as I log off to console mode, they become unreachable again.

my-usb folder has 777 permissions

What do I need to do so the files stored on USB would be accessible in CLI?

EDIT:

  • lsusb command is listing my device
  • /my-usb folder is visible by ls command under /media
  • I can also do cd /media/my-usb and it enters the folder, but it doesn't see any files inside.
  • 1
    the drive might not be mounting to /media/my-usb Do you see it when you use lsusb? – wahoozie Apr 21 '15 at 18:14
  • Yes, it's listed when I use lsusb. It's also listed when I use ls while in /media folder. It just doesn't see it's contents. – zorza Apr 21 '15 at 18:17
  • I'm guessing it's the file browser or DE that automounts this. Have a look at mount | grep media before and after you start the GUI. – goldilocks Apr 21 '15 at 19:06
  • @goldilocks - You were right. There was an issue with mounting the device. As it turns out GUI seems to have much better way of auto-mounting USB -it works automatically anytime I plug something in, not only if it's plugged in on booting. I think may have to stick with GUI. – zorza Apr 23 '15 at 17:10
2

Try using usbmount. It's a very good solution, and you can configure it very easily.

sudo apt-get install usbmount

Now put in your USB device and you should see it in /media/usb.

If not open the usbmount config file: /etc/usbmount/usbmount.conf

0

If you want to arrange automounting outside of the GUI, try creating a file /etc/udev/rules.d/my.rules with a line like this:

ACTION=="add", KERNEL=="sda1", RUN+="mount /dev/sda1 /media/my-usb"

This presumes the SD card device appears as /dev/sda, which it most likely will if there's no other drives attached. I believe you'll have to reboot to make this work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.