Apple (AFP) Shares
Contents |
FreeNAS™ uses the Netatalk AFP server to share data with Apple systems. Configuring AFP shares is a multi-step process that requires you to create users and groups, set volume/dataset permissions, create your AFP share(s), configure the AFP service, then enable the AFP service in Services -> Control Services.
This section describes the configuration screen for creating the AFP share. It then provides configuration examples for guest access, backups with Time Machine, and connecting from a Mac OS X client.
If you click Sharing -> Apple (AFP) Shares -> Add Apple (AFP) Share, you will see the screen shown in Figure 7.1a:
Figure 7.1a: Creating an AFP Share
Table 7.1a summarizes the available options when creating an AFP share. Note that some settings are only available in Advanced Mode. Refer to Chapter 3. Setting up Netatalk for a more detailed explanation of the available options.
Once you press the OK button when creating the AFP share, a pop-up menu will ask "Would you like to enable this service?" Click Yes and Services -> Control Services will open and indicate whether or not the AFP service successfully started.
Table 7.1a: AFP Share Configuration Options
| Setting | Value | Description |
| Name | string | volume name that will appear in the Mac computer's "connect to server" dialog; limited to 27 characters and can not contain a period |
| Share Comment | string | optional |
| Path | browse button | browse to the volume/dataset to share |
| Share password | string | recommended; maximum of 8 characters |
| Share [Character Set] | string | only available in Advanced Mode; examples include UTF8 and ISO--8859-15 |
| Allow List | string | comma delimited list of allowed users and/or groups where groupname begins with a @ |
| Deny List | string | comma delimited list of denied users and/or groups where groupname begins with a @ |
| Read-only Access | string | comma delimited list of users and/or groups who only have read access where groupname begins with a @ |
| Read-write Access | string | comma delimited list of users and/or groups who have read and write access where groupname begins with a @ |
| Disk Discovery | check box | enable if there is no DNS record for the FreeNAS™ system |
| Disk discovery mode | drop-down menu | default or Time Machine (Apple's backup utility) |
| Database Path | string | by default, the CNID databases used by AFP are located the root of the volume |
| Cache CNID | checkbox | only available in Advanced Mode; if checked, AFP uses the ID information stored in AppleDouble header files to reduce database load; do not set this option if the volume is modified by non-AFP clients (e.g. NFS or CIFS) |
| Translate CR/LF | checkbox | if enabled, AFP will automatically convert Macintosh line breaks into Unix ones; some older programs store binary data files as type "TEXT" when saving and switch the file type in a second step and enabling this checkbox will break those files |
| Windows File Names | checkbox | forces filename restrictions imposed by older versions of Windows; it is NOT recommended for volumes mainly used by Macs as it breaks some the ability of some applications to save files (e.g. OfficeX) |
| No .AppleDouble | checkbox | creates .AppleDouble directories when a non-Mac client saves a file; should remain enabled if the network contains any Mac clients |
| Zero Device Numbers | checkbox | only available in Advanced Mode; enable when the device number is not constant across a reboot |
| Disable File ID | checkbox | only available in Advanced Mode; if enabled, AFP will not advertise createfileid, resolveid, and deleteid calls |
| Disable :hex Names | checkbox | only available in Advanced Mode; if this box is checked, AFP disables :hex translations for anything except dot files; this option makes the / character illegal |
| ProDOS | checkbox | only available in Advanced Mode; if checked, provides compatibility with Apple II clients |
| No Stat | checkbox | only available in Advanced Mode; if checked, AFP won't stat the volume path when enumerating the volumes list; useful for automounting or volumes created by a preexec script |
| AFP3 Unix Privs | checkbox | only available in Advanced Mode; do not enable if network contains Mac OS X 10.4 clients as they do not support this |
AFP supports guest logins, meaning that all of your Mac OS X users can access the AFP share without having to first create user accounts on the FreeNAS™ system or a ZFS dataset for each user. In this configuration example, the AFP share has been configured for guest access as follows:
1. A ZFS volume named /mnt/data has its permissions set to the nobody user account and the nobody group.
2. An AFP share with a Name of freenas has been created with a Path of /mnt/data, a Share Password has been set, the Allow List is set to nobody and Read-write Access has been set to nobody. The Disk Discovery checkbox has been checked and the IP address of the FreeNAS™ system is 192.168.2.2.
3. The Services -> AFP has been configured as follows: Server Name is freenas, the Guest Access checkbox is checked, nobody is selected in the Guest account drop-down menu, and the Local Access checkbox is unchecked.
Once the AFP service has been started in Services -> Control Services, Mac OS X users can connect to the AFP share by clicking Go -> Connect to Server. In the example shown in Figure 7.1b, the user has input afp: followed by the IP address of the FreeNAS™ system.
Figure 7.1b: Connect to Server Dialog
Click the Connect button and a login box, seen in Figure 7.1c, will appear. Since a password has been configured for this AFP share, the user must input the share password (i.e. not their own password).
Figure 7.1c: Authenticating to the AFP Share
Once connected, Finder will automatically open. The name of the AFP share will be displayed in the SHARED section in the left frame and the contents of the share will be displayed in the right frame. In the example shown in Figure 7.1d, /mnt/data has one folder named images. The user can now copy files to and from the share.
Figure 7.1d: Viewing the Contents of the Share From a Mac System
To disconnect from the volume, click the eject button in the Shared sidebar.
Using Time Machine
Mac OS X includes Time Machine which can be used to schedule automatic backups. In this configuration example, Time Machine will be configured to backup to an AFP share on a FreeNAS™ system. To configure the AFP share on the FreeNAS™ system:
1. A ZFS dataset named /mnt/data/backup_user1 with a quota of 60G was created in Storage -> Create ZFS Dataset.
2. A user account was created as follows: Username of user1, Primary Group ID was left empty, Home Directory of /mnt/data/backup_user1, and the Full Name, E-mail, and Password fields were set. The Username and Password of the created account match the values on the Mac OS X system.
3. An AFP share with a Name of backup_user1 has been created with a Path of /mnt/data/backup_user1, the Allow List is set to user1 and Read-write Access has been set to user1. The Disk Discovery checkbox has been checked, the Disk Discovery mode is set to Time Machine and the IP address of the FreeNAS™ system is 192.168.2.2.
4. Services -> AFP has been configured as follows: Server Name is freenas, the Guest Access checkbox is unchecked, and the Local Access checkbox is checked.
5. The AFP service has been started in Services -> Control Services.
To configure Time Machine on the Mac OS X client, go to System Preferences -> Time Machine which will open the screen shown in Figure 7.1e. Click ON and a pop-up menu should show the FreeNAS™ system as a backup option. In our example, it is listed as backup_user1 on "freenas". Highlight the entry representing the FreeNAS™ system and click the Use Backup Disk button. A connection bar will open and will prompt you for the user account's password--in this example, the password for the user1 account.
Figure 7.1e: Configuring Time Machine on Mac OS X Lion
Time Machine will create a full backup after waiting two minutes. It will then create a one hour incremental backup for the next 24 hours, and then one backup each day, each week and each month. Since the oldest backups are deleted when the ZFS dataset becomes full, make sure that the quota size you set is sufficient to hold the backups. Note that a default installation of Mac OS X is ~21GB in size.
If you receive a "Time Machine could not complete the backup. The backup disk image could not be created (error 45)" error when backing up to the FreeNAS™ system, you will need to create a sparsebundle image using these instructions.




