Categories
System Software Notes

Saving and Restoring NetInfo database

The NetInfo database is backed up daily into:

/private/var/backups/local.nidump

You can do this yourself with:
$ nidump -r / -t localhost/local > local.nidump

Restore a broken database from backup:

Boot into single user mode – hold down command-s on startup and wait for the text to finish scrolling. Issue the commands:
$ mount -uw /
$ mv /var/db/netinfo/local.nidb /var/db/netinfo/corrupt.nidb

The next steps were taken from an article by O’Reilly. They start up NetInfo and create an empty database.
$ /usr/libexec/kextd
$ /usr/sbin/configd
$ /sbin/SystemStarter
$ /usr/libexec/create_nidb
$ /usr/sbin/netinfod -s local

Finally use niload to load the backed up database:
$ niload -d -r / . < /path/to/backed-up/database