VM虚拟机20G磁盘扩展到40G的Linux操作记录
系统CentOS7
原有磁盘20G
先到VM客户端界面中扩展到40G,然后启动系统,进入系统后操作,操作记录如下:
Last login: Wed Dec 11 23:10:40 2019 from 192.168.1.47
[root@cib-server1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel-root 17G 17G 282M 99% /
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 9.0M 1.9G 1% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/sda1 1014M 179M 836M 18% /boot
tmpfs 379M 0 379M 0% /run/user/0
[root@cib-server1 ~]# fdisk -lDisk /dev/sda: 42.9 GB, 42949672960 bytes, 83886080 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
Disk label type: dos
Disk identifier: 0x000ef4fdDevice Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 41943039 19921920 8e Linux LVMDisk /dev/mapper/rhel-root: 18.2 GB, 18249416704 bytes, 35643392 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/mapper/rhel-swap: 2147 MB, 2147483648 bytes, 4194304 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[root@cib-server1 ~]# 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): pDisk /dev/sda: 42.9 GB, 42949672960 bytes, 83886080 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
Disk label type: dos
Disk identifier: 0x000ef4fdDevice Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 41943039 19921920 8e Linux LVMCommand (m for help): n
Partition type:p primary (2 primary, 0 extended, 2 free)e extended
Select (default p):
Using default response p
Partition number (3,4, default 3):
First sector (41943040-83886079, default 41943040):
Using default value 41943040
Last sector, +sectors or +size{K,M,G} (41943040-83886079, default 83886079):
Using default value 83886079
Partition 3 of type Linux and of size 20 GiB is setCommand (m for help): t
Partition number (1-3, default 3): 3
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'Command (m for help): pDisk /dev/sda: 42.9 GB, 42949672960 bytes, 83886080 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
Disk label type: dos
Disk identifier: 0x000ef4fdDevice Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 41943039 19921920 8e Linux LVM
/dev/sda3 41943040 83886079 20971520 8e Linux LVMCommand (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.
[root@cib-server1 ~]# ll /dev/sda*
brw-rw---- 1 root disk 8, 0 Dec 12 01:45 /dev/sda
brw-rw---- 1 root disk 8, 1 Dec 12 01:45 /dev/sda1
brw-rw---- 1 root disk 8, 2 Dec 12 01:45 /dev/sda2
[root@cib-server1 ~]# partx -a /dev/sda
partx: /dev/sda: error adding partitions 1-2
[root@cib-server1 ~]# ll /dev/sda*
brw-rw---- 1 root disk 8, 0 Dec 12 01:45 /dev/sda
brw-rw---- 1 root disk 8, 1 Dec 12 01:45 /dev/sda1
brw-rw---- 1 root disk 8, 2 Dec 12 01:45 /dev/sda2
brw-rw---- 1 root disk 8, 3 Dec 12 01:45 /dev/sda3
[root@cib-server1 ~]# pvcreate /dev/sda3Physical volume "/dev/sda3" successfully created.
[root@cib-server1 ~]# pvsPV VG Fmt Attr PSize PFree /dev/sda2 rhel lvm2 a-- <19.00g 0 /dev/sda3 lvm2 --- 20.00g 20.00g
[root@cib-server1 ~]# vgsVG #PV #LV #SN Attr VSize VFreerhel 1 2 0 wz--n- <19.00g 0
[root@cib-server1 ~]# vgextend rhel /dev/sda3Volume group "rhel" successfully extended
[root@cib-server1 ~]# vgsVG #PV #LV #SN Attr VSize VFree rhel 2 2 0 wz--n- 38.99g <20.00g
[root@cib-server1 ~]# lvsLV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convertroot rhel -wi-ao---- <17.00g swap rhel -wi-ao---- 2.00g
[root@cib-server1 ~]# lvextend -l +100%FREE /dev/sda
/dev/sda2 /dev/sda3
[root@cib-server1 ~]# ll /dev/mapper/
total 0
crw------- 1 root root 10, 236 Dec 12 01:44 control
lrwxrwxrwx 1 root root 7 Dec 12 01:44 rhel-root -> ../dm-0
lrwxrwxrwx 1 root root 7 Dec 12 01:44 rhel-swap -> ../dm-1
[root@cib-server1 ~]# lvextend -l +100%FREE /dev/mapper/rhel-rootSize of logical volume rhel/root changed from <17.00 GiB (4351 extents) to 36.99 GiB (9470 extents).Logical volume rhel/root successfully resized.
[root@cib-server1 ~]# lvsLV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convertroot rhel -wi-ao---- 36.99g swap rhel -wi-ao---- 2.00g
[root@cib-server1 ~]# xfs_growfs /
meta-data=/dev/mapper/rhel-root isize=512 agcount=4, agsize=1113856 blks= sectsz=512 attr=2, projid32bit=1= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=4455424, imaxpct=25= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal 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 4455424 to 9697280
[root@cib-server1 ~]# df -h
(END)
VM虚拟机20G磁盘扩展到40G的Linux操作记录相关推荐
- 虚拟机 Win10 磁盘扩展 “文件系统的空间不足,无法...” VMware 15 C盘扩展 磁盘扩容 VMware Workstation 显示 提示
文章最后更新于2022.11.22,13:08pm,希望对你有帮助 目录 不知道写啥,按顺序看吧,哈哈 看!虚拟机的Win10 C盘已经红了,为了增加C盘的容量,删了重新安装一个Win10的方法太过麻 ...
- VM虚拟机装机ubuntu之BUG和获取文件操作权限
BUG1:因为需要将主机用XShell连接虚拟机ubuntu系统,要查虚拟机ip地址,但是输入ifconfig没有用 解决办法: 参考https://www.cnblogs.com/flw0322/p ...
- VM虚拟机中Linux扩展磁盘空间的方法
一.Vm虚拟机下Linux扩展原有磁盘空间,详细步骤如下: 需注意以下几点: linux只能扩展磁盘容量而不能减小, 所填写的容量为总容量,即包含已分区的磁盘, 扩展容量时不能有快照哟,大家可以先把快 ...
- vm虚拟机linux磁盘空间不足,手动扩大
vm虚拟机linux磁盘空间不足,手动扩大 随着Linux虚拟机的不断使用,在VMware中经常遇到 预先装好的 linux 虚拟机的硬盘空间过小 的问题,造成很多软件不能安装, 而重新装一个,又挺麻 ...
- Oracle VM VirtualBox Manager中扩展虚拟机硬盘空间
您可以按照以下步骤在Oracle VM VirtualBox Manager中扩展虚拟机硬盘空间: 1. 在VirtualBox Manager中,选择要扩展的虚拟机并停止它. 2. ...
- vmware 扩展Ubuntu虚拟机的磁盘空间
1. df -h 指令查看一下磁盘空间的使用情况 2. 编辑虚拟机设置 3. 输入sudo apt-get install gparted指令,安装GParted软件 4. 再次查看,一切都好了. 参 ...
- Ubuntu虚拟机磁盘扩容+VM虚拟机开机多出1分30秒的解决方案(终极教程)
详细步骤,请参考我电脑上的Word:[在用] Word:Ubuntu虚拟机磁盘扩容+VM虚拟机开机多出1分30秒的解决方案(终极教程) 扩容简单总结: 参考1:https://www.cnblogs. ...
- 增加VirtualBox虚拟机的磁盘空间大小(Host:Win7 VirtualBox5.0.16 VM:Win10)
1 前言 网上关于增加VirtualBox虚拟机的磁盘空间大小的文章非常非常多,这里我之所以再写一篇,是因为在参照这些文章做的时候,由于VirtualBox的版本更新以及其他一些环境问题,碰到到一些问 ...
- 虚拟机macos 怎么扩展磁盘空间_Parallels Desktop 15 for Mac(pd虚拟机) v15.1.2.47123已更新...
哪里有适用于最新的10.15系统的pd虚拟机?小编为您带来pd虚拟机介绍.Parallels Desktop 15 mac版是mac上最强大也是最好用的虚拟机软件,最新版本的parallels des ...
最新文章
- 算法(第4版)Algorithms, Fourth Edition
- 每日一皮:测试的时候一切ok,真正上线的时候……
- libcusolver.so.8.0: cannot open shared object file: No such file or director
- 用Telnet 来用smtp发邮件。。 send mail by SMTP server
- 利用Inception-V3训练的权重微调,实现猫狗分类(基于keras)
- Spring Boot基础讲解
- 物联网其实只是一个话题
- pytorch/tensorflow 查看 cuda 是否可用
- linux怎么打开rdp文件,Linux运维知识:linux实现rdp访问
- activimq java集成_Java消息队列-Spring整合ActiveMq
- MyEclipse创建Java项目
- 【2021最新版】Java基础面试题总结(70道题含答案解析)
- 基于Python和OpenCV的图像目标检测及分割
- VScode运行MATLAB
- php拆分excel,PHPExcel合并与拆分单元格的方法
- java id 锁_java 多线程synchronized同步锁锁住相同用户Id
- MATLAB图中图绘制(局部放大图)
- java:文本框的简单使用
- 程序的时间和空间复杂度
- Linux系统上没有scp命令,Linux scp命令没反应
热门文章
- UVA-12627(考眼力~)
- 「Flink实时数据分析系列」2. 流处理基本概念
- 面试官问我 “String 的不可变真的是因为 final 吗“,我回答 “是“ 然后就被挂了。。。。。。
- 自然语言处理(NLP)-模型常用技巧:Mask【Padding Mask、Subsequent Mask】
- 美国人初学Python100个代码题目之2
- http中的204和205
- Scrapy 西瓜皮框架
- make install clean的意思
- nodejs 获取系统环境变量_Node.js中环境变量process.env的一些事详解
- 一次性免费临时邮箱,专注个人隐私保护