Auto Mount from the command line

I recently found myself in the need of setting up an auto mount from one machine to another and I wanted to put up a quick how to.

I assume you are running 10.9.X (This was only tested on Mavericks)
Because OS X 10.9 has made some changes to it’s structure and the use of /Volumes, We will create a new location at the root of our drive
Open up a terminal window and type:
cd / and hit Enter
Screen Shot 2014-10-15 at 4.18.59 PM
This puts you at the root of your drive, Now we want to create our mount folder i.e mnt (this folder will hold all our auto mounts and you can call it whatever you would like)
mkdir /mnt
Screen Shot 2014-10-15 at 4.21.48 PM

Now we want to add a path in the auto_master which automount reads for the mount point we just created so:

sudo pico /etc/auto_master
Add /mnt/             auto_casper (Again this is for the purpose of this example, it can be anything you want

Screen Shot 2014-10-15 at 4.25.31 PM

Enter Ctrl+X to exit and you will be prompted to Save, Type Y and press Enter

The point of this is that anytime /mnt will be called, automount will check auto_casper for the info needed such as mount or no mount
Now let’s create that reference file by typing sudo pico /etc/auto_casper in Terminal
and we will enter the info in regards to the share we want to automount
In pico, type: remote  -fstype=smbfs ://
remote is the name that the mounted share will be called is the DNS entry but it can also just be the IP of the remote machine
share is the name of the folder you are trying to mount, if it’s the entire machine then you don’t need it
PS: This assumes you are mounting via an anonymous account but if you do need to to login then it will be remote  -fstype=smbfs ://

Always use DNS entries or have the remote hostname listed in /etc/hosts

Each filesystem you add on auto_casper should be on a separate line



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s