Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm writing a backup script in which I need to mount a drive in the media bay of my laptop.

I know that I can get the job done by messing with fstab and the mount command. Perhaps that's the easiest way. Anyway, I'm interested in the following:

  1. Initially the media bay drive is unmounted. (screen shot 1, screen shot 2)

  2. I click on the drive in the side-panel in a nautilus window and the drive is mounted. (screen shot)

  3. I can access it at /media/baydrive (screen shot)

My question:

Is there an easy way of performing step 2 from the command line? I.e., mount the drive to /media/<device name> without messing with fstab.

share|improve this question
up vote 9 down vote accepted

Try udisks --mount <device name>

To mount by partition label, you can do

udisks --mount /dev/disk/by-label/baydrive
share|improve this answer
Nice command, but I get Cannot stat device file baydrive: No such file or directory – aioobe May 26 '11 at 9:24
The device name needs to be the device file used for the baydrive - something like /dev/sdb1 – Florian Diesch May 26 '11 at 9:34
Right. Then it works. You know of any way of referring to just baydrive instead? – aioobe May 26 '11 at 9:36
No. But if the partion has a label "baydrive" you can use /dev/disk/by-label/baydrive – Florian Diesch May 26 '11 at 20:03
whoaa,. I had no idea about that. great! Edited post to include this variant – aioobe May 26 '11 at 20:12

You can alternatively mount the drive, it will then appear at the side panel.. you can right click that shortcut on the side panel and lock it on the launcher.. now you will be able to simply single click that icon to mount the drive without any command, startup script or opening nautilus.

share|improve this answer
The whole point of the question is how to do this without fiddling with the GUI. I want to put the backup script as a cron job. – aioobe Mar 17 '14 at 21:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.