Build TimeMachine backup service on FreeBSD10

Source: Internet
Author: User
Backblaze is an online storage service provider that publishes the StoragePod design details (StoragePod4.5) of their storage servers at intervals ), some third-party companies use this design to create some cheap storage servers for sale.

Backblaze is an online Storage service provider that publishes Storage Pod design details (Storage Pod 4.5) on their Storage servers at intervals ), some third-party companies use this design to create some cheap storage servers for sale.

I did not know whether I had purchased my mind in a hot spot. I had to regret it when I bought it and split it:

......

  • There is only one system disk. It is too dangerous to install the OS on one disk. At least dual hard disk RAID 1 should be used;
  • There is only one power supply, and the server system must be equipped with at least two available power supplies;
  • No hardware RAID. We do not plan to use RAID;
  • There are only two GigE NICs, And we purchased an additional two 10 GigE;
  • It is not convenient to open the box. to replace a hard disk, you need to remove more than 10 screws each time;
  • If no hard disk indicator is available, the hard disk cannot be quickly identified from 45 hard disks.

 

However, we don't have much requirements for this storage server, mainly for archiving and backup. It's not our primary backup, and we don't really care whether it's reliable or not. So let's use it together first. Two years ago, we mentioned "back up the Time Machine to FreeNAS". FreeNAS is a little bloated now. The official website requires a minimum of 8 GB memory and a minimum of 16 GB memory, we plan to use FreeBSD + ZFS directly this time.

ZFS preparation

The main reason we chose FreeBSD for backup is that the ZFS and ZFS operations are too convenient. Connect 30 hard disks to create a large storage pool called backup, using raidz2 (equivalent to RAID6 ):

# zpool create backup raidz2 /dev/da0 /dev/da1 /dev/da2 /dev/da3 /dev/da4 /dev/da5 /dev/da6 /dev/da7 /dev/da8 /dev/da9 /dev/da10 /dev/da11 /dev/da12 /dev/da13 /dev/da14 /dev/da15 /dev/da16 /dev/da17 /dev/da18 /dev/da19 /dev/da20 /dev/da21 /dev/da22 /dev/da23 /dev/da24/dev/da25 /dev/da26 /dev/da27 /dev/da28 /dev/da29

Create a file system timemachine in the pool. After the file system is created, it is automatically mounted. You do not need to manually mount it again:

# zfs create backup/timemachine# df -hFilesystem            Size    Used   Avail Capacity  Mounted on/dev/ada0p2           447G    2.3G    409G     1%    /devfs                 1.0K    1.0K      0B   100%    /devbackup                 31T    278K     31T     0%    /backupbackup/timemachine     31T    1.0G     31T     0%    /backup/timemachine

Each Mac/Time Machine user needs to add a corresponding account to the FreeBSD system and add the account to the timemachine group for unified management:

# pw useradd -n vpsee -s /bin/csh -m# passwd vpsee# pw groupadd timemachine# pw groupmod timemachine -m vpsee# pw groupshow timemachinetimemachine:*:1002:vpsee

Create a user directory under/backup/timemachine and grant the following permissions:

# mkdir /backup/timemachine/vpsee# chown vpsee:timemachine /backup/timemachine/vpsee# chmod 700 /backup/timemachine/vpsee# chmod 777 /backup/timemachine
Install and configure Netatalk

Netatalk is an open-source AFP (Apple File Protocol) File server that provides File sharing services for Mac OS X. Avahi is an open-source implementation of the Apple Zeroconf protocol. Similar to Bonjour, Avahi allows you to automatically discover your FreeBSD server in Mac systems. We directly use pkg to install the software package:

# pkg install netatalk3# pkg install nss_mdns# pkg install avahi

Modify nsswitch. conf:

# vi /etc/nsswitch.conf## nsswitch.conf(5) - name service switch configuration file# $FreeBSD: releng/10.2/etc/nsswitch.conf 224765 2011-08-10 20:52:02Z dougb $#...hosts: files dns mdns...

Configure afp:

# vi /usr/local/etc/afp.conf;; Netatalk 3.x configuration file;[Global]vol preset = default_for_all_vollog file = /var/log/netatalk.loglog level = default:infohosts allow = 172.20.0.0/23mimic model = TimeCapsule6,116disconnect time = 1[default_for_all_vol]file perm = 0640directory perm = 0750cnid scheme = dbd[TimeMachine]time machine = yespath=/backup/timemachine/$uvalid users = @timemachine#512 GB limitvol size limit = 512000

Start each service after Configuration:

# /usr/local/etc/rc.d/dbus onestart# /usr/local/etc/rc.d/avahi-daemon onestart# /usr/local/etc/rc.d/netatalk onestart

If it works well after the test, do not forget to add the service to the Startup file:

# vi /etc/rc.conf...zfs_enable="YES"dbus_enable="YES"avahi_daemon_enable="YES"avahi_dnsconfd_enable="YES"netatalk_enable="YES"...
Mac Configuration

Enable this option on Mac:

$ defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

Choose Finder> Go> Connect to Server... Enter FreeBSD's IP address (afp: // 192.168.2.201) and click Connect. After logging in with the created account and password, you will see the TimeMachine folder.

Choose System Preferences> Time Machine> On, select the TimeMachine folder, and click Use Disk.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.