一、扩展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. day09 MapReduce

    , PS:上图为MapReduce原理全解剖, 图上带红色标识的部分是能够自定义的1.首先要解决读文件的问题. mapTask中有个read()方法,专门负责读取键值对,而且是整行整行的读2.在读好文 ...

  2. Java中的权限学习笔记

    1.Java中的权限有两个层次,一个是类这一层,另一个是类成员那一层. 类这一层: public class可以在本包内被访问,也可以在包外被访问.而没有被public修饰的class只能在本包内被调 ...

  3. sqler sql 转rest api 防止sql 注入

    sqler 对于sql Sanitization 的处理,我们可以使用bind 指令 说明: 这个是2.0 的功能,注意版本的使用 参考格式   addpost {    // $input is a ...

  4. Makefile introduction (very old presentation)

  5. php7 php-fpm 重启

    PHP7中php.ini.php-fpm和www.conf的配置 http://www.tuicool.com/articles/NjmQNj6 php-fpm 关闭:  kill -SIGINT ` ...

  6. java 打印图形

    打印菱形 package study.stage2; /** * Created by Sandy.Liu on 2017/7/27. */public class Diamond { public ...

  7. checkbox复选框,如何让其勾选时触发一个事件,取消勾选时不触发

    <input type="checkbox" onclick="checkboxOnclick(this)" /> <script> f ...

  8. 阿里云香港B区通过IPV6规避Google验证码

    最近买了阿里云香港B来FQ,然而被Google的验证码折磨的死去活来.四处查询,终于找到了一个合适的方案. 添加IPV6支持 阿里云香港是没有IPV6地址的,需要一个tunnel,这边使用HE.NET ...

  9. Spring Http Invoker使用简介

    一.Spring HTTP Invoker简介 Spring HTTP invoker 是 spring 框架中的一个远程调用模型,执行基于 HTTP 的远程调用(意味着可以通过防火墙),并使用 ja ...

  10. flume 前世今生

    Cloudera 开发的分布式日志收集系统 Flume,是 hadoop 周边组件之一.其可以实时的将分布在不同节点.机器上的日志收集到不同的存储系统.Flume 初始的发行版本目前被统称为 Flum ...