![]() |
For those of you running Leopard, you can use your NSLU2 as a backup drive for Time Machine, effectively making a "Time Capsule". Unfortunately there is a little bit of work required to get it going, but once it is set up it runs pretty well. UPDATE: Read the additional section on AFP (Apple Filing Protocol). Running Time Machine backups over AFP seems to work a lot better than over Samba (SMB). UPDATE Again: There are some issues with the sparsebundle on Snow Leopard (10.6.x). My Time Machine continued working after an upgrade from Leopard to Snow Leopard, but when trying to set this up from scratch on Snow Leopard, it did not work. See http://www.macosxhints.com/article.php?story=20090905212640957(approve sites) for information on how to get this working on Snow Leopard. I am running Unslung 6.10. I'd imagine that this would work on just about any of the possible OS choices out there, even the stock Linksys firmware, but I haven't tested it, so YMMV. Basic Setup with Samba (SMB)The first step is to gather information about your system that we will need later:
For example,
"MacBook_001a45bc231a" The next step is to create a disk image to use for the backups, which will be created on your mac and then moved later to your NSLU2 disk:
hdiutil create -size 140g -fs HFS+J -volname "Backup Drive" MacBook_001a45bc231a.sparsebundle The final step is to copy the sparsebundle to your NAS and configure Time Machine:
defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
Advanced Setup with Samba (SMB)This hint is for more advanced users of Samba. If you're not comfortable with the theory and instructions below, take a look at the next section, "Alternate Setup with AFP (Apple Filing Protocol)". As noted in GettingStartedWithSamba in the "Transfer Speeds with Many Files in the Same Directory" section, Samba is very slow when you have many files in the same directory. This is what Time Machine does, so Time Machine backups are very slow. There is a way to speed things up: turn off case sensitivity in Samba, and rename all your files to be upper- or lower-case. For instructions and more info, see http://www.samba.org/samba/docs/man/Samba-Guide/HA.html#id403899 You need to be running OpenSlug, or Unslung, or anything that's not the stock firmware. To do this for your Time Machine share, try the following:
OK, so now we have your first backup! It's slow, but we know that it works. Here's how to speed things up:
So, how does it work? Here's how:
Alternate Setup with AFP (Apple Filing Protocol)I've found that Time Machine backups work much better over AFP. They run much faster and appear to be a little more reliable and tolerant to interruptions (like putting the computer to sleep). So if you have an unslung box, I'd recommend going this route. For my setup, I don't configure any user security. Some forums mention difficulties with getting user security to work with the NSLU2 and since my setup doesn't require it, I didn't try it. These instructions are for Unslung 6.10, but I'd imagine they apply to most distributions other than the stock linksys firmware.
ipkg install netatalk
/share/flash/data/public "Time Machine"
"Time Capsule" -uamlist uams_guest.so
* Create or edit /unslung/rc.local in your favorite editor
* At a minimum have the following lines in your file:
#!/bin/sh # Start afpd /opt/sbin/afpd return 1 * Make the file executable by running
chmod 755 /unslung/rc.local Reboot, and AFP should be running. Place your sparsebundle file in the shared directory, and follow the remaining directions in the "Basic Setup with Samba" section. Supplement for Plug ComputersUPDATE: SlugOS users should create a symbolic link (ln -s) from the start files from /opt/etc/init.d/ to /etc/rc3.d/ for the files to be executed on boot. This supplement should work for most plug computers (Pogoplug V1, V2, Pro, Biz, Dockstars, etc.). Please see warnings in Optware installation since it pertains to this. It is based on the work of Seongbae and the above articles. What you end up with is a network time machine which appears to be quite authentic (like a Time Capsule) since it uses Avahi so the drive will show up in the sidebar. This will not work with a root password to log into the Time Machine. "ipkg install netatalk" We need to set up some users and groups. If I use a group or user number that is used, choose another one. You can verify with "cat /etc/passwd" or "cat /etc/group". "addgroup -g 84 avahi" We will use afppasswd to create an afp password for someusername for authentication. The utility afppasswd checks /etc/passwd to make sure that the username you use exists. If there is no afppasswd file in /opt/etc/netatalk, afppasswd will error out. "cd /opt/etc/netatalk" If you want to use your OSX username which probably contains spaces. You can do this by using quotes (adduser "Some User Name" and afppasswd "Some User Name"). "/tmp/timemachine "Time Machine" options:tm" Unlike the preceding section, do not edit the afpd.conf. In fact make sure that there are no functional lines and everything is commented. The authentication will default correctly. "cd /opt/etc/dbus-1/system.d/" Verify that the "/opt/etc/dbus-1/system.d/avahi-dbus.conf" file exists and contains: <!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> <busconfig> <!-- Only root or user avahi can own the Avahi service --> <policy user="avahi"> <allow own="org.freedesktop.Avahi"/> </policy> <policy user="root"> <allow own="org.freedesktop.Avahi"/> </policy> <!-- Allow anyone to invoke methods on Avahi server, except SetHostName --> <policy context="default"> <allow send_destination="org.freedesktop.Avahi"/> <allow receive_sender="org.freedesktop.Avahi"/> <deny send_interface="org.freedesktop.Avahi.Server" send_member="SetHostName"/> </policy> <!-- Allow everything, including access to SetHostName to users of the group "netdev" <policy group="netdev"> <allow send_destination="org.freedesktop.Avahi"/> <allow receive_sender="org.freedesktop.Avahi"/> </policy> --> </busconfig> We will now change to "/opt/etc/avahi/services/" directory and create an afpd.service file which should contain: <?xml version="1.0" standalone='no'?><!--*-nxml-*--> <!DOCTYPE service-group SYSTEM "avahi-service.dtd"> <service-group> <name replace-wildcards="yes">%h</name> <service> <type>_afpovertcp._tcp</type> <port>548</port> </service> <service> <type>_device-info._tcp</type> <port>0</port> <txt-record>model=Xserve</txt-record> </service> </service-group> We need to edit "/opt/etc/avahi/avahi-daemon.conf" and add an entry for "host-name=PlugTime", where PlugTime is whatever you choose to name your Time Machine host plug (try to make it different from your current hostname - "uname -n"). Uncomment "enable-dbus=yes". shut_it_down()
{
echo -n "Stopping $DESC: "
if [ -e $PIDFILE ]; then
PIDNUM=`cat $PIDFILE`
rm -f $PIDFILE
kill $PIDNUM
else
killall ${DAEMON}
fi
echo "$NAME."
rm -f $PIDFILE
}Create this start file "S52avahi" for avahi: #!/bin/sh #start avahi-daemon /opt/sbin/avahi-daemon -D return 1 Create this start file "S81afpd" for afpd: #!/bin/sh # Start afpd /opt/sbin/afpd return 1 Create a script "mount_tm" (based on Openpogo mount_opt) in "/opt/sbin" to mount the proper drive in "/tmp/timemachine", give it full access, and run the scripts. If you want to use a journaled file system drive, substitute ext3 for the ext2. Of course making sure that your drive is ext2 or ext3 correspondingly: #!/bin/bash
#
mkdir /tmp/timemachine
mount -t ext2 -o rw,nosuid,nodev,exec,noatime,sync /dev/sda1 /tmp/timemachine
if [ ! -f /tmp/timemachine/.com.apple.timemachine.supported ]
then
{
umount /tmp/timemachine
mount -t ext2 -o rw,nosuid,nodev,exec,noatime,sync /dev/sdb1 /tmp/timemachine
if [ ! -f /tmp/timemachine/.com.apple.timemachine.supported ]
then
{
umount /tmp/timemachine
mount -t ext2 -o rw,nosuid,nodev,exec,noatime,sync /dev/sdc1 /tmp/timemachine
if [ ! -f /tmp/timemachine/.com.apple.timemachine.supported ]
then
{
umount /tmp/timemachine
mount -t ext2 -o rw,nosuid,nodev,exec,noatime,sync /dev/sdd1 /tmp/timemachine
if [ ! -f /tmp/timemachine/.com.apple.timemachine.supported ]
then
{
umount /tmp/timemachine
}
else
{
umount /tmp/.cemnt/mnt_sdd1
}
fi
}
else
{
umount /tmp/.cemnt/mnt_sdc1
}
fi
}
else
{
umount /tmp/.cemnt/mnt_sdb1
}
fi
}
else
{
umount /tmp/.cemnt/mnt_sda1
}
fi
/bin/chmod 777 /tmp/timemachine
rm -f /opt/var/run/dbus/pid
/opt/etc/init.d/S20dbus start
/opt/etc/init.d/S52avahi
/opt/etc/init.d/S81afpdOn all the scripts, make sure to set the permissions so that they are executable with "chmod 755 scriptname" where scriptname is the name of the script. You can then include "mount_tm" in the "/etc/init.d/rcS" start up script so that it will be executed on start up. When you shut down your plug computer or reboot, it would probably be a good idea to kill the processes and umount the drive. How To Restore To New DiskThis howto is great, but it was lacking a section on how to do a restore to a brand new drive. This section isn't needed if you are just restoring an old copy of a file to an already running system, but if your HDD crashed (like mine did!), you have to do a few special steps to be able to restore from your time machine. After you have replaced the faulty hardware and have booted your mac from the install disk, you will be at a menu that lets you do a few basic things (disk util, terminal, etc...). Before selecting to restore from a time machine, you have to manually mount the time machine volume since its not a locally attached volume. Make sure you are connected to the network. If you are using wired network, the install disk has likely already obtained a DHCP IP and you are good. If you choose to go the (slower) wireless route, connect using the wireless icon at the top right of the screen, then proceed below. The following commands assume you used the AFP method above. I haven't tried, but switching the mount command to mount an smb volume should be all that's needed if you used smb instead. Start a terminal section by selecting Terminal from the tools menu.
And thats it! Exit out of terminal, and select restore from time machine and it should detect your time machine backup disk created above. You will be asked to pick a destination volume, so make sure you have already partitioned your new disk. Happy restoring!
view ·
edit ·
print ·
history ·
Last edited by Scheb.
Based on work by Scheb, OddballHero, Mike Machado, mkurtz, and Smee Jenkins. Originally by mkurtz. Page last modified on March 06, 2013, at 06:54 AM
|