VMware中的Centos8系统盘扩容

查询磁盘挂载情况

[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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值