Mac Essentials: Mounting Network Drives in Terminal

Termianl-IconSometimes when doing installs or working on remote machines, the use of standard mounting means is not possible. Fortunately we can use Terminal to mount some network drives when needed. It isn’t the easiest way to mount a drive, but it is always available if you have access to a Mac’s Terminal. I have found this to be especially useful when, after booting to a recovery partition, restoring my OS from an image that is saved on a network backup.

The first line creates the folder directory we’ll need to connect the network folder to:

sudo mkdir /Volumes/[Disk Name]

Then we mount the network volume:

sudo mount -t afp afp://user:pass@[IP Address or Domain Name]/[Shared Folder] /Volumes/[Disk Name]

You can  string these two together into one long command to get it done. Here is an example code:

sudo mkdir /Volumes/rDisk && sudo mount -t afp afp://admin:superpassword@192.168.1.1/RemoteDisk /Volumes/rDisk

That’s it! Alternatively you can use the mount_afp command to achieve the same results:

sudo mkdir /Volumes/rDisk && sudo mount_afp afp://admin:superpassword@192.168.1.1/RemoteDisk /Volumes/rDisk

Likewise you can unmount using the umount command:

sudo umount /Volumes/rDisk

Leave a Reply

Your email address will not be published. Required fields are marked *