Dev License: This installation of WHMCS is running under a Development License and is not authorized to be used for production use. Please report any cases of abuse to abuse@whmcs.com

How to automatically mount a partition after server boot in linux

auto mounting partitions is very easy in linuxmint with the disk utility which have a nice gui explaining everyting.

but now i am going to show you a staright forward process of automonting partitions by editing /etc/fstabfile.

this tutorial is not solely for automounting but how to edit fstab efficiently and gaining some knowledge about it.

steps:

1. sudo gedit /etc/fstab

2. now the fstab file is open in gedit. you need to add an entry for the partition to automount it at startup.

the format of a new entry is like this:

  file_system   mount_point   type  options     dump  pass            

you will see this in the file and you need to add your new entry under this line.

brief explanation of the above format:

1.file_system = your device id.

use this:

/dev/sdax ( you should check it with sudo fdisk -l)

it may be /dev/sdbx or /dev/sdcx if you have more than one disks connected.

2. mount_point =where you want to mount your partition.

use this:

/media/user/label  

here user is your user name, label is "software", "movies" or whatever label your partiton have.

3. type=fat32,ntfs, ntfs-3g,ext2,ext4 or whatever your partition type is.

4. options =mount options for the partition(explained later).

5. dump=Enable or disable backing up of the device/partition .usually set to 0, which disables it.

6. pass =Controls the order in which fsck checks the device/partition for errors at boot time. The root device should be 1. Other partitions should be 2, or 0 to disable checking.

so for auto mounting case the above format reduces to:

/dev/sdax /media/user/label  type  options           0  0

(you can check the type with sudo fdisk -l)

the options field:

  • sync/async - All I/O to the file system should be done synchronously/asynchronously.
  • auto/noauto - The filesystem will be mounted automatically at startup/The filesystem will NOT be automatically mounted at startup.
  • dev/nodev - Interpret/Do not interpret character or block special devices on the file system.
  • exec / noexec - Permit/Prevent the execution of binaries from the filesystem.
  • suid/nosuid - Permit/Block the operation of suid, and sgid bits.
  • ro/rw - Mount read-only/Mount read-write.
  • user/nouser - Permit any user to mount the filesystem. (This automatically implies noexec, nosuid,nodev unless overridden) / Only permit root to mount the filesystem. This is also a default setting.
  • defaults - Use default settings. Equivalent to rw, suid, dev, exec, auto, nouser, async.
  • _netdev - this is a network device, mount it after bringing up the network. Only valid with fstype nfs.

now the final format reduces to (for auto mount):

/dev/sdax /media/user/label  type     defaults       0  0  

for ntfs

/dev/sdax /media/user/label   ntfs  defaults       0  0  

for ext4

/dev/sdax /media/user/label   ext4  defaults       0  0  

etc.....

you can change defaults by your own configuration, like

/dev/sdax /media/user/label   ext4  rw,suid,dev,noexec,auto,user,async      0  0

etc...

you need to add entry for each partiton you want to auto mount.

3. save and exit the file then restart and see the result.

for more information visit the links below:

https://help.ubuntu.com/community/Fstab

http://en.wikipedia.org/wiki/Fstab

Was dit antwoord nuttig?

Gerelateerde artikelen

Find spam script location with Exim

Sometimes you can have a "tell a friend" feature on your website, or other type of email...

How to change the primary IP addres of a WHM/cPanel server

This is for CentOS/RHEL based servers. Steps in WHM: Log into WHM and go to Basic cPanel...

How to change file/folder permissions in linux cent os

Using SSH (Putty) > Login as root enter the following code to Change all permissions for...

clamAV installed, but not working on the command line and appears to not be installed

On 11.40+ You may try to install ClamAV and then see it have problems when trying to run on...

Exim Remove All messages From the Mail Queue

Question: I'm using Exim mail server under CentOS Linux. How do I remove all messages from the...

Powered by WHMCompleteSolution