-

How to: Configure FreeNAS 9.3 for Time Machine with disk quotas

Posted by aionman on Jul 21, 2016 in Mac, NAS

How to: Configure FreeNAS 9.3 for Time Machine with disk quotas

 

FreeNAS is an amazing software stack and purpose built for hosting dedicated file storage shares, so it makes for an excellent platform to host a Time Machine compatible network share for use with OS X.

I wanted to build a server that would provide a reliable backup location with data redundancy for multiple Macs, with the ability to scale the storage space to meet future needs. Something which the current line of Apple TimeCapsules don’t offer, not to mention they are expensive for what they offer.

This setup will allow any Mac on the local network to backup to a central server using Ethernet/Wireless. I have gone the extra mile and included the ability of being able to remotely backup my MacBook Pro when away in London to my FreeNAS server at home using my OpenVPN server, but that’s for another post.

To clarify this was my first time using FreeNAS, I had no prior experience with the platform before writing this guide, so anyone should be able to recreate my setup with no prior knowledge of FreeNAS. My post is an updated version of an existing article I found, but is also a result of my own trial and errors. It takes time to figure out what works and what doesn’t.

Hardware

For storage I picked up 4 x WD Red 3TB for NAS (Inc WD Express Warranty) for £91.99 each (£183.98 total). I picked the 3TB over the 4TB partly because of cost, but namely for reliability as numerous forums discuss high failure rates for the 4TB models.

I decided to utilise one of my G7 HP MicroServers as a dedicated FreeNAS server. The 2 WD Red drives were installed for storage, as well as a 32GB SanDisk Cruzer for the FreeNAS OS. I also maxed out the 16GB Kingston ECC RAM to help cope with the ZFS filesystems (the minimum recommended is 8GB).

Prerequisites


You need to have a working install of FreeNAS before you can attempt this guide. I won’t detail over the OS installation as it’s fairly simple and has been documented numerous times over online, without forgetting to mention the amazing documentation that comes with FreeNAS Doc.
FreeNAS 9.3 is the current release at time of writing and is what this guide is based on, although future versions should also work fine.

Create ‘time-machine’ Group

The first step is to create a system group for the Time-Machine share in preparation for adding users.
Under the ‘Account’ menu item, expand the ‘Groups’ item, then select ‘Add Group’. Note that in my screenshots I already have a group called ‘Time-Machine’, your system won’t have until you complete this step.

An ‘Add Group’ dialog box should pop up, prompting you to create the new group.

Set the config as follows:

  • Leave ‘Group ID’ to whatever it is by default
  • Set ‘Group Name’ to ‘time-machine’

Leave everything else as default and click OK. Our newly created ‘time-machine’ group should be visible under the ‘Groups’ section now.

Create and Configure Time-Machine ZFS Dataset

Now it’s time to create the ZFS dataset which will be used to store the Time Machine backups. You must have a ZFS volume already created for this step, if you haven’t got one then you should go read through the ZFS primer in the FreeNAS docs.

Under the ‘Storage’ tab select the ‘Volumes’ menu item, then select your ZFS volume (Volume1 in my case) and then select ‘Create Dataset’.

A ‘Create ZFS Dataset’ dialog box should pop up, prompting you to create the new ZFS dataset.

Ensure the wizard is in ‘Advanced Mode’ and then set the config as follows:

  • Set ‘Dataset Name’ to ‘Time-Machine’
  • Set ‘Quota for this dataset’ to ‘1000 GiB’

In the section option we are specifying a quota for the dataset, effectively settings the size of available disk space for our Time Machine backups. Change the value if 1000 GiB is not suitable for your setup.
Leave everything else as default and click ‘Add Dataset’. Our newly created ‘Time-Machine’ dataset should be visible under the ‘Volumes’ section now.

Now we need to configure the permissions for our ‘Time-Machine’ dataset, so that our ‘time-machine’ group has read/write access.
Select the dataset (Time-Machine) and then select ‘Change Permissions’.

A ‘Change Permissions’ dialog box should pop up, prompting you to edit the ZFS dataset.

Set the config as follows:

  • Set ‘Owner (group)’ to ‘time-machine’
  • Set ‘Mode’ checkboxes to the same as mine in the screenshot

Click ‘By setting the group owner to the ‘time-machine’ group, we are granting any users of that group read/write/execute permissions.

Create Time-Machine Users

