Question
How do you restore a DNS zone from backups?
Answer
- Log in to the server via SSH or WHM's Terminal as the
rootuser -
Backup the
/var/nameddirectory:# cp -av /var/named{,.$(date +%s)}
-
Locate the backup from which to restore the zone
Note: A DNS zone may be restored from a system or account backup.
-
Create a temporary directory in which to extract the zone file:
# mkdir /temp_location
-
Change to the temporary directory:
# cd /temp_location
- Extract the zone file from the backup and copy the extracted zone file to the
/var/named/folder
# tar xfvz /backup/$date/system/dirs/_var_named.tar.gz var/named/$domain.tld.db
Note: "$date" and "$domain.tld" must be replaced with the backup folder name for the date and the domain name of the zone to restore.
# cp -v var/named/$domain.tld.db /var/named/
Note: "$domain.tld" must be replaced with the domain name of the zone to restore.
# tar xfvz /backup/$date/accounts/$username.tar.gz $username/dnszones/$domain.tld.db
Note: "$date," "$username," and "$domain.tld" must be replaced with the backup folder name for the date, the cPanel username of the domain owner, and the domain name of the zone to restore, respectively.
# cp -v $username/dnszones/$domain.tld.db /var/named/
Note: "$username" and "$domain.tld" must be replaced with the cPanel username of the domain owner and the domain name of the zone to restore.
-
Restart the DNS service:
# /usr/local/cpanel/scripts/restartsrv_named
Additional Resources
How to manually locate and extract a file or directory from a cPanel backup
Comments
0 comments
Article is closed for comments.