给VMware下的Linux扩容磁盘空间到根分区(以centos7.0为例)
一、扩展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为例)的更多相关文章
- 给VMware下的Linux扩展磁盘空间(以CentOS6.5为例)
#查看挂载点:df -h#显示: 文件系统 容量 已用 可用 已用%% 挂载点/dev/mapper/vg_dc01-lv_root47G 12G 34G 25% /tmpfs 504M 88K 50 ...
- 给VMware下的Linux扩展磁盘空间(以CentOS6.3为例)转
#查看挂载点:df -h#显示:文件系统 容量 已用 可用 已用%% 挂载点/dev/mapper/vg_dc01-lv_root 47G 12G 34G 25% /tmpfs 504M 88K 50 ...
- 给VMware下的Linux扩展磁盘空间(以CentOS6.3为例)
参照这篇文章进行的,但是和作者的步骤有些不一样. #查看挂载点:df -h#显示: 文件系统 容量 已用 可用 已用%% 挂载点/dev/mapper/vg_dc01-lv_root 47G 12G ...
- linux -- 扩容 /home 空间( xfs文件系统分区扩容指定挂载点)
问题: /home空间容量不够使用,扩容卷组,扩容挂载点 方法: 1. 确认有可用的物理磁盘 fdisk -l -- 查看磁盘信息 df -h -- 查看当前挂载信息 vgs -- 查看当前卷组信息 ...
- Linux下使用bcwipe擦除磁盘空间
Linux下使用bcwipe擦除磁盘空间 2 Replies 如果要彻底删除硬盘上的文件,Windows下有磁盘粉碎机,bcwipe等. Linux下,也有bcwipe,而且功能更强大. 擦除磁盘剩余 ...
- VMware下安装Linux(Centos)步骤
VMware下安装Linux(Centos)步骤 准备步骤:(安装软件教程采用 VMware 9 .Centos6.5 为例) 启动VMware的画面 点击File--->New Virtua ...
- VMware下安装Linux系统,ORACLE软件,DBCA建库
操作系统安装 在vmware下安装Linux (OEL5.6),用于数据库服务器 1.打开vmware,选择"创建新的虚拟机" 2.选择自定义安装 3.选择虚拟 ...
- VMware下安装linux虚拟机
安装VMware [下一步] [下一步] 点击[自定义],[下一步] 更改安装目录,[下一步] [下一步] [下一步] [跳过] [完成] 点击桌面图标 如下勾选,输入邮箱,[继续] [完成] 安装l ...
- Linux查看磁盘空间大小命令
Linux查看磁盘空间大小命令df -hldf -hl 查看磁盘剩余空间df -h 查看每个根路径的分区大小du -sh [目录名] 返回该目录的大小du -sm [文件夹] 返回该文件夹总M数du ...
随机推荐
- hdu1907 John 博弈
Little John is playing very funny game with his younger brother. There is one big box filled with M& ...
- whmcs之全民idc
http://manage.cn.resellerclub.com/servlet/LogoutPassServlet 原教程例子:http://sharebar.org/1594.html (该教程 ...
- 手把手教你用MATLAB画灰度直方图
hist =[1,2,3,4,5,6,7,8,7,6,5,4,3,2,1] %15个元素 这个行矩阵(数组)输入到命令行 bar(hist) 用列矩阵也行 hist_im=imhis ...
- Dynamics CRM Solution
Default solution Dynamics comes pre-loaded with a Default Solution Contains all the base objects, en ...
- C# Monitor的Wait和Pulse方法使用详解
[转载]http://blog.csdn.net/qqsttt/article/details/24777553 Monitor的Wait和Pulse方法在线程的同步锁使用中是比较复杂的,理解稍微困难 ...
- linux中和salt中的fqdn测试小节
设置hosts文件和hostname文件 [root@dawn-hnyd-yd-1 ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdoma ...
- js 字符串转对象
使用eval var test = '{ colkey: "col", colsinfo: "NameList" }' var obj2 = eval(&quo ...
- Linux 命令之删除命令
在Linux下删除文件用rm命令,具体用法如下: rm [选项] 文件 选项说明: -f -force 忽略不存在的文件,强制删除,无任何提示 -i --interactive 进行交互式地删除 -r ...
- [C++]String::find
一.定义 string (1) size_t find (const string& str, size_t pos = 0) const; c-string (2) size_t find ...
- matlab:Source Control Integration
http://cn.mathworks.com/help/matlab/source-control.html