0

My usb stick gets an ugly and very long name when automounted in raspbian.

enter image description here

I would like to change 2 things here.

1st I want to get rid of that long name and have something like /media/usb

2nd, I'd like to mount it directly under /media instead of /media/pi/. Why in the first place does it add my username in the path?

I already created a directory /media/usb, then unmounted the usb and mounted it again in my newly created directory. Worked well but as expected, after the first reboot I got stuck again with that long name and the username in the path.

I read about making changes into fstab. But it seems that fstab is not used for the automount of my usb:

enter image description here

I also played a while with fdisk and parted. I formated the disk in ext4. But I can't find the way to easily change that automount folder in something more user friendly and keep it permanent.

enter image description here

About this picture above. I really formatted the stick in ext4, but I still see FAT32 under "Type". Don't know why.

I also get this when using fdisk:

enter image description here

I'll keep searching for some answers but if someone has some advice in the meantime. That would be great. Thank you.

1 Answer 1

1

First of all, if you don't want the UUID to be used for naming the mountpoint, set a filesystem label. For ext4, use e2label to do that: http://man7.org/linux/man-pages/man8/e2label.8.html

For example, e2label /dev/sda1 GOAWAYIHATEYOULONGUUID

You should probably see that SETTINGS is the filesystem label of mmcblk0p5 with lsblk -f.

For the second issue, I assume the mounting is done by udisks2.

The pi of /media/pi probably comes from your current user name. You should be able to use a udev rule to change this behaviour:

https://wiki.archlinux.org/index.php/udisks#Mount_to_.2Fmedia_.28udisks2.29

The reason that it's /media/$USER instead of /run/media/$USER in your case is probably because the udisks2 on the distro you are using is configured with --enable-fhs-media when being built:

https://cgit.freedesktop.org/udisks/tree/configure.ac

For the first "weird" output of fdisk, you need to know that partition type is not the same thing as filesystem type. Partition type is merely an indicator in the partition table while filesystem type (which is told by mount/findmnt/lsblk -f...) tells what exactly filesystem is created on the partition.

Truth is partition type seldom matters in Linux (at least not as important as in Windows). In any case, if you want to change it to an appropriate one, you can use t in fdisk to change the Id of sda1 from c to 83 (i.e. Type: Linux filesystem): https://en.wikipedia.org/wiki/Partition_type

You can use p to check the change is made correctly and w to write the change to the drive and exit fdisk (or q to exit fdisk without writing any change to the drive in case you feel like you made a mistake and don't know how to revert).

As for the second "weird" output, you do not run fdisk on a partition (e.g. sda1, mmcblk0p1) but a drive (e.g. sda, mmcblk0), because fdisk is an utility deals with partition table of a drive but not filesystem on a partition.

2
  • :-o Thank you very much Tom for all the info and your time. I tried your first solution (e2label) and that worked very well! I'll try all the other sugestions this weekend.
    – maxim
    Commented Mar 10, 2016 at 13:31
  • Great! [t] in [fdisk] also did the trick. I changed the value to 83. So no more FAT32 but linux in [Type] this time. Even after reboot all remains the same. I also checked the commands mount, findmnt and lsblk -f. Very useful. Thanks. Now remains the udisks2 part. But that seems a bit complicated. I'll check man pages and come back if something is not clear.
    – maxim
    Commented Mar 10, 2016 at 16:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .