Can't sync music from iPhone to computer
By design, the iPhone will sync iTunes content with one computer at a time. Any attempt to sync such content with a second computer will result in ALL iTunes content being first erased from your phone &amp; then replaced with the content from the second computer. This is a design feature and cannot be overridden. Because you replaced your computer, or hard drive, your phone will see this as a "new" computer. The iTunes content sync is one way: computer to phone. If you have photos that were synced to your phone or music ripped on your own that were not backed up, you will first have to extract them from your phone using third party software such as Touch Copy, before you do anything else, as Apple makes no provision to do so. Try this

Past iTunes, App store, &amp; iBookstore content can be re-downloaded. Read here:

http://support.apple.com/kb/HT2519

Once you've done that, do the following in the order specified:


Disable auto sync when an iPod/iPhone is connected under iTunes>Preferences>Devices(under Edit menu if using Windows).
Make sure you have one contact &amp; one event in the supported applications on your computer(iCal &amp; Address Book on a Mac, Windows Address Book or Outlook if using Windows). These entries can be fake, doesn't matter, the important point is that these programs not be empty.
Connect your phone, iTunes running, do not sync at this point.
Store>Authorize this computer.
File>Transfer Purchases(To make sure all purchased content on your phone will be in your iTunes library).
Right click your phone in the left device pane &amp; select "Reset warnings".
Right click again and select "Backup".
Right click again &amp; select "Restore from Backup", select the backup you just made. When prompted to create another backup, decline.
This MUST be followed by a sync to restore your iTunes content, which you select from the various tabs, You'll get a popup regarding your contacts &amp; calendars asking to merge or replace, select "Merge".


Your phone should look just like it did when you started, with no data loss.

You should be good to go.