vmware 添加 磁盘 空间
创建虚拟硬盘
1、关闭VM中正在运行的虚拟系统;
2、在虚拟系统名称上点右键-》Virtual Machine Settings;
3、在Hardware页点“Add”-》Add a hard disk-》Create a new virtual disk-》SCSI(recommended)-》分配空间大小-》OK;
4、可以看见Hardware中出现了一块新的硬盘Hard Disk 2。
对虚拟硬盘进行分区和格式化(转载自bixuan)
[root@cncmail data1]# fdisk -l ## 这里是查看目前系统上有几块硬盘
Disk /dev/sda: 36.4 GB, 36401479680 bytes
255 heads, 63 sectors/track, 4425 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 255 2048256 83 Linux
/dev/sda2 256 1530 10241437+ 83 Linux
/dev/sda3 4296 4425 1044225 82 Linux swap
/dev/sda4 1531 4295 22209862+ f Win95 Ext'd (LBA)
/dev/sda5 1531 2805 10241406 83 Linux
/dev/sda6 2806 4295 11968393+ 83 Linux
Partition table entries are not in disk order
Disk /dev/sdb: 36.7 GB, 36703918080 bytes ## 这里发现/dev/sdb,容量36.7G,切未被分区
255 heads, 63 sectors/track, 4462 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdc doesn't contain a valid partition table
[root@linux root]# fdisk /dev/sdb ## 接下去就对/dev/sdb分区进行分区
The number of cylinders for this disk is set to 4462.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): p ## 打印出目前该硬盘下的分区列表
Disk /dev/sdb: 36.7 GB, 36703918080 bytes
255 heads, 63 sectors/track, 4462 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
Command (m for help): n ## 增加一个分区
Command action
e extended
p primary partition (1-4)
## 因为通常选择主分区,所以这里打一个p
p
Partition number (1-4): 1 ## 这里因为是第一个分却,所以只选择1,如果是第二个分区,则选择2,依次类推
First cylinder (1-4462, default 1): ## 新分区起始的磁盘块数
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-4462, default 4462): 如果要分区10G,这里可以直接输入:+10240M,因为这里要全部使用硬盘空间,则用默认
Using default value 4462
Command (m for help): p
Disk /dev/sdb: 36.7 GB, 36703918080 bytes
255 heads, 63 sectors/track, 4462 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 4462 35840983+ 83 Linux
## 这里第一个分区已经分好了,接下去得把这个分区写入硬盘,用w
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
下面的工作就是对该硬盘进行格式,我这里是格式化成ext3
[root@linux root]# mkfs.ext3 /dev/sdb1(这里原来的命令是:mke2fs -j /dev/sdb1,试了一下不成 功,改了)
mke2fs 1.32 (09-Nov-2002)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
4480448 inodes, 8960245 blocks
448012 blocks (5.00%) reserved for the super user
First data block=0
274 block groups
32768 blocks per group, 32768 fragments per group
16352 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 23 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
检查一下,是否已经格式好
[root@linux root]# fdisk -l
Disk /dev/sda: 36.4 GB, 36401479680 bytes
255 heads, 63 sectors/track, 4425 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 255 2048256 83 Linux
/dev/sda2 256 1530 10241437+ 83 Linux
/dev/sda3 4296 4425 1044225 82 Linux swap
/dev/sda4 1531 4295 22209862+ f Win95 Ext'd (LBA)
/dev/sda5 1531 2805 10241406 83 Linux
/dev/sda6 2806 4295 11968393+ 83 Linux
Partition table entries are not in disk order
Disk /dev/sdb: 36.7 GB, 36703918080 bytes
255 heads, 63 sectors/track, 4462 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 4462 35840983+ 83 Linux
挂载虚拟硬盘
分区分好,也格式化好了,下面就是挂载
我把/dev/sdb1挂载到/data1下
[root@linux root]# mkdir /data1 ## 首先建立挂载的目录data1
[root@linux root]# mount /dev/sdb1 /data1 ##将sdb1挂载到data1
重启系统之后,查看是否挂载成功:
[root@linux data1]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/sda1 2.0G 454M 1.4G 25% /
/dev/sda6 12G 53M 11G 1% /bak
/dev/sdb1 34G 33M 32G 1% /data1
none 250M 0 250M 0% /dev/shm
/dev/sda2 9.7G 1.5G 7.7G 17% /usr
/dev/sda5 9.7G 8.6G 559M 95% /var
这里看到/dev/sda6 12G 53M 11G 1% /bak
说明已经挂载成功了。到根目录“/”下可以查看到这个挂载好的data1。
转移数据
其实一直做到这里都还只是准备工作,如果根分区下的数据不转移到这个虚拟硬盘中的话,还是会提示空间不足。下面是将/usr全部转移到虚拟硬盘中的过程(参考Linux人生的《Linux系统精华之一——挂载》),同样也可以转移其他目录:
1、将/usr中的全部数据拷贝到data1(可以用mv一个一个拷贝,也可以用tar压缩之后一次拷贝,具体参见这两个命令的man)
2、清空usr目录:
# rm -r /usr
# mkdir /usr
3、卸载刚才挂上的虚拟硬盘,重新将它挂载到usr目录:
# umount /dev/sdb1 /data1
# mount /dev/sdb1 /usr
4、# vi /etc/fstab ## 用vi修改/etc/fstab,使系统启动就可以自动挂载
(点击“i”进入插入模式对文本内容进行修改,改好后点“Esc”,输入冒号“:”进入命令行模式,输入wq保存退出,具体操作可以参考vi常用指令)
在内容中加上一行:
/dev/sdb1 /usr ext3 defaults 1 2
4、Ok,重新启动之后,可以查看现在的硬盘使用情况了:
# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/sda2 3.6G 1.3G 2.4G 35% /
udev 125M 124K 125M 1% /dev
/dev/sdb1 4.0G 2.3G 1.6G 60% /usr
根分区的“已用%”从99%降到了35%,哈哈,大功告成,可以继续做其他的事情了。不过这次添加的虚拟硬盘还是比较小,完全可以在添加的时候设得大一点的。美中不足。
转载于:https://blog.51cto.com/baigoogledu/199894
vmware 添加 磁盘 空间相关推荐
- Vmware添加磁盘的方法:扩展磁盘
这篇文章介绍了一下如何在Vmare下添加或扩展磁盘并使之有效. 场景 创建Linux时分配磁盘空间随着使用的增加,使用率逐渐升高,此时需要在添加或者扩展一下磁盘. 比如:此Linux(CentOS 7 ...
- VMware扩展磁盘空间
原文地址http://t.zoukankan.com/beyondhd-p-15222482.html 扩展内存: 打开VMware,虚拟机-->设置,选择内存,进行调整,点击确定即可. 1.打 ...
- VMware清理磁盘空间
方法一:(亲测可以) 开机进入虚拟机 sudo vmware-toolbox-cmd disk list #查看 sudo vmware-toolbox-cmd disk shrink / #压缩 方 ...
- Vmware虚拟机磁盘空间不足
Vmware虚拟机清理磁盘空间 遇到一个问题就是虚拟机中的磁盘空间越来越小,即使把文件删除以后,磁盘空间还是无法释放.这主要是vmware中的缓存没有清除. 在使用vmware虚拟机的时候,经常会在主 ...
- linux中如何添加磁盘空间,LINUX 在线增加磁盘空间
虚拟机里面新增了一块硬盘,计划增加给/oradata目录,我是用LV管理磁盘 root 用户登录 1通过#fdisk -l 可以刷出新加的磁盘是sdb 用LINUX图形界面里的磁盘管理工具也可以很直观 ...
- linux 检测添加磁盘空间,Linux构造磁盘空间满的测试环境
利用SUSE操作系统的ramdisk,来挂接虚拟磁盘分区,然后通过填满虚拟磁盘分区来实现磁盘满环境的条件. ramdisk是操作系统自带的一种内存块设备,这种设备的列表可以用ls /dev/ram*来 ...
- vmware调整磁盘空间
1.登录vcenter调整硬盘大小 2.新建分区 fdisk /dev/sda Command (m for help): m Command (m for help): n Partition nu ...
- KVM虚拟机添加磁盘空间
1.查询镜像名称: virsh list --all 2.关闭需要扩容的虚拟机 virsh edit CentOS7-X64-1921681017 3.查询镜像文件位置 virsh edit Cent ...
- 【VMware环境下Linux磁盘空间(LVM)扩容方法】
VMware环境下Linux磁盘空间(LVM)扩容方法 引言 环境 目标 步骤 检查磁盘 VMware扩展磁盘空间 创建分区 配置LVM 引言 最近在安装Oracle ASM的过程中,解压文件被迫终止 ...
最新文章
- Cron表达式的详细用法
- Js结束,项目进行中
- 一劳永逸的搞定 flex 布局
- Node.js使用supervisor
- python 监视图_python获取zabbix监控图
- Mongodb 集群加keyFile认证
- [Objective-c 基础 - 1.3] OC带返回值的类方法
- LeetCode 977. 有序数组的平方
- 带余除法(信息学奥赛一本通-T1009)
- poj1815Friendship(最小割求割边)
- python 文件管理_python 文件操作
- Bytecoin节点搭建
- oracle 10g rac 停止,Oracle10g RAC 关闭及启动
- 关于SQL模糊查询日期时间的方法,格式化日期时间年月日时分秒,去掉毫秒
- 贵州学业水平测试信息技术软件,贵州信息技术学业水平考试系统操作手册.doc...
- 基于微信小程序的疫情防控平台设计与实现-计算机毕业设计源码+LW文档
- 整理了20个数据可视化大屏模板,拿来即用
- 一键清除系统垃圾 bat文件
- OpenCV—Python 导向滤波
- 介绍几种初学者学习电脑入门知识的方法
热门文章
- Nginx源码分析--字符串处理
- 程序员的自我修养--链接、装载与库笔记:内存
- Windows7 32位机上,OpenCV中配置GPU操作步骤
- 【数据库】sqlite中PRAGMA命令说明
- 【GStreamer】gstreamer工具详解之:gst-discoverer-1.0
- python实现matlab中的diff,Python实现matlab数据绘制
- Redis初学:5(String类型的基本操作)
- wordpress短代码转php,WordPress中的shortcode短代码功能使用详解
- 1h2g云服务器做网站,云服务器1h2g
- java bean配置文件_Spring中多配置文件及引用其他bean的方式