czar666
Posts: 2
Joined: Mon May 30, 2016 12:00 pm

Mounted folder changes name after reboot

Mon May 30, 2016 6:14 pm

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.

Code: Select all

/dev/sda1

Code: Select all

pi@raspberrypi:/dev $ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       6.0G  3.6G  2.2G  62% /
devtmpfs        214M     0  214M   0% /dev
tmpfs           218M     0  218M   0% /dev/shm
tmpfs           218M  9.8M  208M   5% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           218M     0  218M   0% /sys/fs/cgroup
/dev/mmcblk0p6   63M   20M   44M  32% /boot
tmpfs            44M     0   44M   0% /run/user/1000
/dev/mmcblk0p5   30M  444K   28M   2% /media/pi/SETTINGS
/dev/sda1        15G  294M   14G   3% /media/pi/USB
tmpfs            44M     0   44M   0% /run/user/1002
pi@raspberrypi:/dev $
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?

Code: Select all

Disk /dev/sda: 14.9 GiB, 15996026880 bytes, 31242240 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot Start      End  Sectors  Size Id Type
/dev/sda1        2048 31242239 31240192 14.9G 83 Linux

Code: Select all

pi@raspberrypi:/dev $ cat /etc/fstab
proc            /proc           proc    defaults          0       0
/dev/mmcblk0p6  /boot           vfat    defaults          0       2
/dev/mmcblk0p7  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
pi@raspberrypi:/dev $

epoch1970
Posts: 5132
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Mounted folder changes name after reboot

Tue May 31, 2016 8:49 am

Perhaps you want to try this: viewtopic.php?f=28&t=149193
That would be an indirect remedy to the issue you have, which is related (how exactly I'm not sure) to udev which listens to the system, identifies devices and brings them to "userland".

In this case, udev and possibly the GUI environment see there is a drive available and kindly mount it to /media.
I suspect that if you specify a mount in /etc/fstab, they will give up and the system will mount your drive where you want it.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

MikeDK
Posts: 86
Joined: Thu Mar 19, 2015 12:01 pm

Re: Mounted folder changes name after reboot

Tue May 31, 2016 8:59 am

Another alternative would be to use autofs daemon.

I am using that for USB and samba mounts for a long time now and am very happy with it ;)

With autofs you can also define mount points using UUID, and there is one big benefit: the drives will not always be mounted ... they get mounted as soon as someone wants to access them, and will be unmounted after some amount of time automatically.


But regardless of if you want to use fstab or autofs, you can get the UUID of your usb partition with the command "blkid" (must be run with root privileges)


regards,
MikeDK

epoch1970
Posts: 5132
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Mounted folder changes name after reboot

Tue May 31, 2016 9:15 am

I'd consider autofs an "advanced" topic. I believe a static mount in fstab will suffice. The true culprit is udev and friends anyway.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

czar666
Posts: 2
Joined: Mon May 30, 2016 12:00 pm

Re: Mounted folder changes name after reboot

Tue May 31, 2016 3:07 pm

Thank you very much MikeDK and Epoch1970 for your replies.
I am reading this for the moment: https://www.linux.com/news/udev-introdu ... nux-system
Has some valuable info for me. Half way the page I lost my way though :lol:
I'll start with fstab because it has to stay quite easy for me. But I'll look into autofs as well Mike. Even if I don't use it, I can still learn something about it. And thanks for the blkid command. One less to search for.

epoch1970
Posts: 5132
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Mounted folder changes name after reboot

Tue May 31, 2016 10:37 pm

When I fall in a udev trap, I go back to an old favorite: http://www.reactivated.net/writing_udev_rules.html
Definitely modern, this guy demonstrates some serious mojo with udev lanching systemd units. I hope I'll never have to refer to this one: http://blog.fraggod.net/2015/01/12/star ... -udev.html
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

Return to “Troubleshooting”