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.
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.
Enter the fdisk - l command to view the new partition.
Format the new partition in ext4 format.
mkfs.ext4 /dev/sdb1
The format time varies according to the size of the hard disk.
Now create a new folder.
mkdir www.vpsss.net
The above www.vpss.net is the name of the new folder.
Use the mount command to mount the new partition to the new website folder.
mount /dev/sdb1 /home/domainame
Now you can put the website files in and run them. You are no longer afraid of running out of partition space.