Pages

Showing posts with label CPANEL. Show all posts
Showing posts with label CPANEL. Show all posts

Monday, January 22, 2024

Resolving Disk Quota Discrepancies in cPanel and Server

Occasionally, you might encounter discrepancies between the disk usage reported by cPanel and the actual usage on the server. This situation can be puzzling and frustrating. This guide provides a step-by-step solution to resolve these differences and ensure that cPanel reflects the correct disk usage.

Step 1: Log in to the Server

Access your server as the root user via SSH:

ssh root@server

Once logged in, you'll have the necessary permissions to perform system-wide operations.

Step 2: Run Reset and Fix Quota Scripts

cPanel provides scripts to reset and fix quotas. Running these might resolve the issue immediately.

Reset Quotas: This script resets user quotas to ensure they're in sync:

/scripts/resetquotas

Fix Quotas: This script attempts to correct any quota problems:

/scripts/fixquotas

Step 3: Verify the Quota Adjustment

After running the scripts, check if the disk quota issue is resolved. If the discrepancy persists, proceed to the next step.

Step 4: Use Screen for a Detailed Quota Check

If the issue is still unresolved, it's time to perform a more thorough quota check. Using screen allows this process to continue running even if your SSH session is disconnected.

Start a Screen Session:

screen -S ea

Run Quotacheck: In the screen session, force a check and update of disk quotas for all filesystems:

quotacheck -avfumg
  • -a: Check all filesystems.
  • -v: Verbose mode.
  • -f: Force checking even if the system believes quotas are correct.
  • -u: Check user quotas.
  • -m: Do not try to remount the file system read-only.
  • -g: Check group quotas.

Exiting Screen: To detach from the screen session without stopping the running process:

Ctrl + A + D

Re-enter Screen: If you need to go back to your screen session:

screen -x

Step 5: Completion and Verification

Once the quotacheck process completes, you should see a summary of the directories and files checked:

quotacheck: Scanning /dev/simfs [/] done quotacheck: Checked 90761 directories and 772655 files.

Check in WHM: Now, verify whether the disk usage in cPanel reflects the actual usage on the server:

  1. Log in to WHM.
  2. Navigate to the account in question and review the disk space usage.

Conclusion

Resolving discrepancies between cPanel and server-reported disk usage can usually be handled through the provided scripts and a thorough quota check. Remember, keeping your cPanel and server environment updated and regularly monitored is crucial for maintaining accuracy and performance. If the issue persists after these steps, consider contacting cPanel support or a server administrator for further assistance.

Monday, January 1, 2024

Resolving Corrupt RPM Database in cPanel

In a cPanel environment, RPM database corruption can cause various package management issues, making it difficult to install, update, or remove software. This guide provides steps to resolve a corrupt RPM database on a cPanel server.

Step 1: Create a Backup Directory

Before making any changes, it's crucial to back up the existing RPM database. This ensures that you can revert to the current state if needed.

  1. Create a Backup Directory:
    mkdir /root/old_rpm_dbs/

Step 2: Move the Corrupt Database Files

Move the potentially corrupt RPM database files to the backup directory you just created. This action isolates the corrupt files and prepares the system for database reconstruction.

  1. Move Corrupt Database Files:
    mv /var/lib/rpm/__db* /root/old_rpm_dbs/

Step 3: Rebuild the RPM Database

With the corrupt files moved, you can now safely rebuild the RPM database. This process creates a new, clean set of database files.

  1. Rebuild the Database:

    rpm --rebuilddb

    This command will reconstruct the RPM database based on the installed packages.

Step 4: Verify the Operation

After rebuilding the database, it's good practice to verify that RPM is functioning correctly.

  1. Check for RPM Functionality:
    bash
    rpm -qa
    This command lists all installed packages. If it returns a list without errors, the rebuild was successful.

Step 5: Clean Up (Optional)

If everything is working fine and you're sure the old database files are no longer needed, you can remove the backup directory. However, it's wise to keep these files until you're certain the system is stable.

  1. Remove Backup Directory:
    rm -r /root/old_rpm_dbs/

Note: Only do this if you're confident that your system is stable and the backup is no longer needed.

Conclusion

Corrupt RPM databases can disrupt system maintenance and software management. By following these steps, you've learned how to safely rebuild the RPM database in a cPanel environment, restoring functionality and ensuring your system's integrity. Regular system monitoring and backups are crucial to quickly identifying and addressing such issues. If you encounter further problems or suspect database corruption again, repeat these steps and consider investigating the root cause to prevent future occurrences.