OSMC USB Auto Mount Info

Hello,

I’d like to find out more about OSMC usb automount and in particular where the mounted forder full of numbers come from when a partition (with NO Label) is automounted.

I have installed a disk with three partition with no labels and I got the following automounted folders in the media folder:

osmc@osmc:/media$ ls -al
total 48
drwxr-xr-x  7 root root  4096 Jul  2 22:05 .
drwxr-xr-x 23 root root  4096 Jun  5 23:20 ..
drwxr-xr-x  5 root root  4096 Feb  8  2014 0601e724-5304-466c-ae06-323440859ba4
drwxr-xr-x  4 root root  4096 Mar  2  2011 28382420-3568-46d9-b8d1-f7f6add3d405
drwxrwxrwx 24 1001 1001  4096 Jun 17 23:58 932b1fa5-351b-4111-bbf6-eaca4beae765

How is that folder name generated? Is it the partition size and characteristics to influence the name perhaps? (probably)
Most importantly will the autogenerated name change if the partition table is changed, or partitions resized or moved?

What is the easiest way to manually label a partition directly from OSMC so it won’t change if the partitions do change? Should I use parted?

I’m asking all this questions cause I’d like to avoid changing all the config settings in many different places in Kodi and custom scripts when the mount folder name changes if it ever does. (I know I should have labelled the partition if they are part of a permanent disk, but I haven’t :frowning: )

Thanks for clarifying the above and any explanation given.

If you use the drive regularly, mount it via /etc/fstab, outside of /media (I recommend /mnt), and then use the UUID.

Sam

A UUID won’t change unless the drive is repartitioned or formatted so you can rely on that not changing. If you prefer a friendly name for the drive you need to create a volume label for the partitions - if they are ext4 partitions you can use the e2label command to do so.

Unfotunately my setup includes /media/ in the mysql db network path as well as lots of other configuration files so I’m in a bit of a difficult situation where I’d like to make the current path static, including if I repartition the drive, as I’d like to remove 3 useless partitions that I carry over from when the hard drive used to be in my old popcorn hour.

I could just label the ext3 partition in question but labels can only be 16 characters if I’m not wrong, and the uid is 36 characters, so e2label won’t do the job either if I want to keep the uid as a label.

I have 3 OSMC with this path in config files all over the place and changing it all would just be a nightmare :frowning:

I wated to use /etc/fstab to mount partitions manually but for some reason I didn’t do it, and now that I have everything setup as I wanted, with lots of references to the /media/uui path, I ask myself the question of what I would do if I copy the hard disk or repartition it.

Basically I think there is no way out of this one and I might need to change all the references which I’m sure I’m going to miss stuff cause there are too many (a grep shows)

You’re just going to have to rescan those library sources if you need to repartition the drive - no way around it because as you say a label can only be 16 characters so you can’t duplicate the UUID with a partition label.

Next time give the partitions meaningful but unique labels and you won’t have the problem again in future.

that’s what I thought, thanks for confirming it.

I’ll grep and sed all config file references for config files (tvheadend and the rest) from /

and I’ll dump the database and find and replace all the reference, then delete and import the database in mysql.

I should be able to change every reference on any config file on the whole system
from
/media/932b1fa5-351b-4111-bbf6-eaca4beae765/
to
/mnt/usb_disk_1/

using

sudo grep -rl /media/932b1fa5-351b-4111-bbf6-eaca4beae765 / | xargs sudo sed -i 's/\/media\/932b1fa5-351b-4111-bbf6-eaca4beae765/\/mnt\/usb_disk_1/g'
sed -i 's/\/media\/932b1fa5-351b-4111-bbf6-eaca4beae765/\/mnt\/usb_disk_1/g' /path/file

works but there is something wrong with the grep and xargs bit.

sudo grep -rl '/media/932b1fa5-351b-4111-bbf6-eaca4beae765' /

shows all the correct matches though :worried:

There is nothing wrong with the command, but you might want to consider using a specific path other then / as otherwise it will take ages before any replacement takes place as the grep will simply run for a very long time and until it completes it won’t start replacing the list of files matched.

something like this will be much quicker:

sudo grep -rl /media/932b1fa5-351b-4111-bbf6-eaca4beae765 /home/osmc/ | xargs sudo sed -i 's/\/media\/932b1fa5-351b-4111-bbf6-eaca4beae765/\/mnt\/usb_disk_1/g'