6

I need to mount at boot time the equivalent of the line command :

sudo mount -o rw,bg,hard,resvport,intr,noac,nfc,tcp mymachine:/var/logs /Volumes/logs

…and I have no idea about how to do it on Mac (OS X 10.9 Mavericks)

bash-3.2$ diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.1 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                  Apple_HFS HD                      499.2 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.1 GB   disk1
   1:                        EFI EFI                     209.7 MB   disk1s1
   2:                  Apple_HFS HD2                     499.8 GB   disk1s2
/dev/disk2
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     Apple_partition_scheme                        *668.2 MB   disk2
   1:        Apple_partition_map                         30.7 KB    disk2s1
   2:                  Apple_HFS OSXDocsetCD             668.1 MB   disk2s2
/dev/disk3
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     Apple_partition_scheme                        *477.6 MB   disk3
   1:        Apple_partition_map                         30.7 KB    disk3s1
   2:                  Apple_HFS DevToolsDocsetCD        477.6 MB   disk3s2
/dev/disk4
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     Apple_partition_scheme                        *596.2 MB   disk4
   1:        Apple_partition_map                         30.7 KB    disk4s1
   2:                  Apple_HFS iOSDocsetCD             596.1 MB   disk4s2
  • @Robuust - I added the information about diskutil above as I was not able to reply here ... I hope it is fine .. – Pippo Mar 3 '14 at 17:16
  • I'm not sure but this article might help you out: osxdaily.com/2012/05/04/… – Rob Mar 3 '14 at 17:20
2

Using autofs, as suggested by others is probably the way to go. Most of what follows works in El Capitan, which made auto mounting more difficult, but it should apply to Mavericks too. I do not have a Mavericks system to test.

In order to make this work edit /etc/auto_master and add the following line:

/- auto_nfs -nobrowse,nosuid

Then create a new file /etc/auto_nfs (with permissions 644) with the following content:

/../Volumes/logs -fstype=nfs,nrw,bg,hard,resvport,intr,noac,nfc,tcp mymachine:/var/logs

You have to add the /.. in front of the /Volumes, because Mac OS X (at least El Capitan will try to prevent you from mounting thing in /Volumes and /../Volumes is still /Volumes, it just tricks the filter. This might not be necessary for Mavericks)

Then start the auto mount daemon

sudo automount -cv

and you should see that the volume has been mounted (ls /Volumes/logs)

0

Open system preferences -> users and there you can choose login items

You can either save your command in a file: Open textedit Name the new file something.sh Make the first line: #!/bin/bash Then add your code run chmod +x on it add it to login items

Or I think you could drag the mounted drive into login items, I haven't tested it tho

  • 1
    This might work. Also, try Googling launchctl. – daviewales May 26 '14 at 8:16
-1

I think this is what you are looking for... https://developer.apple.com/library/mac/documentation/Darwin/Reference/Manpages/man5/auto_master.5.html

  • 1
    Please add more information on what your URL is pointing to. The URL might die, leaving your answer useless. – Rob Apr 23 '14 at 6:18
-1

Check out /etc/auto_master. There is an automount tool running for exactly this purpose. It seems to be disable on Yosemite, but you can just turn it on.

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .