购买磁盘扩容服务后,宝塔后台并没有显示扩容后的容量

①#运行fdisk -l命令查看磁盘实际大小

[root@izbp1521sz2xqeu1byoy4mz /]# fdisk -l         #运行fdisk -l命令查看磁盘实际大小
 
Disk /dev/vda: 536.9 GB, 536870912000 bytes, 1048576000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000d2717
 
   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048    41943039    20970496   83  Linux

②df -h #磁盘分配大小

[root@izbp1521sz2xqeu1byoy4mz /]# df -h      #磁盘分配大小
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        20G  3.9G   15G  22% /
devtmpfs        3.7G     0  3.7G   0% /dev
tmpfs           3.7G     0  3.7G   0% /dev/shm
tmpfs           3.7G  396K  3.7G   1% /run
tmpfs           3.7G     0  3.7G   0% /sys/fs/cgroup
tmpfs           756M     0  756M   0% /run/user/0

③安装growpart

[root@izbp1521sz2xqeu1byoy4mz /]# yum install -y cloud-utils-growpart
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package cloud-utils-growpart.noarch 0:0.29-5.el7 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
=============================================================================================================================================================================================
 Package                                                Arch                                     Version                                        Repository                              Size
=============================================================================================================================================================================================
Installing:
 cloud-utils-growpart                                   noarch                                   0.29-5.el7                                     base                                    27 k
 
Transaction Summary
=============================================================================================================================================================================================
Install  1 Package
 
Total download size: 27 k
Installed size: 61 k
Downloading packages:
cloud-utils-growpart-0.29-5.el7.noarch.rpm                                                                                                                            |  27 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : cloud-utils-growpart-0.29-5.el7.noarch                                                                                                                                    1/1
  Verifying  : cloud-utils-growpart-0.29-5.el7.noarch                                                                                                                                    1/1
 
Installed:
 
  cloud-utils-growpart.noarch 0:0.29-5.el7
 
Complete!

④/dev/vda 第一分区扩容

[root@izbp1521sz2xqeu1byoy4mz /]# growpart /dev/vda 1
CHANGED: partition=1 start=2048 old: size=41940992 end=41943040 new: size=1048573919 end=1048575967

⑤运行resize2fs 命令调用resize2fs扩容文件系统,重设分区大小

[root@izbp1521sz2xqeu1byoy4mz /]# resize2fs /dev/vda1
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/vda1 is mounted on /; on-line resizing required
old_desc_blocks = 2, new_desc_blocks = 32
The filesystem on /dev/vda1 is now 131071739 blocks long.

最后查看磁盘大小

[root@izbp1521sz2xqeu1byoy4mz /]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1       493G  4.0G  468G   1% /
devtmpfs        3.7G     0  3.7G   0% /dev
tmpfs           3.7G     0  3.7G   0% /dev/shm
tmpfs           3.7G  404K  3.7G   1% /run
tmpfs           3.7G     0  3.7G   0% /sys/fs/cgroup
tmpfs           756M     0  756M   0% /run/user/0

参考 https://www.jianshu.com/p/7a6e95e3b319

发表评论

邮箱地址不会被公开。 必填项已用*标注