Fast way to back up Time Machine on the Windows network for the first time

Keywords: Mac, Time Machine, Windows sharing, fast

If you have just migrated from PC to Mac (especially to a Mac Book), you must have an old PC that you seldom use, or you share the files to Mac. I have turned my old PC to a file server, just through basic Windows sharing. So I have been thinking why not backup my Time Machine in my file server? Therefore I don't have to plug-in a USB external drive every weekend. Here are some articles and really work(but not well...I'll tell why).


OSX Time Machine and Samba/Windows share
Time Machine Backup to Network Device for Mac

I followed the first guide and successfully started the Time Machine, but found it may take forever to finish the first backup (I used 802.11n to backup to my PC).

However, I know Time Capsule allows us to backup locally at first and then we can move the drive to the network. So, is there any similar way we can do on Windows share? Unfortunately Mac seems doesn't allow connecting to local shared directory. The only way I can think of is using virtual system like VMWare Fusion to share in the virtual machine. Mac will see the share as remote sharing.

I've paid 1 week's trial and error. It's not trivial, as Time Machine sometimes halts and there was nothing we could do but restart. Finally I found some tricks and successfully backed up to my Windows XP in VMWare. It tooks me just half a day to backup 114G's data.

Some things I have confirmed:
1. We sure can backup the Time Machine through Mac sharing(Netalk/AFP protocal) or Windows sharing(Samba/CIFS protocal). The backup format is different, so you cannot switch between after backup. Note that Mac sharing takes less hack (more reliablily and less complexity). However, you must have another Mac. I don't have it, so I focus on backing up into PC network. (If you have another Mac for backup, don't follow this post.)

2. I used NTFS format on PC. I guess it also works with FAT32 format, since Mac's sparsebundle is actually a directory with many small files in it.


How to:
Fist stage - preparation:
1. Run Windows on virtual machine, tune the network interface to Host-only(only sees the host) to prevent unwanted network transmission.

2. Connect backup external drive, create a backup folder, say TM, and share it (remember to alter the permission to allow read/write). Later on we'll let Time Machine backup all stuff in this folder.

3. Check the virtual machine's IP address by typing "ipconfig" in the command line. Say you get 192.168.1.5

4. Back to Mac, run Terminal, type "ping 192.168.1.5" and let it always there till backup done.
- This is to ensure the virtual machine does not halt and miss packets from the host.

Second stage - fist backup (I followed this post
and comment up to give more information)

1. Run Terminal and type:

defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

2. Mount the network share TM (Apple+K in Finder) for backup.
Note:
- The partition is recommended to have empty size twice the size of your data.

3. Get the Ethernet Address of your Mac. You can either do this through the Terminal and typing "ifconfig en0 | grep ether" to pull the address or by going to the System Profiler (About Mac --> More Info), clicking on Network, and then Ethernet.


4. Back to Terminal, type based on your situation:
sudo hdiutil create -size 199.5g -type SPARSEBUNDLE -nospotlight -volname "Time Machine" -fs HFS+J -verbose YourMacName_YourMacAddress.sparsebundle -tgtimagekey sparse-band-size=262144
Note:
- Do not use the GUI application Disk Utilities because you cannot specify "nospotlight" and "imagekey". Once my Time Machine halts backing up because the spotlight tries to index the shared drive. It's stupid.
- Do it locally. Even you specify to create a 199.5g image, this step will just create an image less than 500mb. You can move it to the network drive later.
- 199.5g: Change based on your empty size on network drive.
- YourMacName is your Mac's name. Some article says you should not use names longer than 8 characters.
- YourMacAddress is what you've got from previous step with no colon (12 characters).
- tgtimagekey: I'm not sure it raises your possibility to successful backup. Just try it.


5. After sparsebundle is generated, Mac automatically mount that image.

6. Unmount / Eject the image.

7. Move the .sparsebundle disk image file you created to your mounted network location.

8. Open up the time machine preferences, and click on "Choose Backup Disk".

9. Select your new disk image and then click on "Use for Backup".


10. Your Time Machine should start the initial backup process.
Note:
- You can hit "Back up now" in Time Machine's dropdown list on the status bar to start immediately.
- Never hit the X icon by the statusbar or hit "Stop Time Machine" to pause backup. Time Machine will restart from zero next time and never goes correctly. You have to start over from creating a new sparsebundle image.
- Leave the pinging terminal there until the bakcup process finishes. Do not run anything else in the virtual machine. Let it focuses on saving the packets to your external hard drive.
- Unfortunately, even I did everything right, the Time Machine still sometimes halts during backup. I guess the Time Machine is waiting for reply from the client but packets might have been lost. You can tell by opening up task manager in Windows, turning the networking page. If the networking graph shows flat zero, your Time Machine seems halts. This is what I do: put the Mac to sleep, and wake up. Time Machine will continue magically.
- Open Utilities => Activities Monitor. You can check the backup speed by turning to Disk Activity page at the bottom. The write speed should not be much less than read speed. (But my read speed is actually not high -- just 2-10mb/sec, sometimes dropped to kbs). If you find it too slow, do the magic step too - put Mac to sleep, and wake up.

Last Stage
1. Once done, you can move the external drive to your normal PC, share the TM folder again (remember to allow write permission).
2. Back to Mac. Mount the network share to TM. In Time Machine, hit "Select Disk" and choose the mounted network drive. Then you are done. Enjoy the mobile backup environment.

0 comments: