In Ubuntu, even if different block devices (e.g. an external hard drive and a flash drive) are represented by the same device file (e.g.
/dev/sdb1) one after another, they are automatically mounted to different mounting points (e.g.
/media/b/myflashdrive). How is that achieved? How does Ubuntu know the "name" of each device and use that "name" to name its mounting point? (
/etc/fstab doesn't cover these plug-in devices.)
How can I simulate that? When manually mounting a block device, I run
sudo mkdir /media/b/mountingpoint1 sudo mount -t ntfs /dev/sdb1 /media/b/mountingpoint1 sudo umount /media/b/mountingpoint1 sudo rmdir /media/b/mountingpoint1
If I detach the device and then attach a different block device, the new device will be again represented by the same device file
/dev/sdb1, and the above command will mount it to the same mounting point
/media/b/mountingpoint1. I need a way to name the mounting points differently for different devices.