Now it’s time to create a separate user to represent each computer that will use the FreeNAS server for Time Machine backups.
Under the ‘Account’ menu item, expand the ‘Users’ item, then select ‘Add User’.
FreeNAS Create User Dialog
Set the config as follows, but change the relevant information related to your setup:

  • Leave ‘User ID’ to whatever it is by default
  • Set ‘Username’ to ‘dans-macbook-pro’
  • Ensure ‘Create a new primary group’ is deselected
  • Set ‘Primary Group’ to ‘time-machine’
  • Set ‘Full Name’ to ‘Dan’s MacBook Pro’
  • Set ‘Password’ to something strong (mix of; uppercase, lowercase, numbers, 16 chars long)

Leave everything else as default and click OK. Our newly created ‘dans-macbook-pro’ should be visible under the ‘Users’ section now.

Create Time-Machine AFP Share

The last step on the FreeNAS server is to create the AFP Share that will broadcast the storage on the local network.
Under the ‘Sharing’ tab select the ‘Apple (AFP)’ menu item, and then select ‘Add Apple (AFP) Share’.

Ensure the wizard is in ‘Advanced Mode’ and then set the config as follows:

  • Set ‘Name’ to ‘Time Machine’
  • Set ‘Path’ to your ZFS dataset path
  • Set ‘Allow List’ to ‘@time-machine’
  • Ensure the ‘Time Machine’ box is checked
  • Ensure the ‘Default file permission’ is set to the same as the screenshot
  • Ensure the ‘Default directory permission’ is set to the same as the screenshot

Add Time Machine Backup to OS X

Finally the last step is to configure Time Machine itself to backup to the newly created share.
In OS X, select ‘Time Machine’ from within ‘System Preferences’, and then click the ‘Select Disk’ button.
Add FreeNAS to Time Machine in OS X Dialog
All being well your FreeNAS AFP share should be listed. If you select to use the disk for Time Machine you will be prompted to enter the username and password for the FreeNAS user we created previously. That’s the last step, Time Machine should begin backing up shortly after adding the disk. I recommend that the first backup be completed over Ethernet instead of wireless as the initial backup can take considerable time.

I have used this setup for a couple of years now backing up 4/5 Mac’s with no real issues. Any problems I have ran into have most revolved around sudden shutdowns of the FreeNAS server midway through Time Machine backing up due to power cuts/loss. My Storage is setup using ZFS in striped mirrored mode, meaning I get the best of both for speed and disk redundancy.

Please let me know if you found this guide useful, or spot any mistakes above.

 
-

Freenas: Plagued by name to sid deadlock errors?

Posted by aionman on Jul 9, 2015 in Linux, NAS, Networking

And here are the permissions as seen on Windows. I have Account Unknown, where probably I want it to recognize it as something like jnewsome (Unix User\jnewsome).  And the Freenas console shows something like

“STATUS=deamon on ‘winbindd’ finsihed starting up and ready to serve connectionssam_sids_to_names: possible deadlock – trying to lookup SID S-XXXXXX”

[​IMG]

Solution:

service samba_server stop
sqlite3 /data/freenas-v1.db ‘update services_cifs set cifs_SID=”S-1-5-21-1590911872-798304854-2854342261″‘
service ix-pre-samba start
service samba_server start

 

[root@freenas] ~# net groupmap list
users (S-1-5-21-1590911872-798304854-2854342261-1001) -> users
[root@freenas] ~# net groupmap delete sid=”S-1-5-21-1590911872-798304854-2854342261-1001″
Sucessfully removed S-1-5-21-1170145438-4009580803-3350505473-1001 from the mapping db
[root@freenas] ~# net groupmap add unixgroup=users rid=1001
Successfully added group users to the mapping db as a domain group​

And also try this

  1. fetch “http://download.freenas.org/errata/fixsid.py” -o /usr/local/bin/fixsid.py
  2. chmod 755 /usr/local/bin/fixsid.py
  3. mount -urw /
  4. hash -r
  5. fixsid.py
  6. Run the commands the script says to after completion or reboot

 
-

How to install Plex Media Server 0.9.7.17 on CentOS / Fedora / RHEL

Posted by aionman on Mar 24, 2013 in CentOS, NAS, Others

In an earlier post we covered installing Plex Media Server 0.9.6.3 on a Windows 7 system. In this post we’ll cover how to install and configure on a Linux system, CentOS 6.2 to be exact, but this process can be used on Fedora / and RHEL as well.

First make sure you meet the system requirements.

