home Tutorial Adding Additional Disk Space to CloudPanel

Adding Additional Disk Space to CloudPanel

If you’re running a server with CloudPanel and need more disk space to accommodate your growing data, this tutorial will guide you through the process of adding additional disk space to your server.

Format a new disk in Linux:

  1. Connect the new disk to your Linux server.
  2. Open a terminal or shell.
  3. Use the lsblk command to list all available disks and identify the new disk. It is usually identified as /dev/sdX, where X represents a specific letter assigned to the disk.
    Sample output:

    
          NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
          sda      8:0    0   20G  0 disk 
          └─sda1   8:1    0   20G  0 part /
          sdb      8:16   0   50G  0 disk 
        
  4. Before formatting, ensure that there is no important data on the disk, as formatting will erase all existing data.
  5. Run the following command to format the disk with the ext4 file system (replace /dev/sdX with the appropriate disk identifier).
    Sample output:

    
          $ sudo mkfs.ext4 /dev/sdb
          Creating filesystem with 13107200 4k blocks and 3276800 inodes
          Filesystem UUID: 7f1c72b0-0ef4-4a2c-b0d1-7f5eae3a5d28
          Superblock backups stored on blocks:
              32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
              4096000, 7962624, 11239424
          Allocating group tables: done 
          Writing inode tables: done 
          Creating journal (65536 blocks): done 
          Writing superblocks and filesystem accounting information: done 
        
  6. Confirm the formatting process by typing “y” when prompted.
  7. Once the format is complete, the new disk is ready to be mounted.

Mount the new disk at the mount point /home and transfer data:

  1. Create a temporary directory to copy the existing data from /home (if it exists) before mounting the new disk. Run the following command:

    
          $ sudo mkdir /tmp/home_backup
        
  2. Copy the contents of the existing /home directory to the temporary backup directory by running the following command:

    
          $ sudo cp -a /home/. /tmp/home_backup/
        
  3. Now, mount the new disk at /home using the following command (replace /dev/sdX with the appropriate disk identifier).
    Sample output:

    
          $ sudo mount /dev/sdb /home
        
  4. Verify that the new disk is mounted correctly by running df -h command and checking if the mount point /home shows the new disk.
    Sample output:

    
          Filesystem      Size  Used Avail Use% Mounted on
          /dev/sdb         50G   23G   25G  48% /home
        
  5. If the new disk was mounted successfully, move the data from the temporary backup directory to the new disk by running the following command:

    
          $ sudo cp -a /tmp/home_backup/. /home/
        
  6. Check that the data has been transferred correctly by verifying the contents of /home.
  7. A fresh CloudPanel install will have created two folders clp and mysql in /home, run the following commands to set proper ownership and permissions:

    
          $ sudo chown -R clp:clp /home/clp/
          $ sudo chown -R mysql:mysql /home/mysql/
        

Auto-mount the new disk on reboot by editing /etc/fstab entries:

  1. Open the /etc/fstab file in a text editor with administrative privileges, such as:

    
          $ sudo nano /etc/fstab
        
  2. Before modification, the /etc/fstab file may look like this:

    
          /dev/sda1  /  ext4  defaults  0  1
          /dev/sdb1  /data  ext4  defaults  0  2
          ...
        
  3. Add an entry at the end of the file to auto-mount the new disk at /home during system boot. Use the following format:

    
          /dev/sdb  /home  ext4  defaults  0  2
        
  4. After modification, the /etc/fstab file should look like this:

    
          /dev/sda1  /  ext4  defaults  0  1
          /dev/sdb1  /data  ext4  defaults  0  2
          /dev/sdb   /home  ext4  defaults  0  2
          ...
        
  5. Save the changes and exit the text editor.
  6. To test if the auto-mount works without a reboot, run the following command to mount all file systems defined in /etc/fstab:

    
          $ sudo mount -a
        
  7. Verify that the new disk is mounted at /home by running df -h command and checking the mount point.
    Sample output:

    
          Filesystem      Size  Used Avail Use% Mounted on
          /dev/sdb         50G   23G   25G  48% /home
        
  8. Restart your Linux server to ensure that the new disk is automatically mounted at /home during the boot process.

Following these steps, you should be able to add additional disk space to your CloudPanel server by formatting a new disk, mounting it at /home, transferring data, and configuring auto-mounting on reboot.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.