Introduction
This article covers restoring a DNS zone file from a cPanel backup.
Procedure
- Access the server's command line as the 'root' user via SSH or "Terminal" in WHM.
- Backup the
/var/named
directory.cp -av /var/named{,.$(date +%s)}
- Locate the backup from which to restore the zone.
Please note that a 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 the temporary directory.
cd /tmp_location
- Extract the zone file from the backup.
- System backup
tar xfvz /backup/$date/system/dirs/_var_named.tar.gz var/named/$domain.tld.db
Please note that "$date" and "$domain.tld" must be replaced with the backup folder name for the date and the domain name of the zone to restore. - Account backup
tar xfvz /backup/$date/accounts/$username.tar.gz $username/dnszones/$domain.tld.db
Please note that "$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.
- System backup
- Copy the extracted zone file to the
/var/named/
folder.- System backup
cp -v var/named/$domain.tld.db /var/named/
Please note that "$domain.tld" must be replaced with the domain name of the zone to restore. - Account backup
cp -v $username/dnszones/$domain.tld.db /var/named/
Please note that "$username" and "$domain.tld" must be replaced with the cPanel username of the domain owner and the domain name of the zone to restore.
- System backup
- 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.