VMware Workstation 添加磁盘 挂载目录(centos)
参考文档: Linux命令大全
需求:测试环境虚拟机某个目录下空间不足,准备通过添加一块磁盘,并将该目录挂载到该磁盘
前面几步在测试服务器上操作的,截图困难,所以网上找了几张设置图
- 关闭虚拟机(没测试过不关闭的情况)
- 虚拟机中添加一块新的磁盘

- 选择磁盘类型

- 创建新磁盘

- 设置大小、拆分方式

- 设定文件名(一般默认即可)

- 确定(一定要确定,不然不会保存的)

- 重启虚拟机
- fdisk观察硬盘实体使用情况
[root@node3 ~]# fdisk -l
Disk /dev/sda: 536.9 GB, 536870912000 bytes, 1048576000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000bd826
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 1048575999 523238400 8e Linux LVM
//新加的磁盘(100G)
Disk /dev/sdb: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/centos-root: 53.7 GB, 53687091200 bytes, 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/centos-home: 480.0 GB, 479954206720 bytes, 937410560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
- 选择要进行操作的磁盘
[root@node3 ~]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x2890866a.
- 输入m列出可以执行的命令:
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)
- 输入p列出磁盘目前的分区情况 (如果是新的磁盘 忽略步骤)
Command (m for help): p
Disk /dev/sdb: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 1 8001 8e Linux LVM
/dev/sdb2 2 26 200812+ 83 Linux
- 删除现有分区
Command (m for help): d
Partition number (1-4): 1
Command (m for help): d
Selected partition 2
- 确认分区已经删除
Command (m for help): p
Disk /dev/sdb: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
Command (m for help):
- 建立新的磁盘分区(两个主磁盘分区)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p //建立主分区
Partition number (1-4): 1 //分区号
First cylinder (1-391, default 1): //分区起始位置
Using default value 1
last cylinder or +size or +sizeM or +sizeK (1-391, default 391): 100 //分区结束位置,单位为扇区(磁盘扇区默认是512Byte)
Command (m for help): n //再建立一个分区
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2 //分区号为2
First cylinder (101-391, default 101):
Using default value 101
Last cylinder or +size or +sizeM or +sizeK (101-391, default 391): +200M //分区结束位置,单位为M
- 建一个扩展分区
Command (m for help): n
Command action
e extended
p primary partition (1-4)
e //选择扩展分区
Partition number (1-4): 3
First cylinder (126-391, default 126):
Using default value 126
Last cylinder or +size or +sizeM or +sizeK (126-391, default 391)://剩下的空间都用做扩展分区
Using default value 391
- 查看扩展分区
Command (m for help): p
Disk /dev/sdb: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 100 803218+ 83 Linux
/dev/sdb2 101 125 200812+ 83 Linux
/dev/sdb3 126 391 2136645 5 Extended
- 扩展分区上建立逻辑分区
Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l //选择逻辑分区
First cylinder (126-391, default 126):
Using default value 126
Last cylinder or +size or +sizeM or +sizeK (126-391, default 391): +400M
Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (176-391, default 176):
Using default value 176
Last cylinder or +size or +sizeM or +sizeK (176-391, default 391):
Using default value 391
- 查看当前分区情况
Command (m for help): p
Disk /dev/sdb: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 100 803218+ 83 Linux
/dev/sdb2 101 125 200812+ 83 Linux
/dev/sdb3 126 391 2136645 5 Extended
/dev/sdb5 126 175 401593+ 83 Linux
/dev/sdb6 176 391 1734988+ 83 Linux
Command (m for help):
从上面的结果我们可以看到,在硬盘sdb我们建立了2个主分区(sdb1,sdb2),1个扩展分区(sdb3),2个逻辑分区(sdb5,sdb6)
注意:主分区和扩展分区的磁盘号位1-4,也就是说最多有4个主分区或者扩展分区,逻辑分区开始的磁盘号为5,因此在这个实验中试没有sdb4的。
- 保存分区操作
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
分区创建方式按照参考文档的操作,但是我并没有创建这么多分区,100G全部创建了主分区即
/dev/sdb1
- fdisk 查看硬盘分区情况
[root@node3 ~]# fdisk -l
Disk /dev/sda: 536.9 GB, 536870912000 bytes, 1048576000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000bd826
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 1048575999 523238400 8e Linux LVM
Disk /dev/sdb: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x2890866a
Device Boot Start End Blocks Id System
/dev/sdb1 2048 209715199 104856576 83 Linux //新的分区(sbd1:100G)
Disk /dev/mapper/centos-root: 53.7 GB, 53687091200 bytes, 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/centos-home: 480.0 GB, 479954206720 bytes, 937410560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
- cat /proc/partitions 查看磁盘文件信息
[root@node3 ~]# cat /proc/partitions
major minor #blocks name
8 0 524288000 sda
8 1 1048576 sda1
8 2 523238400 sda2
8 16 104857600 sdb
8 17 104856576 sdb1
11 0 1048575 sr0
253 0 52428800 dm-0
253 1 2097152 dm-1
253 2 468705280 dm-2
- mkfs -t ext3 /dev/sdb1格式化分区
[root@node3 ~]# mkfs -t ext3 /dev/sdb1
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
6553600 inodes, 26214144 blocks
1310707 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
800 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, 7962624, 11239424, 20480000, 23887872
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
- mount /dev/sdb1 /guazai
#/usr/hdp/ 目录要先存在
[root@node3 ~]# mount /dev/sdb1 /usr/hdp/
- 查看挂载情况
[root@node3 usr]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 50G 50G 20K 100% /
devtmpfs 3.8G 0 3.8G 0% /dev
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 3.9G 12M 3.8G 1% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/sda1 1014M 142M 873M 14% /boot
/dev/mapper/centos-home 447G 1018M 446G 1% /home
tmpfs 781M 0 781M 0% /run/user/0
/dev/sdb1 99G 60M 94G 1% /usr/hdp //挂载成功
- 取消挂载
[root@node3 /]# umount /dev/sdb1
[root@node3 /]# df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/centos-root 52403200 52403180 20 100% /
devtmpfs 3983896 0 3983896 0% /dev
tmpfs 3996168 0 3996168 0% /dev/shm
tmpfs 3996168 11992 3984176 1% /run
tmpfs 3996168 0 3996168 0% /sys/fs/cgroup
/dev/sda1 1038336 145260 893076 14% /boot
/dev/mapper/centos-home 468476420 1041428 467434992 1% /home
tmpfs 799236 0 799236 0% /run/user/0
取消挂载成功
还可以用umount /usr/hdp取消挂载
VMware Workstation 添加磁盘 挂载目录(centos)的更多相关文章
- 【图文教程】Vmware Workstation 12虚拟机中安装CentOS 7详细步骤
文档维护人:牛棚琐思 <viprs@qq.com> ,如有不妥之处,请不吝赐教. 文档目标:帮助新手在Vmware虚拟机软件中安装CentOS 7超详细教程. 目标人群:本篇教程比较简单, ...
- 【Hadoop离线基础总结】Mac版VMware Fusion虚拟机磁盘挂载
步骤概览 1.打开所要挂载磁盘的虚拟机的设置(此时必须关机) 2.打开硬盘设置 3.添加设备 4.选择新硬盘 5.设置如下图 6.将虚拟机开机,输入 df-lh ,查看当前虚拟机磁盘 7.输入 fdi ...
- Linux修改磁盘挂载目录
比如想把已经挂载在home目录上的硬盘挂载到data目录上, 如下操作 #df -h(查看分区情况及数据盘名称) # mkdir /data(如果没有data目录就创建,否则此步跳过) # umoun ...
- Vmware Workstation添加centos 7系统网络问题(无IP情况)
简单配置 命令行输入ip addr 查询不到IP的情况,如下: 解决办法: 1. vi /etc/sysconfig/network-scripts/ifcfg-ens33 2. 最后一行,ONBO ...
- vmware workstation LINUX磁盘扩容
1.edit virtual machine settings -> 选中硬盘->右侧utilities->expand(虚拟机不能存在镜像),输入要扩容到的大小 2.扩容之后进入系 ...
- VMware workstation批量创建虚拟机和自动化安装操作系统(一)
一. 简述 作为从事IT行业运维工作的Linuxer,大多情况下需要在测试环境中部署业务系统并进行测试,在没有足够的计算存储网络条件下,使用虚拟机进行虚拟集群的创建和使用,是一种不错的学习和实践方式. ...
- vmware workstation 上创建的centos 7.2 ,新添加一块网卡。无法找到配置文件。
在vmware workstation 11上,新建一个centos 7.2系统. 初装带有一个块网卡:能够在/etc/sysconfig/network-scripts/目录下找到相应的网卡配置文件 ...
- 不停机为虚拟机添加主机磁盘(以VMware Workstation为例)
VMware Workstation软件上安装的centos7系统,新增磁盘后使用fdisk -l命令查看不到新增的磁盘,有没有办法在不重启的情况下添加上新磁盘? 有办法 具体如下: # 查看主机总线 ...
- CentOS添加磁盘分区
(这里的磁盘在vmware workstation VM中添加) 1.关闭虚拟机,在虚拟机设置中添加一个硬盘,然后开启虚拟机. 2.使用fdisk -l命令查看,这时会发现一个为被使用的设备,有2G的 ...
随机推荐
- 深入浅出 Vue.js 第九章 解析器---学习笔记
本文结合 Vue 源码进行学习 学习时,根据 github 上 Vue 项目的 package.json 文件,可知版本为 2.6.10 解析器 一.解析器的作用 解析器的作用就是将模版解析成 AST ...
- NOIp2018集训test-10-22 (联考六day2)
中间值 两个log肯定会被卡.我用的第一种做法,就是要各种特判要在两个序列都要二分比较麻烦. //Achen #include<bits/stdc++.h> #define For(i,a ...
- 搭建appium自动化测试环境
注意:请使用不用的手机测试,appium会把微信app重新安装,记录都会清除 一.安装Java JDK JDK下载地址:https://www.oracle.com/technetwork/java/ ...
- js 获取数组中的最大值和最小值
var arr = [3,12,23,18,25,33,22,30,1] 方案一: 思想 首先对数组进行排序(小 >大),第一项为最小值,最后一项为最大值 var min; var max; a ...
- access注入篇+sqlmap
access数据库的来历,我就不说了,因为我懒的记,就算记了感觉上也没大多用处,只要记得数据库的结构就行了.先是表名,然后是列名,再者就是数据,我发个实际的图吧,大概就是这么一个结构. 下面,开始说下 ...
- mongodb副本集(选举,节点设置,读写分离设置)
1.相对于传统主从模式的优势 传统的主从模式,需要手工指定集群中的Master.如果Master发生故障,一般都是人工介入,指定新的Master.这个过程对于应用一般不是透明的,往往伴随着应用重新修改 ...
- php 如何实现 数据库 连接池
php 如何实现 数据库 连接池 一.总结 一句话总结: php+sqlrelay+mysql实现连接池及读写负载均衡 master-slave模式增加并发. sqlrelay 解决连接池问题以及实现 ...
- robotframework+selenium2library之上传本地文件
针对将本地的文件上传到测试系统,selenium2library提供了一个关键词 choose file choose file jquery=*[name='Filedata']+label: ...
- error LNK2001: 无法解析的外部符号 __imp__RegEnumKeyExA@32
错误: error LNK2001: 无法解析的外部符号 __imp__OpenProcessToken@12 error LNK2001: 无法解析的外部符号 __imp__LookupPrivil ...
- Dubbo入门到精通学习笔记(十五):Redis集群的安装(Redis3+CentOS)、Redis集群的高可用测试(含Jedis客户端的使用)、Redis集群的扩展测试
文章目录 Redis集群的安装(Redis3+CentOS) 参考文档 Redis 集群介绍.特性.规范等(可看提供的参考文档+视频解说) Redis 集群的安装(Redis3.0.3 + CentO ...