Enabling Time Machine on D-Link DNS-320

Time Machine

Enabling Time Machine support on the D-Link DNS-320 is, surprisingly, a straight-forward task. Yes, you can use your own NAS (Network Attached Storage) for Time Machine backups instead of Apple Time Capsule. However, Time Machine seems to use all the available space (on the NAS) for backup purposes. So I started to explore how can I limit the amount of disk space used for Time Machine.

After getting my Apple iMac 27-inch recently from a computer show, I started to explore Time Machine  on Mac OS X (Snow Leopard). I managed to set up Time Machine to backup to my DNS-320 and, at the same time, limit the disk space used by Time Machine.

I’ve put together a short guide on configuring Time Machine to backup to the NAS. In my case, I am using the DNS-320 as the backup target, you might want to tweak the  guide slightly to suit your own needs.


What you will need

  1. A fun_plugged D-Link DNS-320
  2. A Mac
  3. Some free space (on the DNS-320) for Time Machine backup


Configuration summary

  1. Enabling AFP support on the NAS
  2. Testing (default) Time Machine backup to DNS-320’s Volume_1
  3. Creating a sparsebundle with specific disk size
  4. Editing the sparsebundle
  5. Uploading the edited sparsebundle file back to the NAS


Enabling AFP support on the NAS

In this section, we will enable the Apple Filing Protocol (AFP) on the NAS, which in my case is a D-Link DNS-320. CIFS works too (the default network share settings) but I think Mac are more optimized for AFP.

  1. Login to your DNS-320’s web administration page
  2. Navigate to Management –> Application Management –> AFP Service
  3. Under the AFP Service Setting, select Enable
  4. Click on the “Save Settings” button

AFP is enabled by default for network shares (DNS-320 firmware version 2.00)


Testing Time Machine backup to DNS-320’s Volume_1

Before you proceed. Ensure that you are able to read and write to the DNS-320’s Volume_1. You can verify it by:

  1. Navigate to Applications –> Utilities –> Terminal
    A terminal window should launch
  2. Type the command “defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1” without the quotes
  3. Launching Finder
  4. Press ⌘ + k
    A Connect to Server prompt should appear 

    Using Finder to connect to network share

  5. Browse to your DNS-320 or simply specify “afp://<DNS-320’s IP address>/Volume_1” without the quotes. You should replace <DNS-320’s IP address> with its LAN IP address and Volume_1 with your network share name if you are not intending to use Volume_1
  6. Press the “Connect” button
    The network share, Volume_1, on DNS-320 should appear
  7. Test read & write by creating a new folder in the network share

After verifying that you are able to write to the network share. Try if Time Machine is able to use your NAS as a backup disk

  1. Navigate to System Preferences –> Time Machine
    Time Machine preference should launch 

    Time Machine

  2. Click on the “Select Disk…” button
    A disk selection prompt should appear 

    Time Machine - Using Network share for Time Machine backup

  3. Select the network share you connected to earlier
  4. Click on the “Use for Backup” button
  5. Force a backup by selecting “Back Up Now” from the Time Machine icon on the menu bar

If you look at your network share, a new file in the format <computer name>.sparsebundle should be created. This sparsebundle file allows Time Machine to use all the available free space on your NAS. We will need this sparsebundle image for the later section, don’t remove it.

Pause the Time Machine temporarily by switching it to the Off state while we do the rest of this guide.


Creating a fixed-size sparsebundle for Time Machine backups

In this section, we will be creating a 256GB sparsebundle file for Time Machine backup. First locate your computer name, you can find it by navigating to System Preferences… –> Sharing. After getting your computer name, we will create a fixed size sparsebundle image on your Desktop:

  1. Navigate to Applications –> Utilities –> Terminal
    A terminal window should launch
  2. In the terminal window, type “cd Desktop” without the quotes
  3. In the terminal window, type “hdiutil create -size 256G -fs HFS+J -volname “Time Machine Backups” -type SPARSEBUNDLE <computer name>.sparsebundle” without the quotes and replacing <computer name> with your computer name
    The <computer name>sparsebundle file should appear on your desktop

Great! What’s left now is to edit the sparsebundle image!


Editing the sparsebundle(s)

