Auto Mount File System ke Linux

Bagaimana cara untuk melakukan mounting file system secara otomatis di system Linux yang kita miliki? Begini caranya:

Cari UUID dari disk yang ingin kita auto mount. Bisa dari Gnome Disks, atau juga bisa dengan command

sudo blkid

Copy paste UUID dan tipe file system dari hasil yang muncul. Misalkan UUID eb67c479-962f-4bcc-b3fe-cefaf908f01e dan file system ext4

Selanjutnya kita buat mount point

sudo mkdir /mnt/mydrive

Berikutnya kita buat entry fstab

sudo nano /etc/fstab

Kita tambahkan data seperti ini

UUID=eb67c479-962f-4bcc-b3fe-cefaf908f01e /mnt/mydrive ext4 defaults 0 2

Kalau mau mounting sebagai user tertentu bisa dengan menambahkan parameter berikut:

UUID=eb67c479-962f-4bcc-b3fe-cefaf908f01e /mnt/mydrive ext4 defaults,uid=1000,gid=1000,umask=022 0 2

Some Explanation

For swap partitions, the mount point field should be specified as none.

The defaults mount option will give users read and write access to the file system.

The value of dump field is usually zero.

The pass field is used by the fsck program to determine the order in which filesystem checks are done at reboot time. As you can see in this file, the value of the pass field for the root file system is 1. Swap partitions do not need to be checked and the value for them is zero. All other file systems should have a value of 2. So I set the pass value as 2 for my drive.

uid=1000 is the user id.

gid=1000 is the group id.

umask=022 this will set permissions so that the owner has read, write, execute. Group and Others will have read and execute.

Untuk mencari user id, jalankan command id pada terminal


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *