The specific implementation process of Alibaba Cloud ECS disk expansion in situ
1. After expanding the capacity and restarting the instance through the console, check the capacity of the console cloud disk:

After expanding and restarting the instance through the console, view the capacity of the console cloud disk
2. Check the disk space usage, including the data disk that has not been mounted, command:
df-h
fdisk-l
Friendly reminder: If you execute the fdisk -l command and find that there is no /dev/xvdb to indicate that your cloud service has no data disk, then you do not need to mount, this tutorial is not applicable to you
3. Through the first and second steps, find out:
/dev/xvdb: 21.5 GB
/dev/xvdb1 9.9G
It is necessary to change /dev/xvdb1 to 20 GB to represent the success of the expansion
4. If your disk was previously mount on the server, first umount disk
umount /dev/xvdb1
Note:umount /var/www It should also be possible (Alibaba Cloud official document, it is recommended to use this command)
Error:
umount: /var/www: device is busy.
(In some cases useful info about processes that use
The device is found by lsof(8) or fuser(1))
5. This is a program that is using this disk, you can use lsof /dev/xvdb1 or you can use fuser -mv /dev/xvdb1 to see which process is occupying, as shown below:
Check out a bash process with pid 18786, the other is a cosplash process with pid 1291, and the other is The soffice.bin process with PID 1308 is occupied, and then closes the corresponding service or kills the corresponding process to uninstall successfully.
If there is only a separate process bash, usually a user logs in to this directory and logs out of this directory.
Execute in sequence:
lsof /dev/xvdb1
fuser -mv /dev/xvdb1
lsof /dev/xvdb1
Through the exit of a user, the bash process no longer exists;

This is a program that is using this disk, you can use lsof /dev/xvdb1 or you can use fuser -mv /dev/xvdb1 to see which process is occupying
6. From the result, it is that the current process is occupying the mounted data disk and the mount data disk cannot be unloaded. You can force the process of the occupied data disk to end with the following command, as follows:
Execute in sequence:
Kill -9 1291
Kill-9 1308
7. Execute again:
umount /dev/xvdb1
success;
8. Delete the original partition and create a new partition
execute:
fdisk /dev/xvdb
, partition the data disk;
According to the prompts, enter in sequence
d
n
p
1
Enter twice
wq
, the partition starts, and it will be completed soon.
9. View new partitions
Use:
fdisk-l
The command can see that the new partition XVDB1 has been established.
10. Format the disk
Use the resize2fs instruction to expand the file system size, the original data will not be lost
e2fsck -f /dev/xvdb1
resize2fs /dev/xvdb1

Format the disk, use the resize2fs instruction to expand the file system size, the original data will not be lost
11. Mount disk
Finally, we mount the expanded disk back to the original mount point
mount /dev/xvdb1 /var/www