Remember the sparsebundle image on your NAS? Navigate to the network share that contains the sparsebundle (hint: you can use ⌘ + k in Finder). We will need to

  1. Navigate  the network share containing the sparsebundle created by Time Machine
  2. Right-click on the <computer name>.sparsebundle and select “Show Package Contents”
    A new Finder window should appear 

    Editing the sparsebundle file

  3. Copy the file “com.apple.TimeMachine.MachineID.plist” onto your Desktop
    You should have a new file com.apple.TimeMachine.MachineID.plist
  4. Close the Finder window
  5. From your desktop, right-click on the <computer name>.sparsebundle and select “Show Package Contents”
    A new Finder window should appear
  6. Copy the “com.apple.TimeMachine.MachineID.plist” on your Desktop into the Finder window. It means that, you copy the “com.apple.TimeMachine.MachineID.plist” file into the <computer name>.sparsebundle
  7. Right-click on “Info.bckup” and select “Get Info”
    A new window named “Info.bckup Info” should appear
  8. Under the “Sharing & Permissions” section, change the Privilege of “everyone” to “Read Only”
  9. Close the “Info.bckup Info” window
  10. Right-click on “Info.plist” and select “Get Info”
    A new window named “Info.plist Info” should appear
  11. Under the “Sharing & Permissions” section, change the Privilege of “everyone” to “Read Only”
  12. Close the “Info.plist Info” window
  13. Close the <computer name>.sparsebundle Finder window

You are almost there! Hang on!


Uploading the edited sparsebundle file back to the NAS

In this section, we are replacing the <computer name>.sparsebundle file on your NAS with the one on your Desktop.

  1. Navigate to the network share containing the <computer name>.sparsebundle. (hint: you can use ⌘ + k in Finder)
  2. Copy the Desktop’s <computer name>.sparsebundle file onto the network share, replacing the one on the NAS

After you have finished copying the edited file, do the following:

  1. Telnet/SSH to your DNS-320
  2. Navigate to the folder containing the sparsebundle image
  3. Navigate into the spasebundle image by typing “cd <computer name>.sparsebundle” without the quotes and replacing <computer name> with your computer name
  4. Change the permission of the Info.* files by typing “chmod 555 Info.*” without the quotes
  5. Close the telnet/SSH window

Turn on Time Machine! Time Machine backups will be capped at the size you have defined. If you check the console logs, you will notice that Time Machine throws an error as it attempts to resize the sparsebundle to your NAS’s max free capacity. It is perfectly normal.

Now you have got a fixed-size Time Machine backup on your NAS.


Checking whether you did it correctly


You can check whether you created a fixed size sparsebundle image. The console messages should reflect that Time Machine (backupd) “Could not resize backup disk image (DIHLResizeImage returned 13)”.

To check, simply do the following:

  1. Navigate to Applications –> Utilities –> Console
  2. From the top navigation bar, click on “Show Log List”
  3. On the left menu bar, select “All Messages”
  4. In the Filter, type “backupd” without the quotes
  5. Look for the message “Could not resize backup disk image (DIHLResizeImage returned 13)”

Using Console to check on Time Machine

If you see the message “Could not resize backup disk image (DIHLResizeImage returned 13)”, it means that Time Machine failed to resize the sparsebundle image. You have successfully limited Time Machine backups to a fixed size image!


Treat shadowandy!

