WordPress knowledge sharing

Add a new partition and mount under Linux

We have C disk, D disk, E disk, etc. in the Windows system, which are all root directories; However, there is only one root directory in the Linux system, which does not support the mode like the Windows drive letter. Additional partitions can only be mounted to a folder under the root directory. That is to attach the capacity of the new partition to this folder. Generally, we attach it to the website folder.

The advantage of this is that the lnmp, website files and databases are all placed in the new partition. Even if the Linux system partition is redone, the data is still safe.

Let's use the fdisk command to check the partition

fdisk -l

You can see a primary partition sda and a new partition sdb.

 lnfqgz01

Tip: If you execute the fdisk - l command above and find that there is no/dev/sdb or/dev/xvdb (different VPS names), it means that your VPS does not have a data disk, and this tutorial is useless for you.

Partition command:

fdisk /dev/sdb

Enter n to create a new partition

Primary partition selection P

For the rest, select 1 by default.

Enter wq to save and exit.

 lnfqgz02

Enter the fdisk - l command to view the new partition.

 lnfqgz03

Format the new partition in ext4 format.

mkfs.ext4 /dev/sdb1

The format time varies according to the size of the hard disk.

 lnfqgz04

Now create a new folder.

mkdir www.vpsss.net

The above www.vpss.net is the name of the new folder.

 lnfqgz05

 

Use the mount command to mount the new partition to the new website folder.

mount /dev/sdb1 /home/domainame

 lnfqgz06

Now you can put the website files in and run them. You are no longer afraid of running out of partition space.

Like( zero )
Article name: Adding New Partitions and Attachments under Linux
Article link: https://www.vpsss.net/688.html
Copyright notice: The resources of this website are only for personal learning and exchange, and are not allowed to be reproduced and used for commercial purposes, otherwise, legal issues will be borne by yourself.
The copyright of the pictures belongs to their respective creators, and the picture watermark is for the purpose of preventing unscrupulous people from stealing the fruits of labor.