I am running Raspbian Stretch on a Pi 3 B+. One thing I noticed is that I have more /media/user/SETTINGS* than actual partitions. See, I have 3 directories:

$ ls -la
total 17
drwxr-x---+ 5 root root 4096 Mar 14 07:36 .
drwxr-xr-x  3 root root 4096 Mar  8 12:18 ..
drwx------  2 root root 4096 Mar 13 10:06 SETTINGS
drwx------  2 root root 4096 Mar 13 10:50 SETTINGS1
drwxr-xr-x  4 root root 1024 Mar  8 12:10 SETTINGS2

However, only SETTINGS2 has real contents:

/media/pi/SETTINGS2 $ ls -la
total 21
drwxr-xr-x  4 root root  1024 Mar  8 12:10 .
drwxr-x---+ 5 root root  4096 Mar 14 08:59 ..
drwxr-xr-x  4 root root  1024 Dec 31  1969 cache
-rw-r--r--  1 root root   412 Mar  8 12:10 installed_os.json
drwx------  2 root root 12288 Dec 31  1969 lost+found
-rw-r--r--  1 root root    84 Mar  8 12:16 noobs.conf
-rw-r--r--  1 root root   123 Dec 31  1969 wpa_supplicant.conf

The other 2 are empty.

And then, only one partition (as expected):

$ df -h | grep SETTING
/dev/mmcblk0p5   30M  463K   28M   2% /media/pi/SETTINGS2

The /etc/fstab looks like below:

$ 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

BTW 1: I can reboot it now a hundred times, but I am not getting SETTINGS3, SETTINGS4, etc... It just look that for some reason I got those 3 created.

BTW 2: I am not explicitly mounting SETTINGS2 at all. Neither I have setup a script for that or for creating the directory.

So, my questions are:

  1. Is it same to remove the SETTINGS and SETTINGS1? I guess yes.
  2. Why could have this happened? Any possible explanation?
  3. Is there a way to do 1) but then rename SETTINGS2 (the actual being mounted) to SETTINGS? Maybe just rename then update /etc/fstab? In other words...I would just like to get back everything as default...

Thanks in advance,

  • How are you mounting the partition to SETTINGS2? I would guess (without knowing more details) that you have setup some form of script to mount the partition and as part of that script it creates the directory it mounts to but each time you're rebooting or running the script instead of picking up that the folder exists it's just generating a new folder and mounting the partition there. Hence the other folders are empty as they're the leftovers from the other times the script has run????? – rohtua Mar 14 '19 at 12:40
  • Hi @rohtua. I am not explicitly mounting SETTINGS2 at all. Neither I have setup a script for that or for creating the directory. As far as I understand this is automatically done by NOOBS. – Mariano Martinez Peck Mar 14 '19 at 12:44
  • As far as I'm aware on a standard raspian install there is no /media/pi/SETTINGS directory, although I've never used noobs on any of my pi's so I can't say whether it does something differently in setup. If those folders are empty you should be safe to remove them. What exactly is in the settings2 directory? Could you add your fstab file to the question please? Also out of interest what happens when you reboot do you get settings3?? If we can pin down when the new folder is generated it might help work out why. – rohtua Mar 14 '19 at 12:52
  • I just updated it with all the info you asked. I think you haven't seen it because its NOOBS related... – Mariano Martinez Peck Mar 14 '19 at 13:03

I think you've been caught out by the automounter on the Pi.

The automount feature is creating the folders under /media/$(USER)/ based on either the UUID or partition label of the media when you select the partition in the file manager (see /dev/disks/by-uuid/ and /dev/disks/by-label/). These would usually get deleted when you umount the media correctly or perform a shutdown, if you don't then the folders persist and when the same media is inserted again (or different media with an identical label) the automounter adds a digit to the end of the name to ensure a unique folder name for mounting.

So, to recap and answer your specific questions:

  1. As long as the disk is unmounted it should be safe to delete the folders in /media/pi/.
  2. Be sure to safely un-mount your media before removing and/or wait for the shutdown procedure to complete before removing the power from your Pi.
  3. Deleting the all folders should let the system create the "SETTINGS" folder properly the next time. If you want the folder to be called something else other than the media label then just change the media label or look into adding some udev rules.
| improve this answer | |
  • Thanks for the explanation. That did work. I did sudo umount /dev/mmcblk0p5 and rm -rf /home/pi/SETTING* and rebooted. Now I have just SETTINGS. I am still curious on how this happened. Will try ejecting the SD without proper shutdown, or just disconnecting power (without proper shutdown) etc to see if I can reproduce it. Thanks! – Mariano Martinez Peck Mar 14 '19 at 14:21
  • No, there is no way I can reproduce it hhahahaha. No clue how it happened. I tried everything I said above. So I guess that will remain as a mistery ;) – Mariano Martinez Peck Mar 14 '19 at 14:40

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.