VMware虚拟机中Linux 虚拟机通信和扩容

一:Linux虚拟机如何和本机通信?

一、设置虚拟机

VMware的计算机列表里,右键点击要设置的虚拟机,点击设置>>网络适配器,网络链接选择NAT模式

 

 

虚拟机IP:192.168.91.128

本机IP:ping -c 3 本机ip能ping通成功

二:扩大虚拟机内存

1:扩展VMWare-centos7硬盘空间

关闭Vmwarecentos7系统,才能在VMWare菜单中设置需要增加到的磁盘大小

原大小:

点击“扩展”改成40GB

更改后大小:

 

2对新增加的硬盘进行分区、格式化

root@localhost ~]# fdisk /dev/sda

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.

Command (m for help): p                                              --查看分区

Disk /dev/sda: 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 label type: dos

Disk identifier: 0x000d43df

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *        2048      616447      307200   83  Linux

/dev/sda2          616448     4810751     2097152   82  Linux swap / Solaris

/dev/sda3         4810752   104857599    50023424   83  Linux

Command (m for help): d                 --删除

Partition number (1-3, default 3): 3

Partition 3 is deleted

Command (m for help): n           --新加

Partition type:

   p   primary (2 primary, 0 extended, 2 free)

   e   extended

Select (default p): p

Partition number (3,4, default 3): 3

First sector (4810752-104857599, default 4810752):

Using default value 4810752

Last sector, +sectors or +size{K,M,G} (4810752-104857599, default 104857599):

Using default value 104857599

Partition 3 of type Linux and of size 47.7 GiB is set

Command (m for help):  w             --写入保存

[root@localhost ~]# 重启电脑 shutdown -r now

--此时/dev/sda3 大小还没变,需要卸载重新,卸载 不掉用后面xfs_growfs命令

[root@localhost ~]umount /dev/sda3          --卸载

[root@localhost ~]mount /dev/sda3    / --重新挂载

[root@localhost ~]# df -h

Filesystem      Size  Used Avail Use% Mounted on

/dev/sda3        18G   16G  2.0G  89% /

devtmpfs        474M     0  474M   0% /dev

tmpfs           489M     0  489M   0% /dev/shm

tmpfs           489M  7.0M  482M   2% /run

tmpfs           489M     0  489M   0% /sys/fs/cgroup

/dev/sda1       297M  141M  156M  48% /boot

tmpfs            98M  8.0K   98M   1% /run/user/42

tmpfs            98M   20K   98M   1% /run/user/0

[root@localhost ~]# xfs_growfs /dev/sda3           --增加 XFS 文件系统的大小

meta-data=/dev/sda3              isize=512    agcount=4, agsize=1160384 blks

         =                       sectsz=512   attr=2, projid32bit=1

         =                       crc=1        finobt=0 spinodes=0

data     =                       bsize=4096   blocks=4641536, imaxpct=25

         =                       sunit=0      swidth=0 blks

naming   =version 2              bsize=4096   ascii-ci=0 ftype=1

log      =internal               bsize=4096   blocks=2560, version=2

         =                       sectsz=512   sunit=0 blks, lazy-count=1

realtime =none                   extsz=4096   blocks=0, rtextents=0

data blocks changed from 4641536 to 12505856

[root@localhost ~]# df -h                                  --扩容成功

Filesystem      Size  Used Avail Use% Mounted on

/dev/sda3        48G   16G   32G  33% /

devtmpfs        474M     0  474M   0% /dev

tmpfs           489M     0  489M   0% /dev/shm

tmpfs           489M  7.0M  482M   2% /run

tmpfs           489M     0  489M   0% /sys/fs/cgroup

/dev/sda1       297M  141M  156M  48% /boot

tmpfs            98M  4.0K   98M   1% /run/user/42

tmpfs            98M   20K   98M   1% /run/user/0

[root@localhost ~]#

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

cai_niaocainiao

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值