linux如何扩展根分区,linux扩展根分区详细步骤
Linux虚拟机扩展根分区!
虚拟机根分区空间不够用,在虚拟机管理界面进行单个磁盘扩展(图形化界面操作略),比如原来是30G,扩展至40G,(扩展需要关机之后操作)
其中的10G空间需要重新分区,以下是分区相关操作让扩展的空间生效:
登录系统之后:
df -h 发现空间没有发生变化:
[root@lub ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
25G 19G 4.2G 82% /
tmpfs 642M 0 642M 0% /dev/shm
/dev/sda1 485M 34M 426M 8% /boot
fdisk -l 发现总容量已经扩展。
[root@lub ~]# fdisk -l
Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00069f1c
------------------------------
对扩展的磁盘进行分区:
[root@lub ~]# fdisk /dev/sda
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): p
Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00069f1c
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 4047 31992832 8e Linux LVM
Command (m for help): n
Command action
e extended
p primary partition (1-4)
3
Invalid partition number for type `3'
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (4047-5221, default 4047):
Using default value 4047
Last cylinder, +cylinders or +size{K,M,G} (4047-5221, default 5221):
Using default value 5221
Command (m for help): p -------查看分区后的情况
Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00069f1c
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 4047 31992832 8e Linux LVM
/dev/sda3 4047 5221 9431826+ 83 Linux
---新增的sda3
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.
[root@lub ~]#
--------------------使用命令发现partprobe /dev/sda3发现分区并没有起作用:
[root@lub ~]# partprobe /dev/sda3
Error: Could not stat device /dev/sda3 - No such file or directory.
[root@lub ~]# pvcreate /dev/sda3
Device /dev/sda3 not found (or ignored by filtering).
-----重启系统。
------LVM操作。扩展根分区
[root@lub ~]# pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created
[root@lub ~]# vgs
VG #PV #LV #SN Attr VSize VFree
VolGroup 1 2 0 wz--n- 30.51g 0
[root@lub ~]# vgextend VolGroup /dev/sda3
Volume group "VolGroup" successfully extended
[root@lub ~]# vgs
VG #PV #LV #SN Attr VSize VFree
VolGroup 2 2 0 wz--n- 39.50g 8.99g
[root@lub ~]# lvextend -L +8.99G /dev/mapper/VolGroup-lv_root
Rounding size to boundary between physical extents: 8.99 GiB
Extending logical volume lv_root to 33.50 GiB
Logical volume lv_root successfully resized
[root@lub ~]# resize2fs /dev/mapper/VolGroup-lv_root
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/VolGroup-lv_root is mounted on /; on-line resizing required
old desc_blocks = 2, new_desc_blocks = 3
Performing an on-line resize of /dev/mapper/VolGroup-lv_root to 8781824 (4k) blocks.
The filesystem on /dev/mapper/VolGroup-lv_root is now 8781824 blocks long.
----命令操作根分区情况,发现已经生效:
[root@lub ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
33G 19G 13G 60% /
tmpfs 642M 0 642M 0% /dev/shm
/dev/sda1 485M 34M 426M 8% /boot
[root@lub ~]#
完成扩展。!
linux如何扩展根分区,linux扩展根分区详细步骤相关推荐
- linux iis安装教程,易企秀源码在linux、win主机下的安装教程和详细步骤(含伪静态设置)...
1.源码完整上传至服务器空间,并解压 2.修改数据库配置文件Application/Common/Conf/systemConfig.php,将里面的数据库信息修改成你自己的,推荐使用Notepad+ ...
- linux安装mysql后怎么进去_linux安装mysql详细步骤
最近买了个腾讯云服务器,搭建环境. 该笔记用于系统上未装过mysql的干净系统第一次安装mysql.自己指定安装目录,指定数据文件目录. linux系统版本: CentOS 7.3 64位 安装源文件 ...
- linux查看报警信息,linux_监控zabbix微信报警详细步骤
Zabbix微信报警 1.环境: 系统:CentOS Linux release 7.5.1804 (Core) 内核:3.10.0-862.6.3.el7.x86_64 zabbix已经部署完毕 2 ...
- 海蜘蛛软路由linux安装教程,软路由安装设置教程【详细步骤】-太平洋IT百科
导读:随着 现代 生活中科学技术的不断发展,网络应用成为家家必须的东西,更因为如此也出现了如今的"低头族"们,不过在家庭中我们所使用的网络都需要有路由器这样的设备,其实路由器也分为 ...
- linux修改用户名、密码、组名等详细步骤
1.修改root密码 sudo passwd root2.修改用户密码(如abc) sudo passwd abc3.修改主机名: sudo vim /etc/hostname 将旧主机名 改为 新主 ...
- Linux中一个ip绑定多个域名的详细步骤
操作平台:Centos 7 建议:执行本文操作前,请对linux系统先拍照存档,以免造成操作过程中出现错误,导致重装linux系统的尴尬! 上菜!上菜! 1.指定IP地址与域名之间的对应关系 [roo ...
- qt单步调试linux程序,用Qt 调用GDB调试 Arm程序 详细步骤----可单步执行每一行
前言 本人交叉编译环境 Ubuntu 10.04(虚拟机),编译工具链 arm-hisiv100nptl-linux,Qt 4.8.5 ,QtCreator1.3.1 1.在虚拟机Ubuntu 10. ...
- Linux|Qt工作笔记-linux系统下安装qt4.5.3版本的详细步骤
原文地址如下: https://blog.csdn.net/AmyAndTommy/article/details/81901005 第一步:下载qt-all-opensource-src-4.5.3 ...
- 在Linux配置Git SSH的详细步骤;git配置ssh详细教程;
在Linux或Mac OS上配置Git SSH的详细步骤如下: 1.打开终端,并输入以下命令检查是否已经在Linux下安装git git --version已安装,则获取git版本信息成功 2.如果已 ...
- linux开机自启动python脚本_Linux下Python脚本自启动和定时启动的详细步骤
一.Python开机自动运行 假如Python自启动脚本为 auto.py .那么用root权限编辑以下文件: sudo vim /etc/rc.local 如果没有 rc.local 请看 这篇文章 ...
最新文章
- iOS开发 - OC - block的详解 - 深入篇
- centos7 各版本区别 DVD Netinstall Everything Minimal GnomeLive KdeLive
- 微软私有云分享(R2)5-域升级造成Hyper-V主机无法实时迁移
- LIGHTOJ 1044(动态规划)
- Cow Contest POJ - 3660
- 位置问题_改变铸件浇注入水位置,能解决哪些问题?
- Linux 技巧: 从命令行创建像素标尺
- pyspark的ALS协同过滤推荐算法-小结1
- c语言 键盘输入结构体,C语言结构体问题
- python抽取html中的链接
- Avro, Protocol Buffers 、Thrift的联系与区别
- python下载百度文库文档_简单实用的下载百度文库文档的方法
- JS处理支付宝H5支付
- 文本自动校对技术研究综述
- 3 整型变量,实型数据(主要是实型变量)2021-01-25
- C# 实现数字转汉字大写
- php展厅控制系统,展厅中控系统
- 商品模块的业务流程图
- google的一些秘密入口 很好玩
- 直观说明Hadoop是什么?有什么作用?
热门文章
- 深度学习核心技术精讲100篇(六十四)-特征选择原理及应用实战案例
- 产品经理必备知识之网页设计系列(一)-创建出色用户体验
- 深度学习核心技术精讲100篇(十)-机器学习模型融合之Kaggle如何通过Stacking提升模型性能
- MATLAB数据处理快速学习教程
- python把图片另存为_pycharm sciview的图片另存为操作
- idea console中文乱码_Python3的字符编码乱码问题解决思路
- 卸载后的mysql和navicat怎么清除干净_小而巧的卸载工具
- 深度学习100例-卷积神经网络(CNN)3D医疗影像识别 | 第23天
- 中文文本情感分析-python包SnowNLP入门
- 【算法与数据结构】最大子序列和问题