VMware扩展Linux根目录磁盘空间(Centos版本)
1、Centos 关机,选择编辑虚拟机设置,硬盘,在实用工具那里选择“扩展”,指定你需要的存储大小
2、启动客户机操作系统Centos,查看磁盘情况
输入指令
fdisk -l
显示结果如下
Disk /dev/loop0: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 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: 0x00000000
Disk /dev/loop1: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 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: 0x00000000
Disk /dev/sda: 37.6 GB, 37580963840 bytes
255 heads, 63 sectors/track, 4568 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: 0x000c8278
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 1306 9972736 8e Linux LVM
Disk /dev/mapper/vg_test001-lv_root: 9135 MB, 9135194112 bytes
255 heads, 63 sectors/track, 1110 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: 0x00000000
Disk /dev/mapper/vg_test001-lv_swap: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 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: 0x00000000
Disk /dev/mapper/docker-253:0-264224-pool: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 65536 bytes
Disk identifier: 0x00000000
其中,可以看到现在的分区情况如下
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 1306 9972736 8e Linux LVM
3、创建分区 sda3
输入指令
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): n # 输入 n 表示创建新分区
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3 # 输入 3 表示sda3,因为前面已经有两个了
First cylinder (1306-4568, default 1306): # 回车,按默认值
Using default value 1306
Last cylinder, +cylinders or +size{K,M,G} (1306-4568, default 4568): # 回车,按默认值
Using default value 4568
Command (m for help): w # 输入 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.
再次查看分区情况
fdisk -l
这时可以看到
Disk /dev/loop0: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 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: 0x00000000
Disk /dev/loop1: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 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: 0x00000000
Disk /dev/sda: 37.6 GB, 37580963840 bytes
255 heads, 63 sectors/track, 4568 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: 0x000c8278
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 1306 9972736 8e Linux LVM
/dev/sda3 1306 4568 26206700 83 Linux
Disk /dev/mapper/vg_test001-lv_root: 9135 MB, 9135194112 bytes
255 heads, 63 sectors/track, 1110 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: 0x00000000
Disk /dev/mapper/vg_test001-lv_swap: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 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: 0x00000000
Disk /dev/mapper/docker-253:0-264224-pool: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 65536 bytes
Disk identifier: 0x00000000
其中,分区已变为3个了,但这时还没挂载,还不能用
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 1306 9972736 8e Linux LVM
/dev/sda3 1306 4568 26206700 83 Linux
4、重启操作系统
reboot
5、格式化新分区为ext3
输入指令
mkfs -t ext3 /dev/sda3
结果为
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1638400 inodes, 6551675 blocks
327583 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
200 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 33 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
6、将物理硬盘分区初始化为物理卷,以便被LVM使用,输入指令
lvs
pvcreate /dev/sda3
7、向卷组中添加物理卷来增加卷组的容量
查看lvm组名,输入指令 df -h
[root@test001 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_test001-lv_root
8.3G 5.4G 2.5G 69% /
tmpfs 1001M 0 1001M 0% /dev/shm
/dev/sda1 477M 54M 394M 12% /boot
其中,vg_test001 就是 根 所在的组名
输入指令,增加卷组的容量
vgextend vg_test001 /dev/sda3
8、查看可扩展的空间大小
输入指令,显示LNM卷组的元数据信息
vgdisplay
结果为
--- Volume group ---
VG Name vg_test001
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 34.50 GiB
PE Size 4.00 MiB
Total PE 8831
Alloc PE / Size 2434 / 9.51 GiB
Free PE / Size 6397 / 24.99 GiB
VG UUID JuPKc8-Ydps-1bsN-0Wld-fbYS-0Hd2-NgvX1q
其中 Free PE / Size 就是可供分配的自由空间,最多有 24.99G,在扩展时输入小于该值
9、扩充磁盘空间
lvextend -L+24G /dev/mapper/vg_test001-lv_root /dev/sda3
10、使用e2fsck指令检查文件系统错误
e2fsck -a /dev/mapper/vg_test001-lv_root
11、使用resize2fs指令来增大或者收缩未加载的“ext2/ext3”文件系统的大小
resize2fs /dev/mapper/vg_test001-lv_root (PS:查看文件格式 df -hT 若为xfs格式的文件扩充需要使用 xfs_growfs/dev/mapper/vg_test001-lv_root)
12、查看扩展空间后的结果
[root@test001 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_test001-lv_root
32G 5.4G 26G 18% /
tmpfs 1001M 0 1001M 0% /dev/shm
/dev/sda1 477M 54M 394M 12% /boot
可以看出,在根目录下磁盘空间已经扩容了!
转自 https://my.oschina.net/u/876354/blog/967848
VMware扩展Linux根目录磁盘空间(Centos版本)的更多相关文章
- 虚拟机扩展Linux根目录磁盘空间
简要扩展空间方法http://www.kwx.gd/CentOSApp/Xen-Centos6-Mounted-HardDrive.html 最近在VMware虚拟机上使用Centos,用着用着,发现 ...
- VMware虚拟机Linux增加磁盘空间的扩容操作
转载自点击打开链接 用VMwareware虚拟机安装的Red Hat Enterprise Linux系统剩余空间不足,造成软件无法正常安装.如果重新装一遍系统就需要重新配置好开发环境和软件的安装配置 ...
- Linux系统扩容根目录磁盘空间
作者:非法小恋 一.使用背景 Linux根目录磁盘空间不够用了,当修改了虚拟机模版增加磁盘大小或者插入了一块新硬盘,但是发现系统里的大小还是没改变. 产生的原因是没有给磁盘格式化,没有增加分区. 二. ...
- VMware 虚拟机(linux)增加根目录磁盘空间 转自
转自 http://wenku.baidu.com/link?url=WZDgESO0oXqYfhPYOWFalZsMglS0HKtLw7t6ICRs_sJ_sfPc85RpxsqKMwqSniis0 ...
- VMware 虚拟机(linux)增加根目录磁盘空间
VMware 虚拟机(linux)增加根目录磁盘空间 今天查看学校的监控报修系统,不能访问了!!!系统运行很慢,用top命令查看发现内存使用率90%,用"df -h ”查看“/”目录 ...
- VMware 虚拟机(linux)增加根目录磁盘空间
今天查看学校的监控报修系统,不能访问了!!!系统运行很慢,用top命令查看发现内存使用率90%,用"df -h ”查看“/”目录使用率已达到80%,导致系统运行很慢.我用以下方法扩大根目录磁 ...
- 解决Linux下pcieport 0000:00:1c.5问题导致的系统根目录/磁盘空间不足
最近刚换了笔记本,拿到本后在win10基础装上Ubuntu 16.04双系统,有个问题是每次关机都会报一堆pcie问题,并且经常没声音,声音问题通过上一篇文章暂时解决,然后就没在意了,可是几天后出现系 ...
- Linux查看磁盘空间大小命令
Linux查看磁盘空间大小命令df -hldf -hl 查看磁盘剩余空间df -h 查看每个根路径的分区大小du -sh [目录名] 返回该目录的大小du -sm [文件夹] 返回该文件夹总M数du ...
- linux 查看磁盘空间
linux 查看磁盘空间大小命令 df :命令是linux系统以磁盘分区为单位查看文件系统,可以加上参数查看磁盘剩余空间信息 df -hl:查看磁盘剩余空间信息,显示如下: 文件系统 ...
随机推荐
- Hadoop Mapreduce 案例 wordcount+统计手机流量使用情况
mapreduce设计思想 概念:它是一个分布式并行计算的应用框架它提供相应简单的api模型,我们只需按照这些模型规则编写程序,即可实现"分布式并行计算"的功能. 案例一:word ...
- hadoop不同版本有哪些
一.Hadoop是什么? 首次听到hadoop这次单词,相信很多人跟我当时是一样,不免心中画上一个大大的问号——这是什么东西?Hadoop是什么?百度百科的解释是:Hadoop是一个由Apache基金 ...
- DeviceIoControl 驱动交互
驱动程序通信的函数,除了ReadFile和WriteFile函数还有DeviceIoControl函数,而且DeviceIoControl函数那是相当的彪悍.因为它可以自定义控制码,你只要在IRP_M ...
- 测试ik分词效果
POST: http://192.168.1.12:9200/ddycdr/_analyze?analyzer=ik_max_word body: {"text":& ...
- Pandas的使用(2)
Pandas的使用(2) 1.新建一个空的DataFrame数据类型 total_price = pd.DataFrame() #新建一个空的DataFrame 2.向空的DataFrame中逐行添加 ...
- 分布式超级账本Hyperledger为什么选择使用kafka引擎实现共识方案
使用kafka集群配置的原因也很简单,为orderer共识及排序服务提供足够的容错空间,当我们向peer节点提交Transaction的时候,peer节点会得到或返回(基于SDK)一个读写集结果,该结 ...
- MySQL存储过程-->通过游标遍历和异常处理迁移数据到历史表
-- 大表数据迁移,每天凌晨1点到5点执行,执行间隔时间10分钟,迁移旧数据到历史表. DELIMITER $$ USE `dbx`$$ DROP PROCEDURE IF EXISTS `pro_x ...
- json server的简单使用(附:使用nodejs快速搭建本地服务器)
作为前端开发人员,经常需要模拟后台数据,我们称之为mock.通常的方式为自己搭建一个服务器,返回我们想要的数据.json server 作为工具,因为它足够简单,写少量数据,即可使用. 安装 首先需要 ...
- Device Tree碎碎念
首先推荐elinux.org上一篇关于Device Tree的文章: http://elinux.org/Device_Tree_Usage 这是一篇关于Device Tree的入门文章.对英文犯怵的 ...
- 解决socket交互的10048和10055错误的总结
问题:60多路轮训的情况下,5分钟之后,现场报链接不上子进程的错误.绝大部分为海康设备 分析: 子进程的日志中 存在输入海康的解码库的错误,在子进程的对外dll中加日志发现,socket链接的时候 ...