1
% cat /etc/fstab
/dev/sda1       /               ext2        defaults        1   1
/dev/sda2       /usr/local      ext2        defaults        1   1
/dev/sda4       /home           ext2        defaults        1   1
/dev/sdb1       swap            swap        defaults        0   0
/dev/sdb3       /export         ext2        defaults        1   1
none            /dev/pts        devpts      gid=5,mode=620  0   0
none            /proc           proc        defaults        0   0
/dev/fd0        /mnt            ext2        defaults        0   0
/dev/cdrom      /mnt/cdrom      iso9660     ro              0   0  

This is a random example that I got from a website while trying to understand mounting of devices. Being someone from a Windows background, I have a hard time trying to understand the concept of mount points.

Here is my understanding, please correct me where wrong:

  1. All detected devices go in the /dev folder.
  2. /sda1 is the first partition of the SCSI drive and is mounted on the root because legend has it that one drive has to be mounted on the root.
  3. swap needs no mount point.

What I don’t understand is why the other sda partitions have different mount points. Shouldn't they all go to /mnt ?

4 Answers 4

2

For better understanding you should to remember the some linux concept: "You are boss and you should can choice whatever you want". Each of the partitions can be mount by

  • static (every boot): via record in /etc/fstab
  • by hand: when you use mount command
  • automatic (when switched to): by udev demon according to it's rule files, as usual it can be /media/$USER/$DISK_LABEL mount point.

And everything can be changed at your own mind. It is just agreement to use /mnt as place for manual mounting. As usual in the folder a child-folder has been maked before mounting (for example /mnt/DATA for partition with data files, /mnt/MUSIC for partition with music files, etc.). But I prefer to mount such partitions directly to apropriate folders in my $HOME folder. Everything at your choice.

Just to remember "Great power bring great responsibility!" There are many rules and agreements so as the reasons why it done in this or that way. So you better study question before to change something.

2

Shouldn't they all go to /mnt?

Why should they? You created different partitions, each partition with a purpose, and assigned the mount points to the partitions according to their purpose. There isn't a single place where all partitions should be mounted, and you can select not to mount them at all if you want.

In the example, you said to assign a separated partition to /home, /usr/local and /export, which I could haphazardly guess, so you can reinstall and reuse those partitions without being afraid of losing the data.

In summary: there isn't a directory where partitions should be mounted. You can mount them wherever you want to suit your needs (trying to avoid the obvious caveats that are /run, /sys, /dev, ...).

1

To understand how unix filesystem is organized, you need to understand Filesystem hierarchy standard.

Generally to install a linux machine you need to have atleast 2 partitions / and swap. In case if you dont have process that dose lot of swapping the you can also omit swap.

The / is said to be the root of the filesystem and swap is used for memory swapping. Other directories such as /boot, /home, /usr, /var, /tmp, etc can be placed either in different partitions or along with partition where / is placed.

One has to decide this layout based on his specific requirements. For example, A database server needs to have a huge /var in a separate partition, /tmp needs to be kept separately if the server/service writes too many temporary data, to avoid filling up / partition. The choice of having different directories in different partition is based on the scenario and what kind of filesystem will suite their need.

/dev is a mounted with a virtual filesystem called sysfs. The /dev directory contains all devices that are detected by the kernel. The files in /dev are created and removed based on hardware removal/insertion and this is controlled by udev daemon.

/mnt is the space where temporary mounted filesystems are placed.

3
  • So if the mount point of a partition is /home, it means that all the data for /home will go there. Correct?
    – An SO User
    Nov 10, 2014 at 14:39
  • yes, /home will have home directories of the users in the system. Nov 10, 2014 at 16:19
  • I know that but since I am assigning a different partition to it, the different home directories will be on a different partition. Correct?
    – An SO User
    Nov 10, 2014 at 17:43
1

The most important thing to understand about Unix is that there's no major distinction between a mounted partition and as directory: they are, for a good majority of purposes, identical.

And that's why they don't just shove all mount points all under /mnt or /media. They're not special like on Windows, they're just directories!

Instead, Unix constructs a hierarchy (usually based on the Filesystem Hierarchy Standard nowadays) out of mounts and directories.

The only "caveat" to this is that certain things need to be on the root partition for the kernel to bootstrap itself (though a ramdisk for booting changes this a bit, but that's a story for another answer)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .