How to mount a cdrom drive in Linux permanently ?

Its common question or requirement on a Linux system, how to mount a CD ROM drive ?

1. We can simply mount the drive on any mount point.

[root@nglinux nglinux data]# mount /dev/sr0 /mnt/nglinux/
mount: block device /dev/sr0 is write-protected, mounting read-only
[root@nglinux nglinux data]# 

2. Now to make it permanent, edit fstab file and enter below line:

[root@nglinux nglinux data]# vim /etc/fstab 
/dev/sr0                /mnt/nglinux            iso9660    defaults        0 0

Now verify if the entry is correct, and if the device gets mounted.

[root@nglinux nglinux data]# mount -a
mount: no medium found on /dev/sr0

Make sure we have CD ROM inside the drive.

[root@nglinux nglinux data]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        20G  4.5G   15G  24% /
tmpfs           504M   68K  504M   1% /dev/shm
.host:/         436G  404G   33G  93% /mnt/hgfs

[root@nglinux nglinux data]# mount -a
mount: block device /dev/sr0 is write-protected, mounting read-only

[root@nglinux nglinux data]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        20G  4.5G   15G  24% /
tmpfs           504M   68K  504M   1% /dev/shm
.host:/         436G  404G   33G  93% /mnt/hgfs
/dev/sr0        1.7G  1.7G     0 100% /mnt/nglinux
[root@nglinux nglinux data]# 

Suppose you don’t know what is the name of your CD ROM drive, then you can get the device name by using below command:

[root@nglinux proc]# cat /proc/sys/dev/cdrom/info | grep -i name
drive name:		sr0
[root@nglinux proc]# 

Now you can use the device name followed by /dev i.e. /dev/sr0 in our case.

I hope you liked the article, do subscribe to this blog to keep yourself updated with new Linux/Unix/C articles.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments