Score:0

File Location in Hard Disks

cn flag
NiC

I'm new to Linux and I've set up a Ubuntu physical machine with 1 SSD (PCIE) and 2 HDDs (SATA). I know all file directories start with the root directory '/' in cmd, but is there a way to know the physical locations of the files, like which file is stored in which HDD or SSD (similar to Windows OS). Thanks a lot.

user535733 avatar
cn flag
Please [add to your question](https://askubuntu.com/posts/1358112/edit) the complete contents of your file `/etc/fstab`
Score:2
cn flag

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.

mook765 avatar
cn flag
I'd prefer the `findmnt`-command which gives much better readable output than `mount`.
Score:0
cn flag

There are many ways of doing this. Here's another:

If you want to use a desktop utility you might want to look at this page: https://help.ubuntu.com/stable/ubuntu-help/disk-partitions.html.en

Or from a command line you could use fdisk -l to list your drives.

#fdisk -l 

Disk /dev/sdb: 256 GiB, 274877906944 bytes, 536870912 sectors
Disk model: Virtual Disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Then df -h to list how these disks are mounted. Look at the Filesystem and Mounted On columns.

# df -h 

Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb        251G  3.3G  235G   2% /

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.