Linux mounts hard disk to merge data disk and system disk to expand capacity

888u

Last update at :2024-07-08,Edit by888u

Whether we are using Linux VPS or server, the default system disk storage size is basically enough for ordinary users. Generally, ordinary websites can use up 3-5GB, which is not much, unless we are a large picture and download type resource website. Therefore, the average novice server user does not care about the VPS purchased or the size of the server hard disk. After getting the ROOT account, he directly installs the panel and one-click package to use.

Of course, there is no big problem during use, but in fact, there may be data disks that are not used, because some service providers directly merge the data disk and the system disk together, and many of them require We mounted and enabled it ourselves. When mounting hard disks in this part, some are data disks that can only be independent of the system disk, and some can be combined to expand the data disk and system disk.

Snail has also seen before that several hosting providers in mainland China have one-click scripts for merging data disks in the default system root directory, but some do not. I happen to have a test machine here that can support expansion and merging of data disks. to the system disk, so record this method for later use.

First, preparations

1. The importance of backup

This article is written under the current situation of empty data, so if our friends need reference, please make a backup if there is data. And it is best to expand or mount the machine before purchasing the machine without a WEB environment, because subsequent operations on existing data still have certain risks.

2. Check whether system disk expansion is supported

vgdisplay

I'm not sure if this is the case here. I can only say that it may be the case in most cases. If the drive letter information is prompted after entering the command, the capacity can be expanded. If the prompt \\"No volume groups found\\" It cannot be expanded.

You can see that there is reported information, and there is a VG Name information we need. Different VPS may be different. We record it as VolGroup.

Second, mount, merge and expand the system disk

1. Check the current drive letter situation

Here you can see that there is a data disk that is not mounted.

2. Partitioned data disk

Enter n p 1 and press Enter t 8e w

3. Format drive letter

mkfs.ext3 /dev/vdb1

4. Create a physical volume

Before this, we already need to obtain two pieces of information through lvdisplay.

Here we need to get the LV Path and VG Name.

pvcreate /dev/vdb1

vgextend VolGroup /dev/vdb1

After execution, if you see \\”Volume group \\”VolGroup\\” successfully extended\\”, it means there is no problem.

5. Check the remaining space

vgdisplay

Looking at the free disk size, the specific value may be a little inaccurate, so I won’t care about it here.

6. Capacity expansion

lvresize -L +28G /dev/VolGroup/lv_root

I expanded it to 28GB here, because it doesn’t seem to work if I directly fill it up to 30GB, leaving some room. The latter path is the LV Path we obtained above.

resize2fs /dev/VolGroup/lv_root

Third, check the disk status

1. Before expansion

2. After expansion

Finally, we restarted the server and checked again to see that there were no problems. In this way, the system disk is expanded a little, and you can install the WEB system environment later.

Recommended site searches: Zhenjiang high-defense server, domain name query, domain name query, high-defense server rental, station group server rental, registered domain name, Wanwang space price, free second-level domain name application, free US host, shopex virtual host, < /p>

Linux mounts hard disk to merge data disk and system disk to expand capacity

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码