Skip to content

Filesystem mounts#

We can see the mounts on our server right now: mount

1
2
~$ mount
/dev/xvda1 on / type ext4 (rw,relatime,discard)

What we have here is a partition called xvda1 (and the device is xvda), which is mounted onto /. Underneath this we can create directories and files. Ubuntu does a lot of this for us in order to give us, well, Ubuntu itself:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/$ tree -L 1
.
├── bin -> usr/bin
├── boot
├── dev
├── etc
├── home
├── lib -> usr/lib
├── lib32 -> usr/lib32
├── lib64 -> usr/lib64
├── libx32 -> usr/libx32
├── lost+found
├── media
├── mnt
├── opt
├── proc
├── root
├── run
├── sbin -> usr/sbin
├── snap
├── srv
├── sys
├── tmp
├── usr
└── var

23 directories, 0 files

Note

You can install the tree command via sudo apt install tree and run this for yourself. Don't forget to cd / first.

But is everything in that list just a plain directory under /, or perhaps something else? There are no files listed (because we can see 0 files at the bottom of the output) so everything there is a directory, but are they all backed by my xvda1 partition?

The short answer is no. Let's explore a few of the options in the list and see how they're mounted.

1
2
3
4
5
/$ mount
/dev/xvda1 on / type ext4 (rw,relatime,discard)
devtmpfs on /dev type devtmpfs (rw,relatime,size=1012268k,nr_inodes=253067,mode=755)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)

From this list we can see / is mounted on /dev/xvda1, which is a block device (disk). That's a pretty simple mount to understand we have a partition that has been formatted with the ext4 filesystem and we've mounted it at /, the root.

The /dev "directory" is mounted on devtmpfs and its type is devtmpfs. This is a type of filesystem that isn't backed by a physical disk, but in fact is backed by your physical RAM - the memory in your system. That's right, you can "partition" (in a sense) your RAM and then mount that partition as a location on the filesystem. Neat, but also pretty advanced. In short, this is done because certain things don't need to persist or survive after you reboot a system (everything in RAM is cleared) and are only used whilst the system is running. For these types of very small "databases" of information, they can be stored in RAM.

Next we have /sys, which is mounted at the "directory" /sys and is of sysfs. This is another "virtual filesystem", just like devtmpfs. It resides in memory and isn't backed by a physical device like our xvda1 partition is.

And then we finally have /proc. You should be able to determine the filesystem type. Do some research and discover for yourself what the proc filesystem is used for. Is it an in-memory (virtual) filesystem also?