VMware中的Centos8系统盘扩容

导读:本篇文章讲解 VMware中的Centos8系统盘扩容,希望对大家有帮助,欢迎收藏,转发!站点地址:www.bmabk.com

查询磁盘挂载情况

[root@localhost ~]# df -h

Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        3.6G     0  3.6G   0% /dev
tmpfs           3.6G     0  3.6G   0% /dev/shm
tmpfs           3.6G  9.8M  3.6G   1% /run
tmpfs           3.6G     0  3.6G   0% /sys/fs/cgroup
/dev/sda3        18G   18G  304K 100% /
/dev/sda1       295M  173M  122M  59% /boot
tmpfs           724M  1.2M  723M   1% /run/user/42
tmpfs           724M     0  724M   0% /run/user/0

查看磁盘情况

[root@localhost ~]# fdisk -l
Disk /dev/sda: 80 GiB, 85899345920 bytes, 167772160 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
Disklabel type: dos
Disk identifier: 0xc443608a

Device     Boot    Start       End   Sectors  Size Id Type
/dev/sda1  *        2048    616447    614400  300M 83 Linux
/dev/sda2         616448   4810751   4194304    2G 82 Linux swap / Solaris
/dev/sda3        4810752  41943039  37132288 17.7G 83 Linux

对第3个分区扩容

[root@localhost ~]# growpart /dev/sda 3
CHANGED: partition=3 start=4810752 old: size=37132288 end=41943040 new: size=162961375 end=167772127

调用resize2fs扩容文件系统(提示异常)

[root@localhost ~]# resize2fs /dev/sda3
resize2fs 1.45.6 (20-Mar-2020)
resize2fs: Bad magic number in super-block while trying to open /dev/sda3
Couldn't find valid filesystem superblock.

如果是xfs格式的文件扩充需要使用 xfs_growfs

[root@localhost ~]# xfs_growfs /dev/sda3
meta-data=/dev/sda3              isize=512    agcount=4, agsize=1160384 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=1, rmapbt=0
         =                       reflink=1
data     =                       bsize=4096   blocks=4641536, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           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 4641536 to 20370171

查看扩容后

[root@localhost ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        3.6G     0  3.6G   0% /dev
tmpfs           3.6G     0  3.6G   0% /dev/shm
tmpfs           3.6G  9.7M  3.6G   1% /run
tmpfs           3.6G     0  3.6G   0% /sys/fs/cgroup
/dev/sda3        78G   19G   60G  24% /
/dev/sda1       295M  173M  122M  59% /boot
tmpfs           724M  1.2M  723M   1% /run/user/42
tmpfs           724M  4.0K  724M   1% /run/user/0

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/15382.html

(0)
小半的头像小半

相关推荐

极客之音——专业性很强的中文编程技术网站,欢迎收藏到浏览器,订阅我们!