How to Auto Mount an Internal Blu Ray

banagalemr

Cadet
Joined
Apr 3, 2023
Messages
9
I am trying to auto-mount my internal Blu Ray drive but up to now unsuccessful. My Blu Ray is connected via SATA. I am tired of mounting the drive each time I start the computer. Thru some searches, I found out that this can be done by adding it on /etc/fstab. I edited the /etc/fstab file and added this line:

/dev/sro /media udf,cdfs,iso9660 user,auto,exec,utf8 0 0

But each time I boot the machine, the /etc/fstab is being overwritten and my addition to it are lost.

Is there a way to accomplish this? Is there something I missed in /etc/fstab? I have very minimal knowledge when it comes to Linux OS.

Thank you.
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
You can do that with a startup script.
 

banagalemr

Cadet
Joined
Apr 3, 2023
Messages
9
You can do that with a startup script.
Thanks, Ericloewe for your reply. I will have to do further reading on how to accomplish what you suggested.

One thing I don't understand is why I have to manually mount the Blu Ray. I have a Dell laptop with built-in DVD Rom running Ubuntu. But I don't have to mount the DVD Rom. Ubuntu recognizes it as part of my hardware. Maybe this is the way Truenas works.
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
Ubuntu is preconfigured for that because it's a Desktop OS.
 

banagalemr

Cadet
Joined
Apr 3, 2023
Messages
9
Oh, I see and yes it is a Ubuntu Desktop. Thanks for your explanation, Ericloewe.

I did further reading on creating a startup script. Inside Truenas scale GUI, by going to System Settings >> Advance >> Init/Shutdown script, I can add my startup script here. I still have no idea how to assemble the script. Am I in the right direction?
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
They're just normal shell scripts, so the starting point would be whatever commands you need to mount the drive.
 

banagalemr

Cadet
Joined
Apr 3, 2023
Messages
9
Thank you EricLoewe. Appreciate very much your help. I will give it a try and let you know the results. Cheers.
 

banagalemr

Cadet
Joined
Apr 3, 2023
Messages
9
Hi Ericloewe,

I had success in auto-mounting the DVD drive. I used my laptop for testing and it works. I used cron. I put this on my crontab "@Reboot /root/scripts/name_of_my_scripts.sh". to mount the drive when I reboot or restart my machine. It will not mount when there is no media in the tray, so I make sure that I have media on the tray when the machine is restarted. With further reading, I found out that it can be done by creating udev rules. But this is too complicated for me. For now, I am happy with this solution. I will now try this out on my TrueNas Scale machine.

Thanks again for your help.
 
Top