TL;DR: Because /dev/
filesystem and mountpoint of a device have very minimal relation, and they differ in their purpose.
What is the purpose of /dev filesystem?
To quote Gilles's answer:
Almost all the files under /dev are device files. Whereas reading and writing to a regular file stores data on a disk or other filesystem, accessing a device file communicates with a driver in the kernel, which generally in turn communicates with a piece of hardware (a hardware device, hence the name).
Have you ever heard the saying "everything is a file on *nix" ? Well, that's somewhat how /dev
filesystem works - it allows you to have a "file" representing a specific piece of hardware connected to your computer. If you have a mouse connected, it will show up as /dev/input/mouse0
, for example; if you have hard drive connected, it likely will show up as /dev/sd<LETTER><NUMBER>
(and it should be noted, typically is used to represent block devices which allow you reading data in blocks of some number of bytes and typically make use of SCSI protocol, although for new NVM drives can show up as /dev/nvme0n1
).
And it's possible to interact with devices just like that. It's common for people to make backups with dd if=/dev/sda1 of=/dev/sdc1
or something a long the lines. When you have Arduino or Raspberry Pi connected via serial port, they'll show up as serial consoles /dev/ttyUSB0
or /dev/ttyACM0
, and you can write bytes to it to communicate with the device, although more practical is to use something like screen
or byobu
or PuTTY
software. But that's about it - you can't really view files on device in a simple way.
What is a filesystem?
A filesystem is how data is organized on a storage device of some form. And there's many filesystems.If you have hard drive from Mac, data was organized on that drive with HPFS or APFS types of filesystem; if it comes from Windows - that may use NTFS filesystem; it if comes from Linux - typically would be a form of ext
filesystem; BSD or Solaris might use zfs
, and so on and so forth. You could even mount iso file of a backup and bind it to a folder. They all have their own advantages, but the key idea is that data is organized in certain logical manner and allow a user do deal with individual files, rather than dealing with bytes or blocks of data. And the common trait is that all filesystems should have a mount point, the logical root of the filesystem tree of folders and files.
And that's where /dev
comes in. The /dev
is actually a virtual filesystem mounted on /dev
folder, in a sense that it exists only when your machine is running; once you shut down, everything in that directory is gone. Same with /proc
and /sys
directories - the representations of processes and physical devices exist only for the uptime of the system. That's why you can't make /dev
a mountpoint for your USB drive or hard drive - it is already a mount point for something else, and besides doing that would violate Unix filesystem hierarchy standard.
Although, it is possible to create directory in /dev/my_mountpoint
and mount a hard drive there ( with root privileges ), but it's redundant and against the already mentioned Unix filesystem hierarchy standard.
How are devices and mountpoints related?
We could make comparison between websites and disks. With a website, you have set of links to specific pages. But website is technically a collection of data stored somewhere on a server. Same idea here - /dev/sda1
may contain data and files, but mount point allows you to interface with those things in a logical way, and knowing path of a file, you can easily navigate to it just like with links on website you navigate to pages you need.
On technical side of things, mountpoint and device are managed by couple files. /etc/fstab
will allow you to specify device (either by /dev
reference or via UUID number ) and where to mount it at boot time. /etc/mtab
, /proc/mounts
, /proc/self/mountinfo
, and /proc/self/mountstats
will tell you where devices are currently mounted. Now, on Ubuntu the GUI allows automatic mounting ( in the past that was Unity, now GNOME , but in either case that should be still managed by the same GSettings schema). That in turn interfaces with UDisks2
system, which then mounts your USB or hard drive to /media
folder; in other words, there's software in place that relates your USB drive with mountpoint automatically.
It should also be noted, that certain programs such as df
can operate on only mounted filesystems, i.e. df
will show you usage only for those drives and partitions that are mounted. By contrast, in a lot of cases it is desirable to have filesystem unmounted for fsck
filesystem checking utility or parted
/Gparted
utilities (since those are used for resizing, and resizing a partition that is mounted can lead to loss of data). Such utilities as findmnt
will allow you to find where a specific device is mounted (which I personally use in my shell prompt to know which disk drive I'm currently in).
Conclusion
Probably this still doesn't make whole lot of sense, and it's understandable. Let's just say, that this is a convention. Not necessarily a Unix thing, because Windows does that in a similar way, with similar terminology. It's just how computers are built and what made sense to engineers when they were designing the systems years and years ago. But hey - it works, right ?
/dev/
folder is representation of devices or special pseudo devices like/dev/tty1
for example. And it's nice for low-level type of interaction. But if you want to access the filesystem contained on that/dev/sdb1
it has to have some sort of starting point, the root-folder. That's what mountpoint does for you. Does that answer your question ? This is just a comment, but let me know if you want me to post that as actual answer