增加虚拟机下Linux的硬盘空间

    今天在做RMAN练习的时候,忽然报错,无奈找不到问题所在,纠结中时,发现时Linux的空间不够了,于是乎在网上找来解决方法,自己小实验一下。

1.关闭虚拟机,打开window的命令符,切换到虚拟机安装文件的目录(不是Linux的目录)。


d:\Program File\VMware\VMware Workstation>

2.VMware自带了一个vmware-vdiskmanager.exe工具,输入以下命令


vmware-vdiskmanager -x 20GB "F:\VM\sdd.vmdk"

然后会显示:Grow: xx% done. 之后会提示disk expansion completed successfully

就会看到sdd已经变成20G了


3.用root登录,使用fdisk -l查看,但看不到什么区别,我有4个区,都是8G,


[root@Denny ~]# fdisk -l

Disk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 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        1044     8281507+  83  Linux

Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1        1044     8385898+  82  Linux swap / Solaris

Disk /dev/sdc: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *           1         500     4016218+  83  Linux
/dev/sdc2             501        1044     4369680   83  Linux

Disk /dev/sdd: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1   *           1        1044     8385898+  83  Linux


5.使用 fdisk /dev/sdd进入菜单选项(提示sdd区应该更大),m是列出菜单,p是列出分区表,n是增加分区,w是保存退出(记住要w保存退出):


[root@Denny ~]# fdisk /dev/sdd

The number of cylinders for this disk is set to 2610.
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): p

Disk /dev/sdd: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1   *           1        1044     8385898+  83  Linux

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
e
Partition number (1-4): 2
First cylinder (1045-2610, default 1045):
Using default value 1045
Last cylinder or +size or +sizeM or +sizeK (1045-2610, default 2610):
Using default value 2610

Command (m for help): p

Disk /dev/sdd: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1   *           1        1044     8385898+  83  Linux
/dev/sdd2            1045        2610    12578895    5  Extended

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: \u8bbe\u5907\u6216\u8d44\u6e90\u5fd9.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.


6.用mkfs命令将sdd2格式化为ext3


 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/20940190/viewspace-665875/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/20940190/viewspace-665875/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值