Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the methods of automatically mounting the two optical drives of Linux?

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

What are the two automatic mounting methods of Linux optical drive? I believe many inexperienced people are at a loss about this. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

Environment: CentOS6.4 Xikun Cloud Server

Method 1. Modify the fstab file

/ etc/fstab is the file system information saved by the system? Static files, each line describing a file system; this file information is read each time the system starts to determine which file systems need to be mounted. There is not much about parameter syntax, but there are many on the Internet.

Vi / etc/fstab

Add a line at the end

/ dev/sr0 / Media/cdrom iso9660 defaults 0 0

Mode 2 configure autofs

This approach is actually an automated mount. That is to say, autofs is a daemon that detects that a user is visiting an unmounted file system by master and apprentice. If it exists and is configured correctly, autofs will automatically mount it for you.

1. Install autofs

In general, the default installation is rpm-qa | grep autofs determines

two。 Configure auto.master

Autofs needs to read the configuration information from the / etc/auto.master file. It is mainly used to specify the mount point of the file system, with each line representing one mount point; each line consists of three parts

Idle time before automatic unloading of configuration files used for hook-up points

/ mnt / etc/auto.misc-- timeout 600

3. Configure auto.misc

It is mainly used to provide hook parameters for auot.master. Similarly, each line represents a file system, and each line consists of three parts.

Cdrom-fstype=iso9660,ro,nosuid,nodev: / dev/sr0

Relative? Connection parameter file system location of the contact file system

4. Start autofs

Services autofs restart

5. Use autofs

The above configuration specifies that autofs mounts the optical drive under / mnt/cdrom whenever it needs to be read. When idle for 600 seconds, autofs will automatically uninstall the optical drive

A simple test

File system mount before use

[root@CentOS6 /] # mount

/ dev/mapper/vg_centos6-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)

Sunrpc on / var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

Do an action that uses the optical drive, such as entering / mnt/cdrom

[root@CentOS6 /] # cd / mnt/cdrom

[root@CentOS6 cdrom] #

View the mount again

[root@CentOS6 cdrom] # mount

/ dev/mapper/vg_centos6-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)

Sunrpc on / var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

/ dev/sr0 on / mnt/cdrom type iso9660 (ro,nosuid,nodev)

After reading the above, have you mastered what are the two methods of automatic mounting of Linux optical drive? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report