I set a Mac to be backed up by our TSM server. There was an external AFP share mounted at /Volumes/Data. I wanted to back up that share, too. The problem was that, for some reason, the share got unmounted from time to time. My first attempt at solving the problem was to write a shell script to mount the AFP share. Then, I scheduled it to run before the backup job. This was not helpful either, because the share still frequently got unmounted.
I then tried many different approaches and found that this one worked pretty well. The idea is to edit the /etc/fstab file to specify the mount information so the automount service can mount the share whenever it is being accessed. Here are the steps:
- Open Terminal application.
- Type sudo nano /etc/fstab to edit the file.
- Add this line.
host_name:/share_name /Volumes/mount_name url automounted,url==afp://user_name:password@host_name/share_name 0 0
- Press Ctrl + x to save the file and exit out.
- Type automount -vc to restart automount.
If you want to mount a cifs share, just change afp to cifs. This is one example using cifs.
host_name:/share_name /Volumes/mount_name url automounted,url==cifs://user_name:password@host_name/share_name 0 0
Note that the host_name must resolve to the actual IP address of the host computer. You could modify /etc/hosts to add the host_name to it if the host_name cannot be resolved by the DNS server.
This post may contain affiliated links. When you click on the link and purchase a product, we receive a small commision to keep us running. Thanks.
Leave a Reply