Practice of vmware virtual disk expansion, vmware-vdiskmanager.exe + fdisk + mkfs + mount

本文介绍了如何使用vmware-vdiskmanager.exe工具扩展虚拟磁盘大小,并在Linux环境中通过fdisk、mkfs及mount命令来调整分区和挂载新扩展的空间。详细步骤包括使用vmware-vdiskmanager增加磁盘容量,然后在虚拟机内部使用fdisk创建新分区,将分区类型更改为LVM,用mkfs格式化分区,最后通过mount命令挂载新分区。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

D:/Program Files/VMware/VMware Workstation>vmware-vdiskmanager.exe -x6GB D:/fedora_core/fc5-flat.vmdk
Using log file C:/DOCUME~1/WENJUN~1.BJ/LOCALS~1/Temp/vmware-wenjunwang/vdiskmanager.log
Failed to open the disk 'D:/fedora_core/fc5-flat.vmdk' : The file specified is not a virtual disk (15).
Failed to open disk 'D:/fedora_core/fc5-flat.vmdk' : The file specified is not a virtual disk (15).

 

 

D:/Program Files/VMware/VMware Workstation>vmware-vdiskmanager.exe -x6GB D:/fedora_core/fc5.vmdk
Using log file C:/DOCUME~1/WENJUN~1.BJ/LOCALS~1/Temp/vmware-wenjunwang/vdiskmanager.log
  Grow: 100% done.
The old geometry C/H/S of the disk is: 7905/16/63
The new geometry C/H/S of the disk is: 12483/16/63
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

 

logon to guest os do fdisk --> mkfs-->mount

 

[root@localhost /home/deric]#fdisk /dev/hda

Command (m for help): p

Disk /dev/hda: 6442 MB, 6442450944 bytes
255 heads, 63 sectors/track, 783 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1          13      104391   83  Linux
/dev/hda2              14         496     3879697+  8e  Linux LVM

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

Command (m for help): p

Disk /dev/hda: 6442 MB, 6442450944 bytes
255 heads, 63 sectors/track, 783 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1          13      104391   83  Linux
/dev/hda2              14         496     3879697+  8e  Linux LVM
/dev/hda3             497         783     2305327+  83  Linux

Command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): 8e
Changed system type of partition 3 to 8e (Linux LVM)

Command (m for help): p

Disk /dev/hda: 6442 MB, 6442450944 bytes
255 heads, 63 sectors/track, 783 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1          13      104391   83  Linux
/dev/hda2              14         496     3879697+  8e  Linux LVM
/dev/hda3             497         783     2305327+  8e  Linux LVM

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)

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.

 

rebooting.

 

[root@localhost /home/deric]#mkfs
Usage: mkfs [-V] [-t fstype] [fs-options] device [size]
[root@localhost /home/deric]#mkfs -t ext3 /dev/hda
hda   hda1  hda2  hda3 
[root@localhost /home/deric]#mkfs -t ext3 /dev/hda3
mke2fs 1.38 (30-Jun-2005)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
288576 inodes, 576331 blocks
28816 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=591396864
18 block groups
32768 blocks per group, 32768 fragments per group
16032 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912

Writing inode tables: done                           
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 35 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

 

[root@localhost /home/deric]#mount -t ext3 /dev/hda3 /home/deric/extra
[root@localhost /home/deric]#df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       3205824   3095736         0 100% /
/dev/hda1               101086     12249     83618  13% /boot
tmpfs                   128044         0    128044   0% /dev/shm
/dev/hda3              2269060     68992   2084804   4% /home/deric/extra
[root@localhost /home/deric]#cd extra/

 

 

edit /etc/fstab to issue auto-mount

/dev/hda3               /home/deric/extra        ext3    defaults       0 0

 

Ok, that's all.

 

在vmware workstation 6中为Solaris10 添加硬盘  

http://blog.youkuaiyun.com/xian_fish/archive/2008/06/05/2514875.aspx

