Focus on cloud service provider activities
Notes on website operation and maintenance

Process record of modifying the folder directory of the hard disk attached to the Linux VPS host

This morning, a netizen bought a certain virtual machine product, because the default directory for auto mounting after system installation is the data directory, while this friend needs to install the WDCP panel. In theory, you can also specify the directory in the background of the panel, but he must mount it according to the official directory WWW. So after helping him to deal with the problem, he can directly modify the attached directory to solve the replacement process of the existing directory.

First, theoretical steps and methods

Theoretically, there are many such operation methods on the Internet. We just need to create a directory to mount, unload the existing directory, and then mount it in a new directory to solve the problem.

1. Create a new www directory

mkdir /www

2. Download the mounted directory

umount /data

3. Mount to new directory

mount /dev/sdb1 /www

4. Modify Profile

echo '/dev/sdb1 /www ext3    defaults    0  0' >> /etc/fstab

In theory, this operation can complete the replacement of the directory. However, Lao Zuo still has some problems during the operation. During the umount, "umount:/data: device is busy. In some cases useful info about processes that use the device is found by lsof (8) or fuser (1)" prompts that the error cannot be uninstalled.

Second, solve problems

Because the program is occupied here, we just need to check the ID and delete it. This is the process of operation.

1、fuser /data

/data:   947c

We can see that there is a program occupied.

2. View process

[ root@niaoyun data]# ps -ef |grep 94c
root       1435    947  0 22:47 pts/0    00:00:00 grep 94c
[ root@niaoyun data]# ps -ef |grep 94
root        944      2  0 22:30 ?         00:00:00 [flush-253:0] root        945    868  0 22:33 ?         00:00:00 sshd: root@pts /0
root        947    945  0 22:34 pts/0    00:00:00 -bash
root       1468    947  0 22:48 pts/0    00:00:00 ps -ef
root       1469    947  0 22:48 pts/0    00:00:00 grep 94

3. Delete Occupancy

kill -9 945

Finally, we can continue to mount the changed directory after re umount.

Vote for you
Domain name host preferential information push QQ group: six hundred and twenty-seven million seven hundred and seventy-five thousand four hundred and seventy-seven Get preferential promotion from merchants.
Like( zero )
Do not reprint without permission: Lao Zuo's Notes » Process record of modifying the folder directory of the hard disk attached to the Linux VPS host


Scan the code to follow the official account

Get more news about webmaster circle!
Entrepreneurship, operation and new knowledge