Mac OS X Unleashed

Mac OS X Unleashed

By John Ray and William C. Ray

Restoring the Local NetInfo Database

Knowing how to restore your local NetInfo database is just as important as knowing how to back it up.

Exactly how you restore it depends on what method you chose for backing it up or whether you backed up the database as a directory or as a tar file. Depending on the situation, you might be running your restore in multi-user mode or in single-user mode. If you are in single-user mode, remember to follow the instructions that appear at the very end of the startup so that you are allowed to make modifications.

Be sure not to rush and pay close attention to what you are doing.

  1. If your modification to the NetInfo database was made in conjunction with a change to the /etc/hostconfig file, replace the modified /etc/hostconfig file with the backup copy.
  2. Go to the /var/db/netinfo:
    [localhost:/Users/joray] root# cd /var/db/netinfo
    
    List the contents of the directory. You might have multiple backup copies. Make sure that you know which one you want to use for restoring the NetInfo database. The directory called local.nidb is the local NetInfo database.
  3. Either remove the broken local.nidb or rename it to something that lets you know that it is broken. If you rename it, you can remove it later when you have your NetInfo database restored. To remove the broken NetInfo database:
    [localhost:/var/db/netinfo] root# \rm -rf local.nidb
    
    To rename the broken NetInfo database:
    [localhost:/var/db/netinfo] root# mv local.nidb local.nidb-broken
    
  4. If you made your backup as a tar file, extract the back-up copy:
    [localhost:/var/db/netinfo] root# tar -xf local.nidb-20010512.tar
    
    If you made your backup as a copy of the directory, rename the backup copy to local.nidb:
    [localhost:/var/db/netinfo] root# mv local.nidb-backup local.nidb
    
  5. Send a kill -HUP to the nibindd process, if you are in multiuser mode:
    [localhost:/Users/joray] root# ps -aux | grep nibind
    root      6993   0.0  0.0     1288    136  ??  Ss     0:00.04 /usr/sbin/nibindd
    root      7777   0.0  0.0     5708      0 std  RV     0:00.00 grep nibind
    [localhost:/Users/joray] root# kill -HUP 6993
    
    If the NetInfo database does not appear to be restored after sending a kill -HUP to the nibindd process, reboot the machine. If you are in single-user mode, reboot the machine:
    localhost# sync;sync;sync;reboot
    

After the restored NetInfo database is up and determined to be fine, if you saved the broken NetInfo database, it is all right to remove it now.

Please note that you could also restore the local NetInfo database using the NetInfo Manager's Restore From Backup option under the Domain menu. Given how long a backup can take using the NetInfo Manager, we have not actually tried restoring the local database using the NetInfo Manager. If something goes wrong when you try to restore this way, be prepared to restore the database via the command line.

Share ThisShare This

Informit Network