注意: 用vmware-vdiskmanager才完成扩容的第一步,接下来的事情请看我的博客。 http://blog.csdn.net/junglyfine/archive/2009/12/09/4974269.aspx 使用方法: vmware-vdiskmanager 命令语法: vmware-vdiskmanager [选项] VMware Virtual Disk Manager - build 44356. Usage: vmware-vdiskmanager [选项] 虚拟磁盘文件的名字。 #虚拟磁盘文件必须是.vmdk为扩展名。你能够指定一个你想要储存的虚拟磁盘文件的路径。如果你在你的宿主机中映射了网络共享,你也可以提供确切的虚拟磁盘文件的路径信息来创建虚拟磁盘在这个网络共享中。 -c 创建虚拟磁盘。 #你必须用-a, -s 和 -t 并指定选项参数,然后你需要指定所要创建的虚拟磁盘文件的文件名。 -r 转换已经指定类型的虚拟磁盘的类型。 #结果会输出创建一个新的虚拟磁盘。你必须用-t选项来指定你想要转换成的磁盘类型,并且指定目标虚拟磁盘的文件名。 #一旦转换完成,你可以先测试虚拟磁盘以确保它能够像你所希望的那样工作,然后再删除原来的那个虚拟磁盘文件。 #为了让虚拟机重新认识转换后的虚拟磁盘,你应该使用虚拟机设置编辑器先从虚拟机中移除先前存在的虚拟磁盘,然后添加转换好的虚拟磁盘给虚机。 -x [GB|MB] 增大虚拟磁盘到指定的容量。你必须指定新的更大尺寸的虚拟磁盘用GB或MB单位标示。你不能改变物理磁盘的大小。 #在你运行虚拟磁盘管理软件前,你应该先备份虚拟磁盘文件。因为vmware-vdiskmanager会向你的虚拟机配置文件里面写入新配置 -d 对指定的虚拟磁盘碎片整理。 #你只能磁盘碎片整理可增长的虚拟磁盘。你不能磁盘碎片整理预分配的虚拟磁盘。 -p 为收缩磁盘做准备处理。 #如果虚拟磁盘被分成多个分区,每个分区必须被单独准备。分区(比如/email或/storage)必须用VMware DiskMount工具映射。 #在你对分区准备处理后,解除对此分区的映射。继续映射虚拟磁盘的其他每个分区,为收缩磁盘作准备处理直到完成虚拟磁盘上的所有分区的准备工作。 #你在同一时刻只能用VMware DiskMount映射虚拟磁盘的一个分区。你仅仅能在宿主机上进行虚拟磁盘的收缩分区准备工作。 -k 收缩指定的虚拟磁盘。你只能够收缩可增长磁盘。你只能在宿主机中用这种方法收缩虚拟磁盘。 #你不能够收缩有虚拟机快照的虚拟磁盘。你可以保持现有虚拟磁盘的状态,而用快照管理器删除所有快照。你也可以放弃自快照以来对虚拟磁盘所做的更改,恢复到快照时状态。 -a [ ide | buslogic | lsilogic ] 指定磁盘适配器的类型。你在创建新的虚拟磁盘时必须指定其类型。 #选择以下类型之一: #ide —— IDE接口适配器 #buslogic —— BusLogic SCSI接口适配器 #lsilogic —— LSI Logic SCSI接口适配器GB或MB做单位。你必须在创建磁盘时指定其大小。 #尽管你必须指定虚拟磁盘的大小,但当你增长它的大小时,你不能用-s可以指定的磁盘大小规定:IDE和SCSI适配器都为最小100MB,最大950GB。 -t [0|1|2|3] 你在创建一个新的虚拟磁盘或者重新配置一个虚拟磁盘时必须指定虚拟磁盘的类型。 #指定以下类型之一: #0 —— 创建一个包含在单一虚拟文件中的可增长虚拟磁盘 #1 —— 创建一个被分割为每个文件2GB大小的可增长虚拟磁盘 #2 —— 创建一个包含在单一虚拟文件中的预分配虚拟磁盘 #3 —— 创建一个被分割为每个文件2GB大小的预分配虚拟磁盘 -q 禁止虚拟磁盘管理程序写日志 #如果你允许记录日志,日志将会被虚拟磁盘管理程序产生并储存。在虚拟磁盘管理程序运行后,日志的名字和存放位置将会出现在命令行或终端中。 -n 重命名指定的虚拟磁盘。需要指定命名后的虚拟磁盘名字。 为了帮助大家理解,下面举几个例子: vmware-vdiskmanager -c -s 850Mb -a ide -t 0 myIdeDisk.vmdk 创建一个名称为myIdeDisk的大小为850Mb的IDE接口的在一个虚拟机文件中的可增长的磁盘 vmware-vdiskmanager -d myDisk.vmdk 对myDisk进行碎片整理 vmware-vdiskmanager -r sourceDisk.vmdk -t 0 destinationDisk.vmdk 将sourceDisk转换成在一个虚拟机文件中的可增长的磁盘,并命名为destinationDisk vmware-vdiskmanager -x 36Gb myDisk.vmdk 将磁盘myDisk增大至36G vmware-vdiskmanager -n sourceName.vmdk destinationName.vmdk 将磁盘sourceName改名为destinationName 如果在添加共享磁盘后发现只有一台机器能启动,另外一台因为不能打开共享磁盘文件而不能启动的时候,需要对配置文件进行修改: 分别打开两台虚拟机目录中的vmx文件,在最后一行添加: disk.locking="FALSE" scsi0:1.SharedBus="Virtual" scsi1:1.SharedBus="Virtual" 系统启动的时候会锁定磁盘,所以当启动linux1后共享磁盘被锁定了,linux2就起不来了,因此需要加入disk.locking = "false"。 一般来说,如果是scsi1:0,则n为1,也就是scsi1.sharedBus = "virtual" ,表示所有的bus都共享,vmare推荐这种做法。 如果说是不是所有的bus都共享的话,可以将上述scsi1.sharedBus = "virtual"改成scsi1:1.shared = "true" 。 注意: 以上只完成了第一步,想扩容成功请看我的另一个文章 http://blog.csdn.net/junglyfine/archive/2009/12/09/4974269.aspx
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值