Monday, February 14, 2022

How to use automount in your iMac Monterey OS

 macOS Version: Monterey 12.1


Below are the steps if you want to use your iMac Automount functionality to auto mount remote file systems using SMB.


1. Login as one of your administrators in your iMac

2. Open its terminal and sudo to root

MyImac:~ MyAdminUser$ sudo -i

Password:

MyImac:~ root# 

3. Go to /etc directory and open a file called auto_master in vi

MyImac:etc root# cd /etc
MyImac:etc root# vi auto_master

4.   Add the bolded yellow line below in your auto_master file. You can change mysmb to any name you want, just make sure you use the same name as filename in step 5.

#

# Automounter master map

#

+auto_master            # Use directory service

#/net                   -hosts          -nobrowse,hidefromfinder,nosuid

/home                   auto_home       -nobrowse,hidefromfinder

/Network/Servers        -fstab

/-                      -static

/-                      mysmb    -nosuid,noowners

Save and exit vi once the line above is added. 

5. In /etc directory create a file called mysmb in vi.

   MyImac:etc root# vi mysmb

6. Now this is where things get a bit complex and very specific to Monterey in terms of syntax. After you upgrade to Monterey, you will only be able to mount inside /System/Volumes/Data/. Hence you should use the following syntax:

/System/Volumes/Data/./<mountpoint> -fstype=smbfs,<other options> ://<yournas_user>:<password>@<nashostname>.local/<nas_share>  

mountpoint: this can be just one directory level or you can have something like dir1/dir2/mountpoint

         for example:

/System/Volumes/Data/./mnt/mynas/locaFS1 -fstype=smbfs,soft,noowners,nosuid,rw ://mynasuser:password@mynas.local/nasShareFS1

/System/Volumes/Data/./mnt/mynas/locaFS2 -fstype=smbfs,soft,noowners,nosuid,rw ://mynasuser:password@mynas.local/nasShareFS2

Save and exit vi once you've added the entries you need. Given that you put the password in this file, you may need to secure it so that only root users can read it by changing its permission to 640

7.  Edit  your /etc/hosts and add your nas share hostname on it. Yes for some reason, Monterey automount doesnt work with IP addresses.

MyImac:etc root# vi hosts

8. Add your nas server IP address and hostname on it. Make sure that the hostname you used in this is the same as the one you used in step 6 above. 

For this example, add this line on your /etc/hosts

<yourNAS IP ADDRESS> mynas

 Save and exit.

9. Restart your automount daemon process

MyImac:etc root# automount -vc

automount: /System/Volumes/Data/home updated (/home -> /System/Volumes/Data/home)

automount: /System/Volumes/Data/mnt/mynas/locaFS1 updated

automount: /System/Volumes/Data/mnt/mynas/locaFS2 updated

automount: no unmounts

MyImac:etc root# 


To verify if things are working:

Goto  /System/Volumes/Data/mnt/mynas/locaFS1  and see if you can see the remote NAS contents and its getting mounted

MyImac:etc root# cd /System/Volumes/Data/mnt/mynas/locaFS1

MyImac:etc root# ls


Issuing df -k command will should show you these that shows automount was able to mount your remote file system by just going into the above directory:    

map du30                                                 0          0          0   100%          0          0  100%   /System/Volumes/Data/mnt/mynas/locaFS1

map du30                                                 0          0          0   100%          0          0  100%   /System/Volumes/Data/mnt/mynas/locaFS2

//mynasuser@mynas.local/nasShareFS1            1870324040  765511232 1104812808    41%  765511230 1104812808   41%   /System/Volumes/Data/mnt/mynas/locaFS1







 

 

No comments:

Post a Comment