一、扩展VMWare硬盘空间

关闭Vmware 的 Linux系统,这样,才能在VMWare菜单中设置:

  VM -> Settings... -> Hardware -> Hard Disk -> Utilities -> Expand

  输入你想要扩展到多少G。

二、对新增加的硬盘进行分区、格式化

查看挂载点

# df -Th

[root@localhost ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/centos-root xfs 15G .2G 14G % /
devtmpfs devtmpfs .9G .9G % /dev
tmpfs tmpfs .9G .9G % /dev/shm
tmpfs tmpfs .9G 8.6M .9G % /run
tmpfs tmpfs .9G .9G % /sys/fs/cgroup
/dev/sda1 xfs 197M 110M 88M % /boot
tmpfs tmpfs 378M 378M % /run/user/

查看硬盘信息

# lsblk

[root@localhost ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda : 150G disk
├─sda1 : 200M part /boot
└─sda2 : 17G part
├─centos-root : 15G lvm /
└─centos-swap : 2G lvm [SWAP]
sr0 : 4G rom

查看逻辑卷

# lvs

[root@localhost ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root centos -wi-ao---- .00g
swap centos -wi-ao---- .00g

对扩容的硬盘进行分区

# fdisk /dev/sda

Welcome to fdisk (util-linux 2.23.).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command. Command (m for help): n
Partition type:
p primary ( primary, extended, free)
e extended
Select (default p): p
Partition number (,, default ):
First sector (-, default ):
Using default value
Last sector, +sectors or +size{K,M,G} (-, default ): +100G
Partition of type Linux and of size GiB is set Command (m for help): p Disk /dev/sda: 161.1 GB, bytes, sectors
Units = sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk label type: dos
Disk identifier: 0x00007397 Device Boot Start End Blocks Id System
/dev/sda1 * Linux
/dev/sda2 8e Linux LVM
/dev/sda3 Linux Command (m for help): t
Partition number (-, default ):
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM' Command (m for help): p Disk /dev/sda: 161.1 GB, bytes, sectors
Units = sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk label type: dos
Disk identifier: 0x00007397 Device Boot Start End Blocks Id System
/dev/sda1 * Linux
/dev/sda2 8e Linux LVM
/dev/sda3 8e Linux LVM Command (m for help): w
The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

需要重启才能生效

#reboot

重启后查看硬盘信息

# lsblk

[root@localhost ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda : 150G disk
├─sda1 : 200M part /boot
├─sda2 : 17G part
│ ├─centos-root : 15G lvm /
│ └─centos-swap : 2G lvm [SWAP]
└─sda3 8:3 0 100G 0 part
sr0 : 4G rom

分区格式化

# mkfs -t ext4 /dev/sda3

[root@localhost ~]# mkfs -t ext4 /dev/sda3
mke2fs 1.42. (-Dec-)
Filesystem label=
OS type: Linux
Block size= (log=)
Fragment size= (log=)
Stride= blocks, Stripe width= blocks
inodes, blocks
blocks (5.00%) reserved for the super user
First data block=
Maximum filesystem blocks=
block groups
blocks per group, fragments per group
inodes per group
Superblock backups stored on blocks:
, , , , , , , , ,
, , , , Allocating group tables: done
Writing inode tables: done
Creating journal ( blocks): done
Writing superblocks and filesystem accounting information: done

创建物理卷

#pvcreate /dev/sda3

[root@localhost ~]# pvcreate /dev/sda3
WARNING: xfs signature detected on /dev/sda3 at offset . Wipe it? [y/n]: y
Wiping xfs signature on /dev/sda3.
Physical volume "/dev/sda3" successfully created

加入根分区的逻辑卷组

# vgextend centos /dev/sda3

[root@localhost ~]# vgextend centos /dev/sda3
Volume group "centos" successfully extended

查看确认

[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas
Metadata Sequence No
VG Access read/write
VG Status resizable
MAX LV
Cur LV
Open LV
Max PV
Cur PV
Act PV
VG Size 117.00 GiB
PE Size 4.00 MiB
Total PE
Alloc PE / Size / 17.00 GiB
Free PE / Size / 100.00 GiB
VG UUID a27Boi-C0ue-9PCo-1rPZ-BsjW-9IRg-Woh4uX

扩容

# lvextend -L +100G /dev/centos/root

[root@localhost ~]# lvextend -L +100G /dev/centos/root
Size of logical volume centos/root changed from 15.00 GiB ( extents) to 115.00 GiB ( extents).
Logical volume root successfully resized.

操作生效

# xfs_growfs /dev/centos/root

[root@localhost ~]# xfs_growfs /dev/centos/root
meta-data=/dev/mapper/centos-root isize= agcount=, agsize= blks
= sectsz= attr=, projid32bit=
= crc= finobt=
data = bsize= blocks=, imaxpct=
= sunit= swidth= blks
naming =version bsize= ascii-ci= ftype=
log =internal bsize= blocks=, version=
= sectsz= sunit= blks, lazy-count=
realtime =none extsz= blocks=, rtextents=
data blocks changed from to

查看是否成功扩容

# df -Th

[root@localhost ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/centos-root xfs 115G .2G 114G % /
devtmpfs devtmpfs .9G .9G % /dev
tmpfs tmpfs .9G .9G % /dev/shm
tmpfs tmpfs .9G 8.6M .9G % /run
tmpfs tmpfs .9G .9G % /sys/fs/cgroup
/dev/sda1 xfs 197M 110M 88M % /boot
tmpfs tmpfs 378M 378M % /run/user/

# vgdisplay

[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas
Metadata Sequence No
VG Access read/write
VG Status resizable
MAX LV
Cur LV
Open LV
Max PV
Cur PV
Act PV
VG Size 117.00 GiB
PE Size 4.00 MiB
Total PE
Alloc PE / Size / 117.00 GiB
Free PE / Size /
VG UUID a27Boi-C0ue-9PCo-1rPZ-BsjW-9IRg-Woh4uX

参考博客:

Linux中VMware虚拟机增加磁盘空间的扩容操作

https://www.cnblogs.com/matengfei123/p/7986259.html

给VMware下的Linux扩展磁盘空间(以CentOS6.5为例)

https://www.cnblogs.com/shijiaoyun/p/6207699.html

end

给VMware下的Linux扩容磁盘空间到根分区(以centos7.0为例)的更多相关文章

  1. 给VMware下的Linux扩展磁盘空间(以CentOS6.5为例)

    #查看挂载点:df -h#显示: 文件系统 容量 已用 可用 已用%% 挂载点/dev/mapper/vg_dc01-lv_root47G 12G 34G 25% /tmpfs 504M 88K 50 ...

  2. 给VMware下的Linux扩展磁盘空间(以CentOS6.3为例)转

    #查看挂载点:df -h#显示:文件系统 容量 已用 可用 已用%% 挂载点/dev/mapper/vg_dc01-lv_root 47G 12G 34G 25% /tmpfs 504M 88K 50 ...

  3. 给VMware下的Linux扩展磁盘空间(以CentOS6.3为例)

    参照这篇文章进行的,但是和作者的步骤有些不一样. #查看挂载点:df -h#显示: 文件系统 容量 已用 可用 已用%% 挂载点/dev/mapper/vg_dc01-lv_root 47G 12G ...

  4. linux -- 扩容 /home 空间( xfs文件系统分区扩容指定挂载点)

    问题: /home空间容量不够使用,扩容卷组,扩容挂载点 方法: 1. 确认有可用的物理磁盘 fdisk -l -- 查看磁盘信息 df -h -- 查看当前挂载信息 vgs -- 查看当前卷组信息 ...

  5. Linux下使用bcwipe擦除磁盘空间

    Linux下使用bcwipe擦除磁盘空间 2 Replies 如果要彻底删除硬盘上的文件,Windows下有磁盘粉碎机,bcwipe等. Linux下,也有bcwipe,而且功能更强大. 擦除磁盘剩余 ...

  6. VMware下安装Linux(Centos)步骤

    VMware下安装Linux(Centos)步骤 准备步骤:(安装软件教程采用 VMware 9 .Centos6.5 为例) 启动VMware的画面 点击File--->New Virtua ...

  7. VMware下安装Linux系统,ORACLE软件,DBCA建库

    操作系统安装   在vmware下安装Linux (OEL5.6),用于数据库服务器 1.打开vmware,选择"创建新的虚拟机"       2.选择自定义安装   3.选择虚拟 ...

  8. VMware下安装linux虚拟机

    安装VMware [下一步] [下一步] 点击[自定义],[下一步] 更改安装目录,[下一步] [下一步] [下一步] [跳过] [完成] 点击桌面图标 如下勾选,输入邮箱,[继续] [完成] 安装l ...

  9. Linux查看磁盘空间大小命令

    Linux查看磁盘空间大小命令df -hldf -hl 查看磁盘剩余空间df -h 查看每个根路径的分区大小du -sh [目录名] 返回该目录的大小du -sm [文件夹] 返回该文件夹总M数du ...

随机推荐

  1. Go Example--Hello

    Hello world package main import "fmt" //通过import导入fmt标准包 func main() { //语句结尾不需要;分号, //Pri ...

  2. LeetCode - Partition Labels

    A string S of lowercase letters is given. We want to partition this string into as many parts as pos ...

  3. POJ2480 Longge's problem

    题意 Language:Default Longge's problem Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 1064 ...

  4. itcast-spring

    黑马2014  spring后期 ssh整合后期  讲解不清楚 源码讲解太多   spring重新开始  itcast2016版本 介绍 Spring搭建 约束引入注意事项 导入至eclipse:wi ...

  5. oracle之logminer日志分析

    alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss'; select sysdate from dual; 执行增删操作 alter sy ...

  6. Singer 学习五 docker 运行说明

    介绍过一个工具knots ,方便Singer 可视化开发的工具,但是默认这个工具包含的tap 以及target 比较少(可以自己扩展) 同时这个工具就是基于docker 运行的 docker 运行的几 ...

  7. Bat相关的项目应用

    原 bat 命令如何启动远程PC上的一个程序? 原 bat 自动解压缩,发布asp.net程序 原 bat 自动更新代码,编译,压缩asp.net程序 原 bat自动备份压缩文件 原 bat命令ora ...

  8. Bitvise 使用公私玥免密登陆 服务器

    远程机linux 首先需要把 生成 公私玥,并且把公钥 写到 远程linux 主机的,你要登陆的用户下面 的.ssh 文件里面的authorized_keys 文件里面.这个参考我的另一篇关于linu ...

  9. openstack常见问题

    openstack通过kolla-ansible添加一个计算节点,并部署后,发现控制节点上无法发现新加的计算节点, 在控制节点的  nova_scheduler.nova_api容器上执行发现计算节点 ...

  10. JAVA_HOME 设置为JDK 7无效

    场景: Window 10中有Jdk 7和jdk8, 还有Oracle配置 环境变量的配置如下 然后JAVA_HOME 设置为java 7 但是java -version显示为java 8 解决方法 ...