Simulating the Deployment of a Production Environment Cluster on a Single Machine: How to Expand the /data1 Directory After Setup

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 单机上模拟部署生产环境集群,搭建完成后,如何扩容/data1目录

| username: TiDBer_光影

To simulate deploying a production environment cluster on a single machine, I mapped a volume from storage and formatted it into an ext4 file system to serve as the /data1 directory. Now, I have expanded the volume by 100G from the storage side. How can I expand the /data1 mounted directory?

| username: 江湖故人 | Original post link

resize2fs /dev/xx (/data1 mount point)

| username: 江湖故人 | Original post link

You didn’t use LVM, right? Can you check with df?

| username: 春风十里 | Original post link

Could you show your configuration?

| username: wangccsy | Original post link

You are modifying the storage directory.

| username: 像风一样的男子 | Original post link

Ask your operations team. These are basic issues and have nothing to do with the database.

| username: Kongdom | Original post link

:thinking: Shouldn’t this automatically expand? Is volume expansion in Linux different from Windows?

| username: 普罗米修斯 | Original post link

After vg expansion, just execute the following one.

| username: 随缘天空 | Original post link

Look for operations personnel.

| username: 像风一样的男子 | Original post link

It’s really different; LVM partitions are completely different from standard partitions.
The troublesome points of LVM:

  1. Create PV: pvcreate /dev/sdb1
  2. Extend VG: vgextend /dev/VolGroup00 /dev/sdb1
  3. Extend LV: lvextend -L +n (M or G) /dev/VolGroup00/LogVol00
| username: Kongdom | Original post link

:flushed: Uh… better find the operations senior brother~ I’m confused~

| username: ffeenn | Original post link

If it’s not LVM, you can first expand this storage and then expand the ext4 partition.
Or provide a detailed screenshot of lsblk for us to take a look.

growpart /dev/vdb x  
resize2fs /dev/vdbx
| username: TiDBer_光影 | Original post link

At that time, I followed these steps and initially used a 500G volume. Now I have expanded the volume to 600G at the storage layer. How do I synchronize this change to the mounted host?

| username: zhanggame1 | Original post link

LVM management is very simple, just adjust the size. Non-LVM is very troublesome. You can refer to this:
Expanding non-LVM partitions on a hard disk with services in CentOS7_CSDN Blog

| username: linnana | Original post link

Partition expansion with parted is somewhat different from LVM.

| username: linnana | Original post link

You can try unmounting first in the test environment and then expanding.

| username: dba远航 | Original post link

This depends on the expansion operation of the system volume and is unrelated to the database.

| username: ffeenn | Original post link

It looks like you are using Inspur’s storage and Inspur’s dynamic storage interface. It is still recommended to follow Inspur’s manual to expand the multipath. If you really can’t do it, contact Inspur’s after-sales service. Make sure to back up your data!!

| username: xingzhenxiang | Original post link

If it’s a self-installed system, then start over and use LVM logical volume management for the disks. If it’s a cloud environment, I can expand the disk size on both Alibaba Cloud and Amazon Cloud.

| username: ffeenn | Original post link

In your screenshot, the operation is incorrect. You didn’t use growpart to expand the partition, so how can you directly use resize2fs to adjust the partition size? You should execute growpart /dev/mapper/idiska 1 for online expansion first, and then execute resize2fs to adjust the partition size.