阿里云磁盘通过控制台扩容后由40G扩容到60G后,发现磁盘空间增加了但是分区还是40G,如何把让当前的vda1分区变成60G。

 fdisk -l
Disk /dev/vda: 64.4 GB, 64424509440 bytes, 125829120 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: 0x000b2d99

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048    83875364    41936658+  83  Linux
 lsblk
NAME   MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda    253:0    0  60G  0 disk 
└─vda1 253:1    0  40G  0 part /


1.扩容块:使用root登陆服务器执行下面命令
type growpart || yum install -y cloud-utils-growpart
LC_ALL=en_US.UTF-8 growpart /dev/vda 1
CHANGED: partition=1 start=2048 old: size=83873317 end=83875365 new: size=125819032,end=125821080

2.扩容文件系统
 blkid
/dev/vda1: UUID="1114fe9e-2309-4580-b183-d778e6d97397" TYPE="ext4" 

通过上面命令查询出来文件系统是ext4的,然后执行下面命令扩容。
resize2fs /dev/vda1
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/vda1 is mounted on /; on-line resizing required
old_desc_blocks = 3, new_desc_blocks = 4
The filesystem on /dev/vda1 is now 15727379 blocks long.


最后在执行lsblk这个命令查看结果。
lsblk
NAME   MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda    253:0    0  60G  0 disk 
└─vda1 253:1    0  60G  0 part /

发表评论 已发布 0

还可以输入 800 个字
 
 
打印