File Location in Hard Disks
Solution 1:
File systems are "hinged into" the main file tree at specified locations. That principle is called mounting.
Let's say you have a hard disk sda
, with (among others) a partition sda7
. If you mount that partition (or rather, the file system on the partition) to the mount point /var/data/something
, all files that this file system contains will be visible below /var/data/something
.
If you look at this idea the other way around, a file that you generate below a mount point will go to the respective filesystem, partition and physical device. So if you write data to, say, /var/data/something/else/my/data/file.txt
, this file will reside (as we've seen above) on the file system mounted to /var/data/something
, which is on the partition sda7
, which is in turn on the physical device sda
.
You probably know what has been mounted to which mount points from setting up the server. In case you don't know, you can list all currently mounted file systems with the mount
command. This should give you a list of entries like
...
/dev/sda2 on / type ext4 (rw,relatime,errors=remount-ro)
/dev/sda4 on /home type ext4 (rw,relatime,errors=remount-ro)
/dev/sda7 on /var/data/something type ext4 (rw,relatime,errors=remount-ro)
...
How devices are named (the sda
in this example) would be question of its own. It mostly depends on the type of the device and which type of controller it's conntected to.