虚拟机中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模式,和电脑主机共享网络, ...
随机推荐
- 个性化和云端孤岛困扰SaaS用户,低代码PaaS或成解决之道 ZT
近日,中国软件行业协会.中国软件网联合阿里云推出了<2020中国SaaS产业十大趋势>,其中明确指出企业软件SaaS化是大势所趋,但个性化和云端孤岛成为2020年SaaS用户关注的两大问题 ...
- tp 框架 文本编辑器 不解析HTML标签
解析 文本编辑器 空格 {$vo.content|htmlspecialchars_decode|stripslashes|html_entity_decode}
- 2.Android网络编程-web介绍以及Tomcat安装使用
1.CS和BS CS:Client/Server 客户端和服务器,这种软件往往需要安装.比如QQ.迅雷.播放器. 优点 : 可以减轻服务器端压力,将部分代码写到客户端,并且界面很美观. 缺点 : ...
- Spring Boot源码(六):Bean的创建详解
继续之前的项目: People加上无参构造方法: @Component public class People { // private User user; public People(){ Sys ...
- 环绕通知(xml)
1.maven依赖 <?xml version="1.0" encoding="UTF-8"?> <project xmlns="h ...
- Uva12716 素数筛思想的应用
Uva12716 题意: 输入整数n,1<= n <=3e7,问有多少个整数对(a,b)满足:1 <= b <= a <= n,且gcd(a,b)== a XOR b 解 ...
- 松软科技课堂:jQuery 效果 - 滑动
jQuery 滑动方法 通过 jQuery,您可以在元素上创建滑动效果. jQuery 拥有以下滑动方法: slideDown() slideUp() slideToggle() jQuery sli ...
- Android数据存储之SD卡文件操作
赶上智能手机刚问世时有幸用过的小伙伴都知道,那时候的Android系统是把我们自己买的SD卡作为外部存储的,但是不知道从哪天开始,SD卡就被固化到智能手机的内部了,但是我们仍然把它称为外部存储.我想A ...
- TP框架中生成带背景带文字的二维码
首先下载一个phpqrcode的包放到/vendor目录下 链接:https://pan.baidu.com/s/18jV9DypYB_PHDhD6C0iedQ 提取码:qxuo 如果只是单纯生成二维 ...
- a++ 和 ++a
//a++ 先赋值,后加 var a = 1 console.log(a++);//1 console.log(a) //2 //++a 先赋值,后加 var a = 1 console.log(++ ...