Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Mount AFP volumes from the terminal Network
This one's really handy.

First make a directory in /Volumes for the volume you wish to mount, say idisk, for example. You could mount it anywhere, but /Volumes is the logical spot for it:
sudo mkdir /Volumes/idisk
then mount the volume...
sudo mount -t afp afp://user:pass@idisk.mac.com/user /Volumes/idisk
That's it! To unmount, use the umount command:
sudo umount /Volumes/idisk
[Editor's note: This can be very useful when you connect remotely and then realize you need to put something on your iDisk.]
    •    
  • Currently 3.40 / 5
  You rated: 2 / 5 (5 votes cast)
 
[109,070 views]  

Mount AFP volumes from the terminal | 13 comments | Create New Account
Click here to return to the 'Mount AFP volumes from the terminal' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
btw:
Authored by: alpha on Dec 02, '01 03:32:45AM

apple implemented a mount script called "mount_afp" located in /sbin. sadly they got no man-page for it, so i cannot imagine what they mean with -o [option]...



[ Reply to This | # ]
btw:
Authored by: cjsnell on Dec 02, '01 10:30:11AM

mount_afs, mount_nfs, mount_ufs, etc. come from the BSD world. mount(1) is just a wrapper that calls one of these based on how you've set the '-t' flag. It's there for conveinence's sake.

Chris



[ Reply to This | # ]
Re: mount_afp
Authored by: Paul Burney on Dec 02, '01 10:30:48AM

mount_afp is a program launched by mount when specified witht the afp type. I'd suppose the options are the same as the mount options (for example, read-only access, etc.). From the man page for mount:

If the type is not one of the internally known types, mount will
attempt to execute a program in /sbin/mount_XXX where XXX is re-
placed by the type name. For example, nfs filesystems are mount-
ed by the program /sbin/mount_nfs.

HTH.



[ Reply to This | # ]
Re: mount_afp
Authored by: xylo on Dec 05, '10 06:24:04AM
You can use AutomountMaker

[ Reply to This | # ]
btw:
Authored by: cjsnell on Dec 02, '01 10:36:05AM

mount_afs, mount_nfs, mount_ufs, etc. come from the BSD world. mount(1) is just a wrapper that calls one of these based on how you've set the '-t' flag. It's there for conveinence's sake.

Chris



[ Reply to This | # ]
How does one make this show up in the finder
Authored by: eoberle on Dec 03, '01 03:13:13PM

This is a GREAT tip. The only problem I'm having with it is that it doesn't seem to allow the finder to 'see' the volumes. I have tried messing with the privleges and owner using chown and chmod, but nothing seems to allow me to view the file server in the finder and have it show up like a server would if I mounted it through the finder. Does anyone have any ideas on how to make this happen? I've tried various combinations of chown and chmod, but to no avail.

Thanks

Eric



[ Reply to This | # ]
How does one make this show up in the finder
Authored by: xil on Dec 04, '01 04:04:24AM

Run 'disktool -r' after mounting the AFP volume. This causes the Disk Arbitration system
to refresh its volume list, which then causes the Finder to update.



[ Reply to This | # ]
How does one make this show up in the finder
Authored by: eoberle on Dec 04, '01 03:53:31PM

Thanks to Xil for the missing piece!!! now I have a little script that rudimentarily allows me to mount my local server. Theoretically, this could be put in Startup items and run automatically, though I'm planning on adding some checking to make sure that the server is not already mounted. (Right now its blind setup and will give errors). At any rate, I thought I'd pass it on to anyone who might be interested. Basically, this is a perl script that can be created by naming it according to the server you attach to (mine is called 'homemount' .) So, copy the following, then go to the unix command line, type pico homemount, do a paste, change the variables appropriately, save and quit, do a 'chmod +x homemount' , and you should be able to load that server with one command. (since it is a bad idea to hard code your server password in, the program prompts you for that)

I'll repost later when I get around to adding in all the checking that probably should be here, but if anyone else wants to do it, I'd be grateful.

best,

Eric


script follows

#!/usr/bin/env perl
##script mounts server volumes
##all variables are right now defined statically, except server password
##which is passed as argument
##from unix command line
## mountserver.pl _serverpassword_
###
###

$server_pass=@ARGV[0];

$local_mount_point='/Volumes/server-drive';
$local_user='eric';
$local_group='admin';

$server_user="eric";
$server_mountpoint="/server";
$server_ip="10.0.2.5";
$server_volume="server";


system ("sudo mkdir $local_mount_point");
system ("sudo chown $local_user:$local_group $local_mount_point");
system ("chmod +rwx $local_mount_point");
system ("sudo mount -t afp afp://$server_user:$server_pass@$server_ip/$server_volume $local_mount_point");
system ("disktool -r");














[ Reply to This | # ]
How does one make this show up in the finder
Authored by: hagbard on Jan 16, '03 08:50:20AM

To add to this great hint, the above examples mount the remote volume as root, and as available to everyone.
Note that you don't have to do it this way.
For example, you could mount a remote volume that'd be only accessible by yourself.

here's how to do this with a directory called disk that's at the root of your home directory.

mkdir disk
mount -t afp afp://user:pass@ip.adress.server/volume_to_mount ~/disk

see how there is no sudo involved in the mount command.
Here, I get a few kextload warnings, but don't mind them.

PS the non-accessibility of ~/disk depends on the permission you've set to your home directory ;-)



[ Reply to This | # ]
Problem Mounting AFP volumes from the terminal
Authored by: robleach on Oct 17, '03 05:48:02PM
I have an airport network at home and I want to mount each other's disks on each computer so I can have the webserver on one dole out images from my pictures directory stored on the other computer. I found your tip and figured I'd found the solution. However, I got an error. The following is edited for privacy:
[dsl###-###-###:/home] robleach% sudo mount -t afp afp://me@###.###.###.###:/Volumes/remote_disk_name /home/remote_disk_name
Password:
kextload: /System/Library/Filesystems/AppleShare/asp_tcp.kext loaded successfully
kextload: /System/Library/Filesystems/AppleShare/asp_atp.kext loaded successfully
kextload: /System/Library/Filesystems/AppleShare/afpfs.kext loaded successfully
mount_afp: AFPMountURL returned error -1, errno is -50
[dsl###-###-###:/home] robleach% sudo mount -t afp afp://me:mypassword@###.###.###.###:/Volumes/remote_disk_name /home/remote_disk_name
kextload: extension /System/Library/Filesystems/AppleShare/asp_tcp.kext is already loaded
kextload: extension /System/Library/Filesystems/AppleShare/asp_atp.kext is already loaded
kextload: extension /System/Library/Filesystems/AppleShare/afpfs.kext is already loaded
mount_afp: AFPMountURL returned error -5019, errno is 2
Note, I get a different error depending on how I enter my password. I've mounted nfs volumes successfully on a different computer at work and never ran into this problem. Any ideas?

Thanks, Rob

[ Reply to This | # ]
Problem Mounting AFP volumes from the terminal
Authored by: ibicus on Sep 15, '06 08:26:28AM

I tested this hint to mount AFP Volumes of OS9 Mac via terminal:

% cd ~

% mkdir ~/afptemp

% mount_afp -i afp://at_node@xxx.xxx.xxx.xxx/Volume_name ~/afptemp

at the promt type password, no password type enter; then:

% cd ~/afptemp

% ls

you can see the files of Volume_name, to unmount:

% cd ..

% umount ~/afptemp

Attention: ~/afptemp will be deteted.

Example:

% mount_afp afp://pippo@192.168.0.25/Macintosh%20HD ~/afptemp

where "at_name" can be found with atlookup command:

% atlookup

ff94.f9.30 pippo:Multi-User Client
ff94.f9.04 pippo:Workstation
ff94.f9.04 pippo:ShareWayIP
ff94.f9.f8 pippo:AFPServer





[ Reply to This | # ]
Mount AFP volumes from the terminal
Authored by: nicolas-jullien on Jan 10, '08 02:13:58AM
One can mount into a user writable folder (like home folder)
mkdir ~/Volumes/iDisk
this way, sudo command (and password typing) is not necessary and it's easier to script ( => it's not interactive)

[ Reply to This | # ]
Mount AFP volumes from the terminal
Authored by: Sorcerer8605 on Aug 22, '08 04:07:36PM

I can't get any of this to work. It looks like it works (I don't get any errors or anything), but nothing shows up. No connections. :-(



[ Reply to This | # ]