How to check mounted file system?

Checking Mounted File Systems in Linux

In the Linux operating system, you can check the mounted file systems using various commands. This is useful for understanding the storage configuration of your system, troubleshooting issues, and managing disk space.

Using the mount Command

The mount command is the primary way to check the mounted file systems in Linux. When executed without any arguments, it displays a list of all currently mounted file systems. Here's an example:

$ mount
/dev/sda1 on / type ext4 (rw,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
# ... (additional mounted file systems)

The output shows the device name, the mount point, the file system type, and the mount options. This information can be used to understand the storage configuration of your system.

Using the df Command

Another useful command for checking mounted file systems is df, which stands for "disk free." This command displays the total size, used space, and available space for each mounted file system. Here's an example:

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       100G   50G   45G  53% /
tmpfs           16G  1.6M   16G   1% /run
/dev/sda2       500G  200G  300G  40% /data

The -h option in the command stands for "human-readable" and displays the sizes in a more easily understandable format (e.g., gigabytes instead of bytes).

Using the findmnt Command

The findmnt command is a more modern and powerful alternative to mount and df. It provides a more detailed and structured output, making it easier to parse and analyze. Here's an example:

$ findmnt
TARGET SOURCE FSTYPE OPTIONS
/      /dev/sda1 ext4 rw,relatime
/proc  proc proc rw,nosuid,nodev,noexec,relatime
/sys   sysfs sysfs rw,nosuid,nodev,noexec,relatime
# ... (additional mounted file systems)

The findmnt command can also be used to search for specific mount points or file system types. For example, to find all mounted file systems of type ext4:

$ findmnt -t ext4
TARGET SOURCE FSTYPE OPTIONS
/      /dev/sda1 ext4 rw,relatime

Visualizing Mounted File Systems with Mermaid

You can use a Mermaid diagram to visualize the mounted file systems on your Linux system. Here's an example:

graph TD A[/dev/sda1] --> B[/] A[/dev/sda1] -- ext4 --> B[/] C[/dev/sda2] --> D[/data] C[/dev/sda2] -- ext4 --> D[/data] E[tmpfs] --> F[/run] E[tmpfs] -- tmpfs --> F[/run]

This diagram shows three mounted file systems: /dev/sda1 mounted on the root directory /, /dev/sda2 mounted on /data, and a tmpfs file system mounted on /run. The file system types are also displayed.

By using a visual representation, you can quickly understand the storage configuration of your Linux system and the relationships between the mounted file systems.

In conclusion, the mount, df, and findmnt commands are the primary tools for checking mounted file systems in Linux. These commands provide different levels of detail and can be used in combination to get a comprehensive understanding of your system's storage configuration. Additionally, using a Mermaid diagram can help you visualize the mounted file systems, making it easier to understand and analyze the storage setup.

0 Comments

no data
Be the first to share your comment!