If these step-by-step guides have been very helpful to you and saved you a lot of time, please consider treating shadowandy to a cup of Starbucks.  

  • Richard

    just nice hehe my mbp is coming soon

  • Ben

    Hi, thank you for this guide. I’ve a problem just at the beginning : when I try to connect to the server (with the cmd+K key), writing the address afp://IP, it says there’s no sharing or I’m not allowed to reach the server…. I can’t understand how I can get this ?

  • shadowandy


    Try hitting the “Browse” button to browse to the correct network share instead. You might not have enable afp on your NAS

  • Kenneth Bonde

    Thanks for making this step by step manual. In finder I have access to the DNS-320 and can read and write to the volume. Fine !

    In time machine I have selected the NAS for backup, but when time machine
    runs it’s generates an error
    The backup disk image “/Volumes/Volume_1-1/xxxxxx.sparsebundle” could not be created (error 45).

    Any help appreciated 🙂

  • shadowandy

    Hi Kenneth Bonde,

    Try if you are able to write to the network share. After doing the ⌘ + k & browsing to the network share, try to create a folder. If you are not able to do so, make sure your user account have read & write access to it.

  • Kenneth Bonde

    No problems in finder, can read, write and delete files and folders. It’s only time machine that’s having problems. When time machine runs I can see that it create the file xxxxxx.sparsebundle, and then after a few seconds the error message is displayed.

  • shadowandy

    Kenneth Bonde,

    Try looking at the Console logs to see what errors did Time Machine encounter.

    1. Navigate to Applications –> Utilities –> Console
    2. From the top navigation bar, click on “Show Log List”
    3. On the left menu bar, select “All Messages”
    4. In the Filter, type “backupd” without the quotes

    Try looking through the logs to see if it encountered any issues.

  • Kenneth Bonde

    Here are the latest log:
    02/07/11 15.21.36 com.apple.backupd[43354] Starting standard backup
    02/07/11 15.21.51 com.apple.backupd[43354] Attempting to mount network destination using URL: smb:[email protected]_smb._tcp.local/Volume_1
    02/07/11 15.21.51 com.apple.backupd[43354] Mounted network destination using URL: smb:[email protected]_smb._tcp.local/Volume_1
    02/07/11 15.21.51 com.apple.backupd[43354] Creating disk image /Volumes/Volume_1-1/Kenneth Bonde MacBookPro (3).sparsebundle
    02/07/11 15.22.41 com.apple.backupd[43354] Error 45 creating backup disk image
    02/07/11 15.22.41 com.apple.backupd[43354] Failed to create disk image /Volumes/Volume_1-1/Kenneth Bonde MacBookPro (3).sparsebundle, status: 45
    02/07/11 15.22.46 com.apple.backupd[43354] Backup failed with error: 20
    02/07/11 15.22.46 com.apple.backupd[43354] Ejected Time Machine network volume.

  • shadowandy

    Hi Kenneth Bonde,

    Have you defined a “Computer Name” for your MBP?

    System Preference –> Sharing –> Computer Name

  • Ben

    Hi, I don’t know what happened this last hours, but I didn’t change any setting of my NAS or Internet connection… but suddenly it asked me to log again (what it did just the first time before, and then no asking but just telling me I couldn’t connect), so I logged not with the admin user (didn’t want to have it not working again !), but with another user I created and it worked!
    Do you know why I can’t reach the FTP with the admin user, but I can with another user? Seems wired to me…

    Anyway, thank you again… once the copy of my disk is done with Time Machine (maybe in 2 days…… that’s quite long and slow apparently for a 500GB HD!) I’ll come over again to see the end of the guide!

  • Kenneth Bonde

    “Kenneth Bonde MacBookPro”

  • Kenneth Bonde

    Got it to work when enabling “timemachine” under Application > local backup > timemachine

  • Edward

    Shadowandy, thanks for the guide. However I was not successful in getting Time machine backup file to its fixed size as it seems from the log, it never shows that it fails to resize. Any ideas? Much appreciated.

    7/3/11 PM 11:31:52 com.apple.backupd[1051] Warning: Destination /Volumes/Time-Machine-1 does not support TM Lock Stealing
    7/3/11 PM 11:31:52 com.apple.backupd[1051] Warning: Destination /Volumes/Time-Machine-1 does not support Server Reply Cache
    7/3/11 PM 11:31:53 com.apple.backupd[1051] Resizing backup disk image from 512.0 GB to 1830.6 GB
    7/3/11 PM 11:34:45 com.apple.backupd[1051] QUICKCHECK ONLY; FILESYSTEM CLEAN
    7/3/11 PM 11:34:47 com.apple.backupd[1051] Disk image /Volumes/Time-Machine-1/Edwards-iMac.sparsebundle mounted at: /Volumes/Time Machine Backups
    7/3/11 PM 11:34:47 com.apple.backupd[1051] Backing up to: /Volumes/Time Machine Backups/Backups.backupdb
    7/3/11 PM 11:34:49 com.apple.backupd[1051] Backup content size: 208.6 GB excluded items size: 3.9 GB for volume Macintosh HD
    7/3/11 PM 11:34:49 com.apple.backupd[1051] No pre-backup thinning needed: 245.74 GB requested (including padding), 1.79 TB available
    7/3/11 PM 11:34:49 com.apple.backupd[1051] Waiting for index to be ready (101)
    7/3/11 PM 11:34:49 mds[34] (Normal) DiskStore: Creating index for /Volumes/Time Machine Backups/Backups.backupdb

  • shadowandy


    You familiar with telnet on the DNS-320 (you need to fun_plug the DNS-320 first).

    First repeat the section on “editing your sparsebundle(s)” then:

    1. Use telnet to navigate to your sparsebundle file
    2. “cd” into the sparsebundle (it is basically a directory)
    3. “chmod 755 Info.*”

    Then try again to see if it works

  • Edward

    Shadowandy, I finally got fun plug installed and do the chmod. From the log it never show logs on fail to resize but it seems to be working from the message below as I create an image for 512GB while I have 1.9TB:

    7/6/11 PM 08:34:39 com.apple.backupd[1327] No pre-backup thinning needed: 250.82 GB requested (including padding), 511.25 GB available

    What do you think? I suppose the only way to find out is to wait to see whether the file grows beyond 512GB?

  • Shadowandy, I have two questions:

    1) When TM throws an error, does it stop, waiting for user input? or does it carry on with the backup? i.e. Other than the error in the log file, there is no change in the way it works.

    2) When the sparse bundle size limit is reached, what happens then? Is it similar to when the disk is full and it starts to delete old files? At that point is there anything stopping us from re-sizing the sparse bundle to suit our needs?


  • Ben

    Hi, so everything works for me, with another user than the admin for the FTP.

    But in fact my time machine just take the place of the back-up… no need to limit the size I reckon?

  • shadowandy


    Let it do a couple of more backups and check the Console. It should get reflected. Otherwise, use the Disk Utility to mount the sparsebundle. It should show that the max partition size as what you have defined.

  • shadowandy


    1) When TM throws an error on resizing partition, it will simply continue with the backup (if there are still sufficient space to store what it wants to backup).

    2) When the max capacity is reached, it will start pruning the oldest backups.

  • Edward


    I started a few rounds of backup and the systems resize the file to use up the whole NAS space. I was not able to use disk utility from the iMac Utility folder to mount the sparsebundle as it’s not listed.

    Then I redo the whole procedure again but this time I “chmod 555 Info.*” Now I got the below message on the console:

    7/7/11 PM 08:38:41 com.apple.backupd[4433] Could not resize backup disk image (DIHLResizeImage returned 13)

    I ran it a few times and got the same message. “Fingercrossed” I think this should work now.

    Any foreseen impact since I did a chmod 555 instead of 755?

  • shadowandy


    It appears that you are using an account that has administrative rights to do the backup hence the Time Machine is able to update the Info.* files. chmod 555 has no negative impacts. 🙂

  • fitlies

    hi there, thank you for this wonderful guide. i’ve been trying to back my mac up using dns320 but i guess i’m not so technically inclined.

    and more obviously so when i am stuck at one of your steps – i can’t detect, what more select, my nas to be used as a backup when in the TM setup.

    however, i did manage to read/write files when testing and have enabled afp.

    any clues?

  • Ed

    I’m glad to see that the DNS-320 is working for some Mac users. I’m still having some difficulties even trying to read/write from my Mac. I have AFP turned on, as well as Time Machine. I connect to the server and able to log in and see “Volume_1” but that seems to be as far as I get. I am able to create a folder but when I copy a file to it from the desktop, it hangs up finder but I do see that file copied over from another Win7 machine also connected to the 320. I am running v2.0 of the firmware. Any suggestions? Please?

  • shadowandy

    fitlies & Ed,

    Have you tried doing the “defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1” on your iMac? This is to allow Time Machine to use network share as a backup location.

  • fitlies

    yeah i did. is there a need to press “enter” after that? or go to Finder straight and ⌘ + k?

  • Just a FYI, this method doesn’t seem to work with OSX 10.7 Lion GM.

    No issue running OSX 10.6.x SL. The only difference I did was on the DNS-320, I had to enable Time Machine under Applications > Local Backups and it showed up without using the terminal command.

    DNS-320 Firmware is V2.0

  • shadowandy


    Yes, you need to hit after that. 🙂

  • shadowandy


    Didn’t have chance to try with Lion. Will revisit this after Lion is officially released. 🙂

    Thanks for sharing!

  • Richard

    Hi Andy.

    Normally how long does it takes for your mac to backup to time machine on dns-320?

    my 1gb can take up to an hour.. painfully slow

    yar and its all running on gigabit network

  • Winston

    Seems like AFP/TimeMachine is not working for DNS-320 and OSX Lion anymore…

  • Pingback: Time Machine on Lion with DNS-320 | shadowandy - my life stories()

  • shadowandy

    Managed to do a interim fix before D-Link releases a new firmware. Check it out here (http://www.shadowandy.net/2011/08/time-machine-on-lion-with-dns-320.htm)

  • Benjamin

    This was what i typed and there was no sparsebundle file created. Any help there or could you help me create a sparsebundle file? ):

    Benjamin-Thangs-MacBook-Pro:Desktop thongs$ hdiutil create 300G -fs HFS+J -volname “Time Machine Backups” -type SPARSEBUNDLE Benjamin Thang’s MacBook Pro.sparsebundle

  • Benjamin

    Telnet/SSH to your DNS-320

    how can one do that? I’m totally unfamiliar with Telnet and tried the funplug but was unable to expand it.