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

When using the mount utility, if you specify a directory that does not exist, that is considered an error. Is there any option I can use so that mount points get automatically created if they don't already exist?

share|improve this question
2  
Strange that the mount utility doesn't do this by default. I'm sick of typing: mkdir /media/USB, mount /dev/sdb1 /media/USB; umount /dev/sdb1, rmdir /media/USB. – Zaz Sep 14 '14 at 21:29
up vote 20 down vote accepted

try this:

if you want to create a Mount Point called DISK1, then type the following command in the terminal :

sudo mkdir /media/DISK1
share|improve this answer
    
Yeah, I was hoping for an option to mount, but this is fine, I guess. – Paul Dec 17 '11 at 21:20

No, the bare mount utility do not offer such an option.

It is done when mounting from a file manager like Nautilus, though.

share|improve this answer
2  
how can Nautilus do it then? – Andrea Borga May 4 '13 at 7:58
    
@AndreaBorga it checks if the directory exists before mounting. If the mountpoint doesn't exist as a directory, creates it and then mounts. – omninonsense Apr 2 '15 at 10:41

Your Answer

 
discard

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.