0

I am facing some issues concerning the mounting process of usb drives. What i want to have in the end is, that i am connecting the usb drive to the pi and pressing a button to start a procedure to copy a folder from the pi to the usb drive. So with the button being pressed i mount the usb drive, then copy the register and umount it afterwards. The thing i would like to achieve is to be able to use any usb drive and not just a specific one. To be precise: i am looking for a command like

mount /dev/sd* /mnt

so the pi will just mount anything it finds and not just the sda1 as it is doing with the code i am running right now. Below you'll find my code:

sudo mount /dev/sda1 /mnt
sudo cp -r /home/pi/... /mnt
sudo umount /mnt

Thank you for your help!

  • What you have already should work if you are only mounting one drive at a time. – John Hawthorne Apr 18 '18 at 15:15
  • with one drive it does work perfectly. but another one doesnt work at all. with df -h i found out, that the second one was called sdb. thats why i was looking for sd*. or am i wrong? – lux Apr 18 '18 at 15:22
  • Are you getting any particular error? – Mohammad Ali Apr 18 '18 at 15:24
  • okay, i double checked it again. you were right it was obviously just because i had two of them connected at the same time – lux Apr 18 '18 at 15:24
  • I learned something here... Is there any way I could permanently mount one? Like, wire it to the USB internally? Without ugly soldering? – FreezePhoenix Apr 18 '18 at 17:46

Your Answer

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

Browse other questions tagged or ask your own question.