How to Solve AMH Panel Disk Space Issues

AMH paneldisk spacesoft linkLNMPdata migration
Published·Modified·

AMH is an open-source hosting panel that integrates an LNMP environment, making it very convenient for beginners. Generally, website data is stored in the /home directory. If the disk is not separately mounted to the /home directory, the website data occupies the / (root) directory. Since the root directory has limited disk space, some users may encounter issues when the / directory becomes full.

LNMP Environment

If you did not mount other disks to the /home directory at the beginning and now the / directory is full, you can transfer website data from the / directory to another disk using soft links. Here is a sharing of the process.

Assume your disk structure is as follows: the default disk sda1 is mounted to the / directory, and the new disk sdb1 is mounted to the /mnt directory. Now, we need to transfer the website data in the /home directory to the /mnt directory.

1. Stop all AMH-related services using an SSH tool

amh php stop
amh host stop
amh mysql stop
amh nginx stop

2. Package the backup, mysql, www, and wwwroot directories under /home to the new disk

tar -zcvf /mnt/home.tar.gz backup mysql www wwwroot

3. Unpack the newly packaged file to the new disk

tar -xzvf /mnt/home.tar.gz

4. Delete the folders under the /home directory (specifically backup, mysql, www, and wwwroot)

rm -rf backup mysql www wwwroot

5. Create four soft links

ln -s /mnt/backup /home
ln -s /mnt/mysql /home
ln -s /mnt/www /home
ln -s /mnt/wwwroot /home

6. Finally, start the AMH-related services

amh php start
amh host start
amh mysql start
amh nginx start

By following the steps above, the files in the /home directory of the sda1 disk are linked via soft links to the new disk sdb1 in the /mnt directory. From now on, website data will be stored on the new disk sdb1.