Pages

Tuesday, October 22, 2013

Extending cPanel's Home Directory to a New Partition

Is your cPanel server's /home directory running out of space? This can stop you from creating new accounts or cause other issues. A common solution is to add a new hard drive and configure cPanel to use it for new user accounts. This guide explains how to do that simply.


PREPARING THE NEW PARTITION

Before cPanel can use the new space, you need to add and set up a new hard drive on your server.

Steps:

  1. Install New Hard Drive: Physically install the new hard drive into your server.

  2. Format the Drive: Format the new drive with a suitable file system (like ext4).

  3. Mount as /home2: Create a new directory, for example, /home2, and mount the new hard drive to this location. This makes the new storage accessible.


TELLING CPANEL TO USE THE NEW PARTITION

Once /home2 is ready, you have two main ways to tell cPanel to use it for new accounts. Both methods involve editing the cPanel configuration file: /etc/wwwacct.conf.


OPTION 1: DEDICATE NEW ACCOUNTS TO /home2

This option makes sure all future cPanel accounts are created directly in the new /home2 partition.

How to Configure:

  • Edit the /etc/wwwacct.conf file.

  • Find the line that says HOMEDIR.

  • Change its value to /home2.

Example:

HOMEDIR=/home2

Result:

After this change, any new cPanel accounts you create will automatically be placed in the /home2 directory. Existing accounts in /home will remain there.


OPTION 2: AUTO-SELECT BASED ON FREE SPACE

This is a more flexible option. cPanel will check both /home and /home2 and create new accounts on the partition with the most free space.

How to Configure:

  • Edit the /etc/wwwacct.conf file.

  • Find the line that says HOMEMATCH.

  • Set its value to /home*.

Example:

HOMEMATCH=/home*

Result:

With this setting, when a new account is created, cPanel will intelligently decide whether to put it in /home or /home2 based on which directory has more available disk space. This helps distribute user data more evenly across your storage.

Monday, October 14, 2013

NCftp - get multiple Folders with ftp

    The NcFTP client is a powerful tool for transferring files over FTP, especially useful for system administrators and developers. It offers advanced features like recursive directory downloads, making it a great alternative to standard FTP clients. This guide will walk you through installing NcFTP and using its recursive download capabilities.


    INSTALLING NCFTP

    NcFTP is compatible with various Unix-like operating systems, including FreeBSD, Solaris, and most Linux distributions.

    On Debian/Ubuntu Systems: You can easily install NcFTP using the apt-get package manager. Open your terminal and run the following command:

    sudo apt-get install ncftp
    

    This command will download and install the NcFTP client on your system.


    RECURSIVE DIRECTORY DOWNLOADS WITH NCFTPGET

    ncftpget is a command-line tool within the NcFTP suite designed for efficient file transfers, particularly for scripting and advanced usage. It allows you to download entire directories and their contents recursively.

    Basic Recursive Download Command: To download a remote directory and all its subdirectories and files, use the following format:

    ncftpget -R -v -u "USERNAME" ftp.server.com /local/directory /remote/directory
    

    Let's break down the options:

    • -R: This crucial option tells ncftpget to copy all subdirectories and files recursively from the remote server.

    • -v: Stands for "verbose." This displays detailed download activity and progress in your terminal, which is helpful for monitoring transfers.

    • -u "USERNAME": Specifies the username for logging into the FTP server. If you omit this, ncftpget will attempt to log in anonymously.

    • ftp.server.com: Replace this with the actual hostname or IP address of your FTP server.

    • /local/directory: This is the path on your local machine where you want to save the downloaded files.

    • /remote/directory: This is the path to the directory on the remote FTP server that you wish to copy.

    Example: If you wanted to download the /www-data directory from ftp.nixcraft.net to your local /home/vivek/backup directory, using the username ftpuser, the command would be:

    ncftpget -R -v -u "ftpuser" ftp.nixcraft.net /home/vivek/backup /www-data
    

    TROUBLESHOOTING: "TAR MODE" ERROR

    Sometimes, when performing recursive downloads, you might encounter an error message similar to this:

    tar: End of archive volume 1 reached
    tar: Sorry, unable to determine archive format.
    Could not read directory listing data: Connection reset by peer
    

    This error often indicates that ncftpget is attempting to use "TAR mode" for the recursive transfer, which might not be supported or configured correctly on the FTP server, or it's encountering issues with directory listings.

    Solution: Disable TAR Mode To resolve this, you can add the -T option to your ncftpget command. The -T option explicitly tells ncftpget not to try using TAR mode with recursive mode.

    Revised Command for Error Resolution:

    ncftpget -T -R -v -u "ftpuser" ftp.nixcraft.net /home/vivek/backup /www-data
    

    By adding -T, you ensure that ncftpget uses a different method for recursive downloads, bypassing the TAR mode issue.