虚拟机下扩展磁盘空间
来源:互联网 发布:淘宝客有效果吗 编辑:程序博客网 时间:2024/05/17 00:17
把现有硬盘的容量增加,本来是4G的硬盘扩充到8G,32G。。。。,其命令为:
vmware-vdiskmanager.exe -x size mydisk.vmdk
//示例如下:
主系统Windows XP SP3,假设vmware虚拟机Ubuntu8.04安装在E分区,运行cmd
D:/>cd "Program Files"
D:/Program Files>cd VMware
D:/Program Files/VMware>cd "VMware Workstation"
D:/Program Files/VMware/VMware Workstation>vmware-vdiskmanager -x 10Gb "E:/Ubuntu 8.04/Ubuntu 8.04.vmdk"
Grow: 100% done.
Disk expansion completed successfully.
WARNING: If the virtual disk is partitioned, you must use a third-party
utility in the virtual machine to expand the size of the
partitions. For more information, see:
http://www.vmware.com/support/kb/enduser/std_adp.php?p_faqid=1647
需要强调的一点是,调整硬盘大小之后的效果,相当于增加了原来物理硬盘的柱面数目,因此,文件系统并不会自动增长。需要重新调整文件系统的大小。这一步不同的系统有不同的方法。比如
1. 如果guest OS为win系列,可以通过partion magic来实现
2. 如果guest OS为Linux系列,可以通过resize2fs来扩大ext2/3格式的文件系统。
一般来说主要有两个工具,resize2fs和parted。不过使用resize2fs /dev/sda1 10GB的时候,会显示请求的size过大,因为之前扩大的硬盘容量并没有添加任何的文件系统,可以说是没有格式化吧。使用parted提示需要将sda1 卸载了才能操作。后来选择了用fdisk的笨办法来扩容,详解见下。
3. 如果guset OS为其他Unix系统,可以通过向文件树中新增加分区,来扩充原文件系统。
启动虚拟机系统,用root登录(后续所有步骤都应以root用户身份登录操作),在命令行用fdisk -l查看。由于这里是直接修改了原始空间大小,因此可以看到/dev/sda空间改变为10.7 GB。
# fdisk -l
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000b2cce
Device Boot Start End Blocks Id System
/dev/sda1 * 1 922 7405933+ 83 Linux
/dev/sda2 923 1044 979965 82 Linux swap / Solaris
# fdisk /dev/sda //然后依次选择m,p,n,e,3,p,n,l,p,w
以下是我执行的过程
[root@localhost ~]# fdisk /dev/hda4
The number of cylinders for this disk is set to 3916.
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/hda4: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000bc363
Device Boot Start End Blocks Id System
/dev/hda1 * 1 25 200781 83 Linux
/dev/hda2 26 1958 15526822+ 8e Linux LVM
/dev/hda3 1959 2610 5237190 8e Linux LVM
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Selected partition 4
First cylinder (2611-3916, default 2611):
Using default value 2611
Last cylinder or +size or +sizeM or +sizeK (2611-3916, default 3916):
Using default value 3916
Command (m for help): t
Partition number (1-4): 4
Hex code (type L to list codes): 8e
Changed system type of partition 4 to 8e (Linux LVM)
Command (m for help): p
Disk /dev/hda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000bc363
Device Boot Start End Blocks Id System
/dev/hda1 * 1 25 200781 83 Linux
/dev/hda2 26 1958 15526822+ 8e Linux LVM
/dev/hda3 1959 2610 5237190 8e Linux LVM
/dev/hda4 2611 3916 10490445 8e Linux LVM
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: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
(注:建议重启一下CentOS系统)
# mkfs.ext3 /dev/sda5
# mkdir -p /data
# cp /etc/fstab /etc/fstab.bak
修改文件/etc/fstab,挂载/dev/sda5到/data下
/dev/sda5 /data ext3 defaults 1 1
# reboot //重启
# df -h
系统磁盘空间大小更改成功
- 虚拟机下扩展磁盘空间
- Linux 虚拟机扩展磁盘空间
- 虚拟机扩展磁盘空间
- kvm虚拟机扩展磁盘空间
- 虚拟机如何扩展磁盘空间
- linux主机下扩展xp虚拟机的磁盘空间
- 扩展 VMware 虚拟机的磁盘空间
- 扩展 VMware 虚拟机的磁盘空间
- 扩展 VMware 虚拟机的磁盘空间
- 虚拟机vmware centos7 扩展磁盘空间
- VMware下linux磁盘空间扩展
- VMware下linux磁盘空间扩展
- VMwave下Ubuntu扩展磁盘空间
- VMware下ubuntu扩展磁盘空间
- VMware下ubuntu扩展磁盘空间
- VMware下ubuntu扩展磁盘空间
- VMware虚拟机上MacOS磁盘空间扩展
- Linux的VM虚拟机扩展磁盘空间
- live555学习心得
- table中如何固定td宽度
- 在bat批处理文件中执行程序后不保留DOS窗口
- 如何恢复误删除的Linux文件
- SQLiteDatabase created and never closed
- 虚拟机下扩展磁盘空间
- 最近接触到的一些名词。
- 【 WebGis 开发框架FlexViewer 解读 】
- 系统重启关闭和程序随机启动
- 新的一年,需要更多的努力
- 好心情
- 使用Eric开发基于Qt的Python程序
- MessageBox
- 使用MySQL的LAST_INSERT_ID(转)