About Me

header ads

Tip: How to mount partitions in Linux


It happens in many cases, after installing a Linux system on a hard disk already partitioned, these "partitions" are not installed automatically when system boots. So, that leads to have to mount partition each time you want to use it, which is removed once computer off and when turned back on, we have to be reassembled and so on.



So let's see then how to make partitions on your disk are mounted automatically at startup. Note that in this article we are dealing with Linux partitions with file systems ext2, ext3, etc. The partitions that we use to save documents, movies, music, etc., as opposed to using system partition.

Suppose we have two ext3 partitions, one of which is used by another system and use it to store our data, documents, etc. So, first we are going to do is create mount points for partition that we use for storage.

The directory "/media" is that we use to create directory, which we call "disk" which will be mount point for partition in question. To do so, tipeamos console as follows:

We move to directory /media
  • $ cd /media
We login as root
  • $ su
Create directory "disk"
  • # mkdir disk
Following this, we ensure that owner of that directory is your user.
  • # chown chamberdoor -R disk
Then assign permissions:
  • # chmod 755 -R disk
Once completed these steps, which will prepare directory mount point, we turn to tell system where you have to set up and how each part. To do this edit the file "fstab" found in directory "/etc", as follows:

Open fstab file with your favorite editor, such as: nano, vi or gedit.
  • # nano /etc/fstab
And at end of this file add a line that lists all data partition mounting. That line will look like this:

device/ Mount_point/ file_system/ options/ dump-freq/ pass-num

Where "device" is name of partition is in /dev, and can be called sda1, sda2, etc. We can find out by running following command: "fdisk-l". "Mount Point" refers to directory you created earlier. "File System" just file system of the partition in question, eg: ext2, ext3, etc. "Options" refers to attributes of partition, for example "defaults". "Dump-freq" is a number, indicating to "dump" on backs up the partition, if we leave it to 0 is not taken into account. And "pass-num", which also is a number, tells the program "fsck" to look for errors in partition, if we let it to 0 is not taken into account.

Taking these data into account, add at end of file "fstab" completing course set out above. What would be something like this:
  • /dev/sda5 /media /disk ext3 defaults 0 0
File save changes, reboot PC, and see that once system partition is automatically mounted.

Post a Comment

0 Comments