11

I just get ubuntu 12.10. So I am a newbie.

I have sata hard disc with partitions - sda 1 (swap) sda 2 (mount point /) and sda 3 (mount point /home).
Today I add another internal hard disc (not sata) which I plan to use only for data, and its mount point is /media/sdb1.

But after adding another HD ubuntu doesnt mount my dvd rw drive any more.
I get this error:

mount point media cdrom0 does not exist

I tried in terminal:

mount/cdrom

and get this:

mount: can't find /cdrom in etc/fstab or etc/mtab

What should I do?

3 Answers 3

14

I looked in /dev. A file there was called dvd. I entered ' ls -al /dev/dvd ' and it told me that this was a link to /dev/sr0. I inferred that from this response:

lrwxrwxrwx 1 root root 3 Apr 24 15:56 /dev/dvd -> sr0

The first 'l' means that it is a link, not a real file.

Then, I looked at /. There was a directory there called 'mnt', the usual node for subdirectories of mounted peripheral devices. It was empty.

I made a subdirectory of /mnt using:

sudo mkdir /mnt/cdrom

Then, I mounted sr0 there with:

sudo mount /dev/sr0 /mnt/cdrom

To see, I looked at it:

ls /mnt/cdrom

It came up with a lot of right-looking stuff, so I concluded success.

2
  • 1
    More generally: mkdir anythingAtAll; sudo mount /dev/sr0 anythingAtAll Commented May 7, 2015 at 16:26
  • Still in 2017, this is the solution that worked for me, on Ubuntu 17.04. Not sure why Nautilus won't auto-mount like it does for any other removable media, but this works.
    – seanlano
    Commented May 27, 2017 at 2:29
2

CD/DVD Drive Rule: Mount Drive Upon Insert to "/media/DVD"

Do this if you want to restore auto-mounting with some control over how it is done.

  • Auto-creates mount point upon insertion of medium
  • Auto-mounts medium to mount point with specific permissions
  • Auto-removes mount point upon removal of medium

Action: CD/DVD Tray has media and is pulled in

You have to tell your system to react this this action. You can have it run a mount script (any custom script). To do this, you need to create a new rule in the lib/udev/rules.d folder. These commands need to be run as root (use the prefix sudo for the following commands to run them as root or become the root user with sudo -s

  • Make a new file and call it autodvd.rules touch /lib/udev/rules.d
  • Look for info about your CD/DVD drive by running udevadm info --query=all --attribute-walk --name=/dev/sr0 (root not necessary here, but works both ways) Look for something that uniquely identifies your drive (for better or for worse I picked ATTRS{vendor}=="HL-DT-ST", which is my drive (yours will be different unless you happen to own the same drive as me). Copy it down somewhere for later. You can take some time to look over this file and compare it with the rule example below. The SUBSYSTEM and ATTRS can be found in it.
  • Edit your new rule (you can use whatever editor you choose, I use vim /lib/udev/rules.d, but nano /lib/udev/rules.d works too and is easy. Add these things, editing your ATTRS to match yours (this is the sensitive part, you might have to pick a different attribute if it doesn't work) and correct the YOURUSER and YOURGROUP fields:

KERNEL=="sr[0-9]*", SUBSYSTEM=="block", ATTRS{vendor}=="HL-DT-ST", SYMLINK+="dvdburner", OWNER="YOURUSER", GROUP="YOURGROUP" ACTION=="change",RUN+="/home/YOURUSER/Scripts/Bash/automountdvd.sh"

  • The KERNEL=="sr[0-9]*" just means it will test all scsi devices (sr0-sr9)
  • The SYMLINK is just a symbolic link to the drive (like /dev/cdrom is to the real /dev/sr0)

You may need to reload all of the udev rules:

udevadm control --reload rules
reload udev
udevadm trigger

Mount Script

Save the following somewhere like: /home/YOURUSER/Scripts/Bash/automountdvd.shand correct the YOURUSER and YOURGROUP fields. Oh by the way, it is dangerous to put this script in the user folder, because it will be run by root, which means if somebody hacks your user folder, they can adjust the script to do whatever they want and root will run it (and likely succeed, because the root user has full control over the system) Probably better to hide it in a folder that only root can see. If you are experimenting, it is fine.

#!/bin/bash
{
mountpoint="/media/DVD"
user=YOURUSER
group=YOURGROUP

uid=$(id -u ${user})
gid=$(id -g ${group})
FS_TYPE="`blkid /dev/sr0 | grep -o 'udf'`"
if [ ${FS_TYPE} == 'udf' ]; then
    echo "ID_CDROM_MEDIA set to 1, creating ${mountpoint} and attempting to mount DVD."
    mkdir -p ${mountpoint} && chown ${user}:${group} ${mountpoint}
    mount -t ${FS_TYPE} -o ro,uid=${uid},gid=${gid} /dev/sr0 ${mountpoint}
    echo "DVD mounted at ${mountpoint}."
else
    echo "Attempting to unmount -l ${mountpoint}."
    umount -l ${mountpoint}
    rm -rf ${mountpoint}
    echo "Unmounting ${mountpoint} and removing folder ${mountpoint}."
fi
} &>> "/var/log/autodvd.log" &
1

If you want to mount a cd/cdrom/dvd/whatever manually, you should first look in the directory /dev, for example with ls /dev. It is probably called dvd1. Then mount it with sudo mkdir /mnt/dvd1 && sudo mount /dev/dvd1 /mnt/dvd1.

3
  • 1
    I got cdrw1 in /dev. I try this and get: mount: no medium found on /dev/sr0
    – user132378
    Commented Feb 15, 2013 at 21:22
  • 1
    mount: no medium found on /dev/sr0 I would like to have rw drive to mount on every start of OS,like it use to.
    – user132378
    Commented Feb 15, 2013 at 21:29
  • I got mount: no medium found on /dev/sr0 but after inserting disk and trying again it was fine
    – rshdev
    Commented Apr 7, 2018 at 18:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .