Openstack 虚拟机云盘扩容

安装growpart工具

[root@web-1 ~]# yum install cloud-utils-growpart

查看磁盘情况

[root@web-1 ~]# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0     11:0    1  470K  0 rom
vda    253:0    0   10G  0 disk
└─vda1 253:1    0    5G  0 part /

使用growpart工具扩容分区

[root@web-1 ~]# growpart /dev/vda 1
unexpected output in sfdisk --version [sfdisk,来自 util-linux 2.23.2]

报错解决

root@web-1 ~]# export LANG=en_US.UTF-8
[root@web-1 ~]# growpart /dev/vda 1
CHANGED: partition=1 start=2048 old: size=10483712 end=10485760 new: size=20969439 end=20971487

使用 xfs_growfs工具扩容文件系统

root@web-1 ~]# xfs_growfs /dev/vda1
meta-data=/dev/vda1              isize=512    agcount=4, agsize=327616 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=1310464, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 1310464 to 2621179

验证

root@web-1 ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        10G  1.4G  8.7G  14% /
devtmpfs        909M     0  909M   0% /dev
tmpfs           920M     0  920M   0% /dev/shm
tmpfs           920M  8.5M  911M   1% /run
tmpfs           920M     0  920M   0% /sys/fs/cgroup
tmpfs           184M     0  184M   0% /run/user/0

你可能感兴趣的:(openstack,linux,运维,服务器)