centos7扩展磁盘空间

本文介绍了在CentOS7中如何扩展磁盘空间,包括非LVM和LVM两种情况。首先,虚拟机硬盘容量从20G扩展到100G。在非LVM环境下,通过fdisk创建新分区,格式化为xfs文件系统,挂载并设置开机自动挂载。在LVM环境下,创建物理卷,将其加入卷组,扩展逻辑卷大小,并同步文件系统。最终,验证了扩展操作的成功。
摘要由CSDN通过智能技术生成

准备

vmware安装centos7,在lvm下和非lvm下分别进行测试

虚拟机扩展硬盘容量

在这里插入图片描述
选择扩展将原来的20g扩展到100g

非lvm下如何扩展磁盘

fdisk -l发现只有一个盘/dev/sda,分成了3个区,sda1,sda2,sda3

Disk /dev/sda: 20.4 GB
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: 0x000bbf20

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      616447      307200   83  Linux
/dev/sda2          616448     4810751     2097152   82  Linux swap / Solaris
/dev/sda3         4810752    41943039    18566144   83  Linux

开始分区

[root@promote ~]# fdisk /dev/sda
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   g   create a new empty GPT partition table
   G   create an IRIX (SGI) partition table
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition
  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值