System Requirements:

  • 1.6 GHz processor (2.4 GHz dual core for 1080p transcoding).
  • 256 MB RAM
  • Gigabit Ethernet recommended for HD streaming.
  • N.B. Flash and Silverlight video playback is not supported on Linux.

Installation is very simple. It is just a matter of adding the repo to the server and importing the key.

Create the plex.repo definition in /etc/yum.repos.d with the following contents.

[PlexRepo]
name=PlexRepo
baseurl=http://plexapp.com/rpmrepo/release/$basearch/
enabled=1
gpgcheck=1

Import the GPG key

$ rpm --import http://plexapp.com/plex_pub_key.pub

Then install it with this command:

$ yum install plexmediaserver

Now start the Plex Media Server

$ /etc/init.d/plexmediaserver start

Once the startup is completed open a browser and goto http://localhost (or systems ip):32400/manage/index.html

Click on any of the Add Media to you Library icons to add your content for the devices to see. Change preferences from the many options available.

 
-

FreeNAS Expand / Resize disk

Posted by aionman on Sep 18, 2012 in NAS

Expand/resize a single disk.

FreeNAS machine is running on VMware ESXi (the VMware VMFS volumes are configured on RAID-disks, so the FreeNAS does not need to be configured for RAID anymore).

After you have setup a FreeNAS machine with a single-data-disk and want to expand/resize it later on, this is how I managed it.
I have an 20GB disk resized to 40GB.

Shut down the FreeNAS-guest and resize the data-disk with in VMware.

After booting up the FreeNAS-guest, open a console session.

zpool list sataC_1
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
sataC_1 17.9G 4.64G 13.2G 25% ONLINE –

zpool status sataC_1
pool: sataC_1
state: ONLINE
scrub: scrub completed after 0h0m with 0 errors on Tue Aug 16 10:50:18 2011
config:

NAME STATE READ WRITE CKSUM
sataC_1 ONLINE 0 0 0
gpt/da1 ONLINE 0 0 0

errors: No known data errors

camcontrol readcap da1 -h
Device Size: 40 G, Block Length: 512 bytes

gpart show da1
=> 34 41942973 da1 GPT (40G) [CORRUPT]
34 94 – free – (47K)
128 4194304 1 freebsd-swap (2.0G)
4194432 37748575 2 freebsd-zfs (18G)

zpool export sataC_1

gpart status da1
Name Status Components
da1p1 CORRUPT da1
gpart recover da1
da1 recovered
gpart status da1
Name Status Components
da1p1 OK da1

gpart show da1
=> 34 83886013 da1 GPT (40G)
34 94 – free – (47K)
128 4194304 1 freebsd-swap (2.0G)
4194432 37748575 2 freebsd-zfs (18G)
41943007 41943040 – free – (20G)

Resize the second partition (index 2)
gpart resize -i 2 da1
da1p2 resized
# gpart show da1
=> 34 83886013 da1 GPT (40G)
34 94 – free – (47K)
128 4194304 1 freebsd-swap (2.0G)
4194432 79691615 2 freebsd-zfs (38G)

zpool import
pool: sataC_1
id: 699091794103901671
state: ONLINE
action: The pool can be imported using its name or numeric identifier.
config:

sataC_1 ONLINE
gpt/da1 ONLINE

zpool import sataC_1
zpool list sataC_1
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
sataC_1 17.9G 4.64G 13.2G 25% ONLINE –

🙁

#reboot

zpool list sataC_1
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
sataC_1 37.9G 4.64G 33.2G 12% ONLINE –

 
-

Openfiler snapshots

Posted by aionman on Sep 2, 2011 in NAS

For reference to others.  Here is a playback of my solution:
SYMPTOM: Volume named “share” I was not letting be remove it because it reported a snapshot exists.
PROBLEM: Their was a manual snapshot named “snap-manual” that was not reflected properly in the web interface.
RESOLUTION:
df -k           # To see the mountpoint
umount /mnt/snapshots/vg1/share/snap-manual
lvdisplay     # To see the logical volume assigned to the mount point, note the that will be used in the following
lvremove /dev/vg1/of.snapshot.share.snap-manual
nano /opt/openfiler/etc/snapshots.xml  # Removed content between <snapshots> and </snapshots> but not headings
nano /etc/fstab     # I commented out the mount point for the snapshot in question
# Go into web interface and remove volume as desired

Copyright © 2017 IT Support Blog All rights reserved. Theme by Laptop Geek.