VMware给linux扩展磁盘空间

22 篇文章 1 订阅

用虚拟机安操作系统,一般把空间分大点,也就不用扩展了,

分大了也不会占那么大空间,只要你选不是立即分配磁盘空间,最好直接分100G

参考:

VMware虚拟机更改硬盘大小之扩大篇

http://www.linuxidc.com/Linux/2012-09/69568.htm

VMware调整Linux硬盘大小的方法

http://blog.163.com/telereceive@126/blog/static/150309229201110394938892/

虚拟机,设置--磁盘--实用程序--扩展容量

 

 

 

本样例是从20G扩展到40G,最好直接扩展到100G,

[root@weblogic ~]# df -h

文件系统              容量  已用可用已用% 挂载点

/dev/mapper/VolGroup00-LogVol00

                       18G   15G  2.2G  88% /

/dev/sda1              99M   14M   80M  15% /boot

tmpfs                 872M     0  872M   0% /dev/shm

none                  872M   40K  872M   1% /var/lib/xenstored

[root@weblogic ~]# du -h *

8.0K    anaconda-ks.cfg

8.0K    Desktop

40K     install.log

8.0K    install.log.syslog

8.0K    RHEL5.7/packages

16K     RHEL5.7

--挂载前

[root@weblogic ~]# fdisk -l

Disk /dev/sda: 42.9 GB, 42949672960 bytes

255 heads, 63 sectors/track, 5221 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          13      104391   83  Linux

/dev/sda2              14        2610    20860402+  8e  Linux LVM

[root@weblogic ~]#

--------------------------------------------------

[root@weblogic dev]# fdisk /dev/sda  对该硬盘进行操作

The number of cylinders for this disk is set to 5221.

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): n         新建分区

Command action

   e   extended

   p   primary partition (1-4)

p       主分区

Selected partition 3          默认的分区编号

w 保存

重启系统

重启后

[root@weblogic ~]# fdisk -l

Disk /dev/sda: 42.9 GB, 42949672960 bytes

255 heads, 63 sectors/track, 5221 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          13      104391   83  Linux

/dev/sda2              14        2610    20860402+  8e  Linux LVM

/dev/sda3            2611        5221    20972857+  83  Linux

[root@weblogic ~]# df -h

文件系统              容量  已用可用已用% 挂载点

/dev/mapper/VolGroup00-LogVol00

                       18G   15G  2.2G  88% /

/dev/sda1              99M   14M   80M  15% /boot

tmpfs                 872M     0  872M   0% /dev/shm

none                  872M  104K  872M   1% /var/lib/xenstored

[root@weblogic ~]# partprobe /dev/sda3

扩展LVM

[root@weblogic dev]# pvcreate /dev/sda3

  Physical volume "/dev/sda3" successfully created

[root@weblogic dev]# vgextend /dev/mapper/VolGroup00 /dev/sda3

  Volume group "VolGroup00" successfully extended

[root@weblogic dev]# lvextend -L +20G /dev/mapper/VolGroup00-LogVol00

  Extending logical volume LogVol00 to 37.91 GB

  Logical volume LogVol00 successfully resized

[root@weblogic dev]# resize2fs /dev/mapper/VolGroup00-LogVol00

resize2fs 1.39 (29-May-2006)

Filesystem at /dev/mapper/VolGroup00-LogVol00 is mounted on /; on-line resizing required

Performing an on-line resize of /dev/mapper/VolGroup00-LogVol00 to 9936896 (4k) blocks.

The filesystem on /dev/mapper/VolGroup00-LogVol00 is now 9936896 blocks long.

核实磁盘空间是否增大

[root@weblogic dev]# df -h

文件系统              容量  已用可用已用% 挂载点

/dev/mapper/VolGroup00-LogVol00

                       37G   15G   21G  42% /

/dev/sda1              99M   14M   80M  15% /boot

tmpfs                 872M     0  872M   0% /dev/shm

none                  872M  104K  872M   1% /var/lib/xenstored

参考:

Linux挂载磁盘分区

https://blog.csdn.net/dongyuxu342719/article/details/82702357

从CentOS7默认安装的/home中转移空间到根目录/ - LVM操作简明教程

从CentOS7默认安装的/home中转移空间到根目录/ - LVM操作简明教程_evandeng2009的博客-CSDN博客

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值