虚拟机中CentOS 6.5 添加扩展分区
此扩展方法要求支持LVM
1、更改虚拟机配置
虚拟机->设置->硬盘->扩展磁盘容量

fdisk -l 查看,发现硬盘空间变大了
[root@thj Desktop]# fdisk -l Disk /dev/sda: 42.9 GB, bytes
heads, sectors/track, cylinders
Units = cylinders of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk identifier: 0x000812b5 Device Boot Start End Blocks Id System
/dev/sda1 * Linux
Partition does not end on cylinder boundary.
/dev/sda2 8e Linux LVM Disk /dev/mapper/vg_thj-lv_root: 18.9 GB, bytes
heads, sectors/track, cylinders
Units = cylinders of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk identifier: 0x00000000 Disk /dev/mapper/vg_thj-lv_swap: MB, bytes
heads, sectors/track, cylinders
Units = cylinders of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk identifier: 0x00000000
2、创建分区
[root@thj Desktop]# 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, bytes
heads, sectors/track, cylinders
Units = cylinders of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk identifier: 0x000812b5 Device Boot Start End Blocks Id System
/dev/sda1 * Linux
Partition does not end on cylinder boundary.
/dev/sda2 8e Linux LVM Command (m for help): n #创建新的分区
Command action
e extended
p primary partition (-)
p #创建为主分区
Partition number (-):
First cylinder (-, default ):
Using default value #默认就好
Last cylinder, +cylinders or +size{K,M,G} (-, default ):
Using default value #默认就好 Command (m for help): p #查看分区表 Disk /dev/sda: 42.9 GB, bytes
heads, sectors/track, cylinders
Units = cylinders of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk identifier: 0x000812b5 Device Boot Start End Blocks Id System
/dev/sda1 * Linux
Partition does not end on cylinder boundary.
/dev/sda2 8e Linux LVM
/dev/sda3 + Linux 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 : 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() or kpartx()
Syncing disks.
设置完后,reboot重启系统
3、格式化分区
[root@thj Desktop]# mkfs.ext3 /dev/sda3
mke2fs 1.41. (-May-)
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:
, , , , , , , , , Writing inode tables: done
Creating journal ( blocks): done
Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every mounts or
days, whichever comes first. Use tune2fs -c or -i to override.
4、加入LVM,并挂载到根目录下
- vgs 查看卷组情况
[root@thj Desktop]# vgs
VG #PV #LV #SN Attr VSize VFree
vg_thj wz--n- .51g //有一个vg_thj卷组(此处系统不同会有所不同)
- 创建物理卷(LVM分区),并将物理卷加入vg_thj组里
[root@thj Desktop]# lvm
lvm> pvcreate /dev/sda3 //创建一个LVM硬分区
Physical volume "/dev/sda3" successfully created
lvm> vgextend vg_thj /dev/sda3 //加入与根目录同一个LVM组
Volume group "vg_thj" successfully extended
- 查看 lv path
[root@thj Desktop]# lvdisplay
--- Logical volume ---
LV Path /dev/vg_thj/lv_root //root对应的lv path
LV Name lv_root
VG Name vg_thj
LV UUID FMlzw9-r8dt-2Oa1-mS0W-brnn-YsDm-g3ld5S
LV Write Access read/write
LV Creation host, time thj.localthj, -- :: +
LV Status available
# open
LV Size 17.57 GiB
Current LE
Segments
Allocation inherit
Read ahead sectors auto
- currently set to
Block device : --- Logical volume ---
LV Path /dev/vg_thj/lv_swap
LV Name lv_swap
VG Name vg_thj
LV UUID lLgahm-QUMF-XHiN-jZJc-F5ve-YycI-FmEVdr
LV Write Access read/write
LV Creation host, time thj.localthj, -- :: +
LV Status available
# open
LV Size 1.94 GiB
Current LE
Segments
Allocation inherit
Read ahead sectors auto
- currently set to
Block device :
- 扩展 lv path
[root@thj Desktop]# lvextend -L +.99G /dev/vg_thj/lv_root
Rounding size to boundary between physical extents: 19.99 GiB.
Size of logical volume vg_thj/lv_root changed from 17.57 GiB ( extents) to 37.56 GiB ( extents).
Logical volume lv_root successfully resized.
- 重置主分区大小
[root@thj Desktop]# resize2fs /dev/vg_thj/lv_root
resize2fs 1.41. (-May-)
Filesystem at /dev/vg_thj/lv_root is mounted on /; on-line resizing required
old desc_blocks = , new_desc_blocks =
Performing an on-line resize of /dev/vg_thj/lv_root to (4k) blocks.
The filesystem on /dev/vg_thj/lv_root is now blocks long.
有时报错:
[root@thj Desktop]# lvextend -L +19G /dev/vg_thj/lv_root
Couldn't find device with uuid N0xspW-ZOct-v7pH-GHRN-G1Ck-0CnJ-ghqEKZ.
Cannot change VG vg_thj while PVs are missing.
Consider vgreduce --removemissing.
Cannot process volume group vg_thj
参考 https://blog.51cto.com/yl497103815/1180426
- 查看扩展后的文件系统
[root@thj Desktop]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_thj-lv_root
37G 12G 24G % /
tmpfs 491M 228K 491M % /dev/shm
/dev/sda1 477M 36M 417M % /boot
虚拟机中CentOS 6.5 添加扩展分区的更多相关文章
- 【liunx】使用xshell连接虚拟机上的CentOS 7,使用xhell连接本地虚拟机上的Ubuntu, 获取本地虚拟机中CentOS 7的IP地址,获取本地虚拟机中Ubuntu 的IP地址,Ubuntu开启22端口
注意,如果想用xshell去连接本地虚拟机中的linux系统,需要本地虚拟机中的系统是启动的才能连接!!!!! ============================================ ...
- 虚拟机中给linux 系统添加硬盘以后,进行分区挂载
当自己虚拟机中的linux 系统硬盘不够用的时候需要添加硬盘给系统使用,所以可以通过以下的步骤实现 1.关闭自己的客户机,然后执行以下步骤 2. 上面的步骤完成以后,重点来了,下面打开客户机,执行以下 ...
- 虚拟机中CentOS 7下PHP环境配置
为了简单起见,虚拟机网卡设置为桥接模式 1.yum install httpd php 2.yum install mariadb 3.启动mariadb systemctl start maria ...
- 虚拟机中CentOS 7 x64图形化界面的安装
VMware的初始设置如下: 图1 待虚拟机读取完iso,出现此界面 图2 我们主要是安装图形化界面的系统,所以在软件选择栏下如图选择: 图3 设置root密码,创建用户,等候安装完成: 图4 安装完 ...
- centos下使用fdisk扩展分区容量大小
硬盘空间为20G,VMware增加磁盘大小,需要再增加10G空间 扩展完后,重启系统,再次使用fdisk -l查看,会发现硬盘空间变大了: 重新创建分区,调整分区信息 本次实验主要对/dev/sda4 ...
- VMware虚拟机中CentOS 7的硬盘空间扩容
查看centos7系统挂载点信息 扩展VMWare-centos7硬盘空间 对新增加的硬盘进行分区.格式化 添加新LVM到已有的LVM组,实现扩容 1.查看centos7系统挂载点信息 df -h查看 ...
- VMware虚拟机中CentOS/redhat设置固定IP
你的笔记本中的VMware中redhat或centOS系统,如果想在上面建站,而又如果你需要在家里和公司都能访问该站(至少希望你自己的笔记本能访问),那么就需要将虚拟机IP设置为固定IP了.以下介绍两 ...
- VM虚拟机安装CentOS 7.0添加jdk环境
虚拟机注册码 5A02H-AU243-TZJ49-GTC7K-3C61N 安装centos系统,网络类型选择桥接网络安装完成后vi /etc/sysconfig/network-scripts/ifc ...
- 解决VMware虚拟机中centos 7无法上网的问题
在WMware中安装centos 7后发现无法安装软件,开始以为是镜像服务器的问题,后来通过ping之后发现根本没办法连接到网络.由于很多设置都是默认的,并且虚拟机也是NAT模式,和电脑主机共享网络, ...
随机推荐
- svn cleanup 失败问题解决
将sqlite3.exe放到.svn的同级目录 4.启动cmd执行sqlite3 .svn/wc.db "select * from work_queue" 5.启动cmd执行sq ...
- MongoDB3.6版本新增特性
MongoDB3.6版新特性如下: (1)Default Bind to Localhost 从3.6版本开始,在默认情况下,MongoDB二进制文件mongod和mongos绑定到localhost ...
- python3-cookbook笔记:第五章 文件与IO
python3-cookbook中每个小节以问题.解决方案和讨论三个部分探讨了Python3在某类问题中的最优解决方式,或者说是探讨Python3本身的数据结构.函数.类等特性在某类问题上如何更好地使 ...
- mongo shell
mongo shell mongo 连接 本地 mongo # 连接127.0.0.1:27017 远程 mongo "mongodb://mongodb0.example.com:2801 ...
- 完成:vue-styled-components
基础 https://es6.ruanyifeng.com/#docs/string#模板字符串 注释:模板字符串返回字符串类型 如果${...}中的值不是字符串,将按照一般的规则转为字符串.比如,大 ...
- c#枚举转字典或表格
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- windows命令提示符常用命令
1.进入某个磁盘 c: 进入c盘 d: 进入d盘 2.返回到根目录 cd \ 3.查看当钱路径下的文件和文件夹 dir 4.清空窗口内容 cls 5.关闭窗口 exit 6.返回上一级目录 cd . ...
- P1339 热浪【最短路】
#include <bits/stdc++.h> #define dbg(x) cout << #x << "=" << x < ...
- 虚拟机出问题 Oh no,something has gone wrong! 解决方法
系统出错时ctrl+alt+F2 进入命令模式root输入密码yum update...等待输入 y...等待终于好了
- vue koa2 mongodb 从零开始做个人博客(二) 登录注册功能后端部分
0.效果演示 插入视频插不进来,就很烦.可以出门右拐去优酷看下(点我!). 1.后端搭建 1.1项目结构 首先看一下后端的server目录 挨个解释一下 首先dbs文件夹顾名思义,操作数据库的,mod ...