Basic knowledge
How to add disk capacity expansion hard disk under the pagoda panel? Lossless steps for Alibaba Cloud disk expansion on the pagoda panel
Recently, the 571 Free Resource Editor saw an article on the Pagoda Forum about the lossless operation of disk expansion under the pagoda panel. He thought it was very good, and reproduced it.
When the business volume of the website is increasing, it will be found that the data disk has been unable to accommodate, so we plan to expand the data disk. Because we used to follow Alibaba Cloud's tutorial, which led to the loss of more than 100 gigabytes of data on the website, there was no backup and snapshot at that time, which led to the manual operation of publishing data for seven days and seven nights. Traffic dropped, data was lost, and people were also tired. So we worked hard tonight, Finally, I learned the course of lossless disk expansion. The following picture is from the preemptive instance created by Alibaba Cloud.
Note:
1. This tutorial is only for the data disk (the green font in the text represents the command to be input, and the purple represents the key point)
2. Backup and snapshot data in advance
3. Alibaba Cloud disk, pagoda panel, Centos 7 system
4. My server has system disk/dev/vda1 and data disk/dev/vdb1. Enter df - h in the remote connection
How to add disk capacity expansion hard disk under the pagoda panel? Lossless steps for Alibaba Cloud disk expansion on the pagoda panel
Step:
1、 In the background of Alibaba Cloud, click Disk Capacity Expansion at more places of the data disk, and select Online Capacity Expansion. My original size is 78G, but after the expansion, 154G, and submit the order. It is found that 154G is displayed in the background of Alibaba Cloud, 77G is displayed in the pagoda panel, and the file system accounts for about 1G.
2、 Stop related services
1. Stop all tasks of the pagoda, create a new shell script task in the planned task in the pagoda panel, write the name randomly, click Save and click Execute. The script content is as follows:
<font size="4" color="#2e8b57">#!/ bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
stop_ service(){
/etc/init. d/bt stop
if [ -f "/etc/init.d/nginx" ]; then
/etc/init. d/nginx stop > /dev/null 2>&1
fi
if [ -f "/etc/init.d/httpd" ]; then
/etc/init. d/httpd stop > /dev/null 2>&1
fi
if [ -f "/etc/init.d/mysqld" ]; then
/etc/init. d/mysqld stop > /dev/null 2>&1
fi
if [ -f "/etc/init.d/pure-ftpd" ]; then
/etc/init. d/pure-ftpd stop > /dev/null 2>&1
fi
if [ -f "/etc/init.d/tomcat" ]; then
/etc/init. d/tomcat stop > /dev/null 2>&1
fi
if [ -f "/etc/init.d/redis" ]; then
/etc/init. d/redis stop > /dev/null 2>&1
fi
if [ -f "/etc/init.d/memcached" ]; then
/etc/init. d/memcached stop > /dev/null 2>&1
fi
if [ -f "/www/server/panel/data/502Task.pl" ]; then
rm -f /www/server/panel/data/502Task.pl
if [ -f "/etc/init.d/php-fpm-52" ]; then
/etc/init. d/php-fpm-52 stop > /dev/null 2>&1
fi
if [ -f "/etc/init.d/php-fpm-53" ]; then
/etc/init. d/php-fpm-53 stop > /dev/null 2>&1
fi
if [ -f "/etc/init.d/php-fpm-54" ]; then
/etc/init. d/php-fpm-54 stop > /dev/null 2>&1
fi
if [ -f "/etc/init.d/php-fpm-55" ]; then
/etc/init. d/php-fpm-55 stop > /dev/null 2>&1
fi
if [ -f "/etc/init.d/php-fpm-56" ]; then
/etc/init. d/php-fpm-56 stop > /dev/null 2>&1
fi
if [ -f "/etc/init.d/php-fpm-70" ]; then
/etc/init. d/php-fpm-70 stop > /dev/null 2>&1
fi
if [ -f "/etc/init.d/php-fpm-71" ]; then
/etc/init. d/php-fpm-71 stop > /dev/null 2>&1
fi
fi
swapoff /www/swap
}
stop_ service</font>
2. Log in SSH to the server
(1) Close the swap partition:
swapoff -a
(2) Uninstall host monitoring (some host manufacturers have it):
/usr/local/cloudmonitor/wrapper/bin/cloudmonitor. sh remove && \ rm -rf /usr/local/cloudmonitor
(3) Unoccupied (kill the process occupying/dev/vdb1):
fuser -m -k /dev/vdb1
(4) Uninstall the primary partition:
umount /dev/vdb1
Use df - h to check whether the uninstallation is successful. If/dev/vdb1 is not visible, the uninstallation is successful.
How to add disk capacity expansion hard disk under the pagoda panel? Lossless steps for Alibaba Cloud disk expansion on the pagoda panel
Tip: If/dev/vdb1 is still visible, repeat the operations to stop the pagoda task, close the swap partition, uninstall the host monitoring, remove the occupation, and uninstall the primary partition.
3、 Here comes the point, operate the disk
How to add disk capacity expansion hard disk under the pagoda panel? Lossless steps for Alibaba Cloud disk expansion on the pagoda panel
1. Run the fdisk - l command,
In the figure above, disk/dev/vda is 64.4GB, indicating that the system disk is about 65G. disk/dev/vdb: 165.4GB corresponds to the capacity of Alibaba Cloud background.
In addition, look at the related information behind/dev/vdb1. In the end information in the middle line, it is 163577855. My personal understanding is that it means 163G, and the system also accounts for several gigabytes.
2. Run the fdisk/dev/vdb command to enter the disk operation. Why is it/dev/vdb instead of/dev/vdb1 in the figure? This vdb represents the name of a disk, which is similar to the Alibaba Cloud background disk
The name is corresponding, and vdb1 represents the first partition of the vdb disk (personal understanding)
How to add disk capacity expansion hard disk under the pagoda panel? Lossless steps for Alibaba Cloud disk expansion on the pagoda panel
3. Enter d and press Enter to delete the original partition (deleting the partition will not cause data loss in the data disk)
Enter n and press Enter to start creating a new partition
Enter p and press Enter to select Create Primary Partition
If you enter 1, the default value is 1 by default. You can also enter directly
Then it is found that the First sector (2048-322961407, deffault 2048), where 322961407 is larger than the 163577855 in the End in the above figure, means that the partition is larger than the original partition.
When you see "... size 154GiB is set", it indicates that a new primary partition has been successfully created
Enter wq and press Enter to start saving the partition
4: Update file system information
1. Text query system. The command is e2fsck - f/dev/vdb1
2. Change the size of the file system. The command is: resize2fs/dev/vdb13. Mount the resized file system to the original mount point (for example, in this example, the location of the first disk officially mounted by the pagoda/www). The command is: mount/dev/vdb1/www4. Enter the command df - h to view the information
How to add disk capacity expansion hard disk under the pagoda panel? Lossless steps for Alibaba Cloud disk expansion on the pagoda panel
According to the information in the figure, the size is 152G, which should be the available space. Avail is 145G.
5、 Closing
How to add disk capacity expansion hard disk under the pagoda panel? Lossless steps for Alibaba Cloud disk expansion on the pagoda panel
After the disk is resized and remounted, execute the following two commands
swapon /www/swap
echo "True" > /www/server/panel/data/502Task.pl
Finally, don't forget to start the pagoda service
/etc/init. d/bt start
Log in to the background of the pagoda and refresh to see if the space has become 152G of usable space?
How to add disk capacity expansion hard disk under the pagoda panel? Lossless steps for Alibaba Cloud disk expansion on the pagoda panel
Close the work. [Click here to see the original text]
571 The free resource editor again reminds you that you must back up data before these steps.