1

I have Raspbian OS installed. My Raspberry Pi is used to save my ipcam snapshots. They are sent through ftp (proftpd) to a usb stick attached on my Rpi.

Mount point = /dev/sda1

df -h
enter image description here

Everything works fine until I reboot the device. Then the folder where /dev/sda1 is mounted on changes in /media/pi/USB1 with the result that my snapshots aren't saved anymore and I just get an empty folder.

I then have to unmount \dev\sda1, remove the automatically created folder 'USB1' folder and create a 'USB' folder again to see my files again. I also lose all the permissions I've set on folders and files previously in /media/pi/USB.

I thought I had to unmount the usb first /dev/sda1 before sending the reboot command. But that didn't resolved the problem. Again my path changed to /media/pi/USB1.

I'm novice to Linux. So every information is welcome. Should I for example read the fstab man pages? Is it there that I have to change settings?

sudo fdisk -l
enter image description here

2
  • If the filesystem on your USB stick is ext2/3/4, you can use something like sudo e2label /dev/sda1 USBSTICK and then add a line in your /etc/fstab that starts with LABEL=USBSTICK /where/you/want/it/mounted .... See here... cyberciti.biz/faq/… Commented May 31, 2016 at 12:41
  • 1
    Thank you Mark. I learned about fstab and this works like a charm.
    – maxim
    Commented May 31, 2016 at 18:45

1 Answer 1

1

Credits to Mark, and here is how I did it, this is my /etc/fstab:

proc            /proc           proc    defaults          0       0
/dev/mmcblk0p6  /boot           vfat    defaults          0       2
/dev/mmcblk0p7  /               ext4    defaults,noatime  0       1
/dev/sda1       /media/pi/USB   ext4    defaults,rw       0       3
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that

I've just added the line that starts with /dev/sda1. What I've read on forums is that it is important to keep in mind that you can apply the trick above only when you are using 1 USB storage device. When you have multiple, you have to work with UUID's. It's well explained here.

Oh and for an explanation of the different columns you see in my code you can check here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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