Linux VPS host AMH panel environment adds new data disk mounting and data migration methods

888u

Last update at :2024-07-07,Edit by888u

The default system disk for general website projects is 10-30GB, which is basically enough for the website. Unless the increase in website data in the later period may require additional data disk expansion, it may also be because we did not mount it in the early stage and need to use it later to mount the data. The hard disk is fully utilized, so we may need to mount the data disk in a system that is already using the panel or one-click package environment. For example, in this article, Snail needs to share the AMH panel environment that a netizen is already using. After the data is large, the newly purchased 30GB data hard drive needs to be mounted.

Because existing systems and websites cannot be affected, and you certainly cannot reinstall the system and then mount and move it. We can only mount the unused data hard drive in the existing system, then perform data migration, and record the entire process. Download it so you can refer to it later if needed.

Relevant VPS mounting tutorials shared before:

Alibaba Cloud Server ECS data disk mounting process Mounting website directories according to different environments

Tencent Cloud Server mounting data disk and installing AMH management panel process guide

Linux VPS host mounts unused data disks and specifies the WDCP panel installation data disk directory

Friendly reminder: I personally recommend that before mounting an existing website, it is recommended to back up the website data or if the VPS service provider has a snapshot backup, it is recommended to back up the data to avoid unnecessary troubles caused by mistakes.

First, check whether the data disk exists

fdisk -l

Here we can see that the existing system disk is 20GB, and 30GB is not mounted.

We can also see from the probe here that only the 20GB system disk is currently used. The newly purchased 30GB data disk is not used, so we need to mount it before it can be used.

Second, partition the data disk

fdisk /dev/xvdb

Perform the n p 1 Enter Enter wq operation according to the prompts. During this period, Partition 1 may be occupied, and an error message Partition 1 is already defined. Delete it before re-adding it. will appear. We can delete the partition. 1, and then perform partitioning.

Third, format the new partition

mkfs.ext3 /dev/xvdb1

Fourth, create and mount the temporary directory

mkdir /mnt/data

mount /dev/xvdb1 /mnt/data

Fifth, migrate data

Before transferring data, we need to pause MYSQL and NGINX to ensure data integrity.

mv /home/* /mnt/data

The process of migrating data may be delayed depending on the amount of data, but it is generally very fast.

Sixth, modify startup items

echo \\’/dev/xvdb1 /home ext3 defaults 1 2\\’ >> /etc/fstab

Finally, we restart the VPS to take effect and check the data hard drive and website environment. If there is data loss or accident, we can roll back the data backup or snapshot at the beginning. In the same way, if we encounter a panel similar to WDCP, we can replace the home directory above with the www directory.

We can check it with a probe. I will use the 30GB directly for the website and the system disk for the panel. So far, we have basically completed the new data disk mounting and data migration in the Linux VPS host AMH panel environment, and the operation process has been relatively smooth.

Recommended site searches: Korean high-defense servers, registered unregistered domain names, free PHP space application, Hong Kong's best virtual host, search IP, registered domain name query, mainland China registration-free CDN, overseas server rental price, free Which virtual host or Hong Kong server is the fastest?

Linux VPS host AMH panel environment adds new data disk mounting and data migration methods

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码