Rebuild corrupted userdata files in Cpanel

rebuild-corrupted-userdata-files

The userdata directory is one of the important directories of cPanel which stores the user account configuration of the cPanel or WHM accounts. It defines various info like parked, addon, subdomains as well as the VirtualHost. cPanel & WHM utilizes data from the files within /var/cpanel/userdata/ where account-related data is stored or read from. The files inside the userdata directory would be rebuild whenever there is a change made in the web-based interface of the cPanel therefore it is important that these files are preserved.

But in certain circumstances, there are chances that these userdata files can get corrupted. So, this blog post shows you some steps to rebuild corrupted userdata files in cPanel. A corrupted datafile can create issues while migrating or operating the cPanel accounts. These userdata files can repaired using a valid and working httpd.conf file on the server.

Let’s assume that you have a corrupted userdata file and that you want to rebuild the files in cPanel.

You can follow the steps below to rebuild the corrupted userdata files.

1. Login to your WHM/cPanel server with root user.

2. The user data files are located at /var/cpanel. Make sure if the userdata directory is present on the server.

3. If the directory exists, move it or rename it with mv command

mv /var/cpanel/userdata /var/cpanel/userdata_backup

4. Create a new user data directory with the command mkdir

mkdir /var/cpanel/userdata

5. Now that we have a new userdata directory created, in order to rebuild userdata files for all the accounts hosted on your cPanel server run the script “userdata_update” with “–reset” flag which will rebuild the userdata files for all the accounts that are hosted on your cpanel server.

/usr/local/cpanel/bin/userdata_update –reset

6. The next step will be to fix the permissions for newly generated user data files which can be done by running the command

/usr/local/cpanel/bin/fix_userdata_perms

7. Since we have a new userdata file generated we will need to update the system’s cache which can be done by command

/scripts/updateuserdatacache

8. Now rebuild the apache configuration in order to use the newly rebuilt userdata files with the command

/scripts/rebuildhttpdconf

9. Restart the apache service with the command

/scripts/restartsrv_httpd

Hope you have successfully rebuilt userdata files, now you will  be able to restart your Apache service via your cPanel/WHM panel with the newly rebuilt httpd.conf file! . If you need any assistance on this feel free to Contact  us .

For more updates you can follow us on Twitter , Facebook