File system mounted or not

Hi,

I know something about file system that its a directory to hold files.
My query is how to identify file system is mounted or not .Can you give me some examples?

OS --- Linux 2.6

The mount command can help you with that. By itself it shows every mounting point:

[aia@server1 ~]$ mount
/dev/mapper/vg_server1-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

If you know the filesystem (ext4 in this case), it can be a little more specific by using the flag -t:

[aia@server1 ~]$ mount -t ext4
/dev/mapper/vg_server1-lv_root on / type ext4 (rw)
/dev/sda1 on /boot type ext4 (rw)
1 Like

Thanks Aia.

Why is it necessary a file system should be mounted. Can you explain ?

Regards,
Maddy

A device (a disk, a memory stick, ...) is available to the OS or it's not. Presence is scanned at boot time, or the device may be hot plugged. It will be made available in the /dev directory. Its raw data can be read from there, but, please, don't mess around with raw data. The device can be one single data container, or it can be "partitioned" or "sliced". That means, there are data structures on disk that tell the OS how some regions on disk are to be distinguished from others. Those regions can be seen as "disk" of their own. Up to now, you can't do too much useful things with the device (or "disks") except e.g. put a (large) data stream like a backup on them.
To make data randomly accessible from the OS, you need to create another structure: a file system. There's many an FS in them there hills... *nix type, DOS, windows, MAC, ... FS have tables and pointers and names that allow the OS to manage data chunks called files and make them available to system or users' commands.
Mounting a disk (or file system) reads these logical structures and makes the directories, files, etc... known and accessible to the system, and thus users.

You can very well use mount command to know the list of filesystems mounted.
This mount command returns the output of fstab file.

One more alternate way is to view /proc/mounts file which has updated list of filesystems mounted.

I'm sure you meant /etc/mtab

In order to understand mounting points, you need to understand and associate it with these two concepts: partitions and formatting.
Partitions are the logical division that you can impose on a single disk or storage device. Formatting is the prearranged organizational structure imposed on the data written to that partition.

In order to access this complex combination abstraction, an interface or point of access has been created, using directories. That's mounting.

Now when you see:

/dev/sda1 on /boot type ext4 (rw)

You can identify the partition 1 on disk sda or first partition on first disk: /dev/sda1 mounted on the directory /boot and formatted with the filesystem ext4 for reading and writting (rw)

---------- Post updated at 01:15 PM ---------- Previous update was at 01:10 PM ----------

If you still are not sure, think about a house. That's a disk.
A house usually have many rooms or divisions. That's partitions.
A bathroom is different that a kitchen room or a bedroom. That's formatting.
You access these rooms, usually, via an entry door or doorway. That's mounting.

1 Like

Thanks Aia for explanations with examples.