VMware Cloud Community
visual2me
Enthusiast
Enthusiast

how to partition a vmware disk without vmware workstation?

when i create a vmware disk with vmware-vdiskmanager, i want to setup the partition without vmware workstation. Anyone knows which tool or method can help me do this?

Reply
0 Kudos
13 Replies
Cooldude09
Commander
Commander

Are you looking for creating vmdk's of fixed size prior to VM creation?

Regards

Anil

Save the planet, Go Green

if you found my answer to be useful, feel free to mark it as Helpful or Correct.

If U find my answer useful, feel free to give points by clicking Helpful or Correct.

Subscribe yourself at walkonblock.com

Reply
0 Kudos
visual2me
Enthusiast
Enthusiast

I have created a disk of fixed size with vmware-vdiskmanager. What I want to do is to mount this disk and copy some file to it, so I need to partition this disk first before I can mount it with vmware-mount. So what I wonder is how to partition this vmware disk without vmware workstation.

What I have tried is to map the -flat.vmdk file as a loop device, then fdisk this loop device. But it failed. I can see the partition table with "vmware-mount -p .vmdk", but can not mount it. Do you know why?

Reply
0 Kudos
Texiwill
Leadership
Leadership

Hello,

The Guest OS handles VMDK disk partitioning, so you will need to install an OS into the Guest in order to partition it, or boot from a LiveCD to do the same.


Best regards,
Edward L. Haletky
VMware Communities User Moderator, VMware vExpert 2009
====
Author of the book 'VMWare ESX Server in the Enterprise: Planning and Securing Virtualization Servers', Copyright 2008 Pearson Education.
Blue Gears and SearchVMware Pro Blogs -- Top Virtualization Security Links -- Virtualization Security Round Table Podcast

--
Edward L. Haletky
vExpert XIV: 2009-2023,
VMTN Community Moderator
vSphere Upgrade Saga: https://www.astroarch.com/blogs
GitHub Repo: https://github.com/Texiwill
Reply
0 Kudos
visual2me
Enthusiast
Enthusiast

That's just what I don't want to do.

I'm just thinking that since we have tools to create an empty disk, and to mount a partitioned disk without workstation, why can't we partition an empty disk without running any guest OS?

Reply
0 Kudos
vmroyale
Immortal
Immortal

Hello. The commands below will create a vmdk formatted with NTFS.

touch ntfs.img

mkntfs -fF ntfs.img 1000000

qemu-img convert ntfs.img -O vmdk ntfs.vmdk

Good Luck!

Brian Atkinson | vExpert | VMTN Moderator | Author of "VCP5-DCV VMware Certified Professional-Data Center Virtualization on vSphere 5.5 Study Guide: VCP-550" | @vmroyale | http://vmroyale.com
Reply
0 Kudos
visual2me
Enthusiast
Enthusiast

Great, qemu-img is a really helpful tool.

Thank you very much:)

Reply
0 Kudos
Texiwill
Leadership
Leadership

Hello,

For linux fdisk/sfdisk/qparted may work on an image file as well. I have never used them like that but they may work.


Best regards,
Edward L. Haletky
VMware Communities User Moderator, VMware vExpert 2009
====
Author of the book 'VMWare ESX Server in the Enterprise: Planning and Securing Virtualization Servers', Copyright 2008 Pearson Education.
Blue Gears and SearchVMware Pro Blogs -- Top Virtualization Security Links -- Virtualization Security Round Table Podcast

--
Edward L. Haletky
vExpert XIV: 2009-2023,
VMTN Community Moderator
vSphere Upgrade Saga: https://www.astroarch.com/blogs
GitHub Repo: https://github.com/Texiwill
Reply
0 Kudos
continuum
Immortal
Immortal

Hi

visit boot-land.net and search for posts from Jaclaz - he has written a batch that can exactly do what you are looking for.

Partition a newly created vmdk without the need to boot it inside a VM first.

All other tools referenced in the previous answers can't do what you are looking for

Ulli

___________________________________

description of vmx-parameters:

VMware-liveCD:


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

Reply
0 Kudos
visual2me
Enthusiast
Enthusiast

Thank you for the information.

I searched the posts from Jaclaz at boot-land.net, but I'm not sure whether you refer to the tool MBRBATCH. I found MBRBATCH is meant for Windows, but I work in Linux. Do you know any similar tools for Linux?

Reply
0 Kudos
continuum
Immortal
Immortal

A tool like that for Linux ? - no - I don't know any.

You can boot a small Windows LiveCD and run the batch against some vmdks you store on Linux ... sorry - no other ideas

___________________________________

description of vmx-parameters:

VMware-liveCD:


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

Reply
0 Kudos
vmroyale
Immortal
Immortal

All other tools referenced in the previous answers can't do what you are looking for

The commands listed below will create a vmdk that is formatted with NTFS:

touch ntfs.img

mkntfs -fF ntfs.img 1000000

qemu-img convert ntfs.img -O vmdk ntfs.vmdk

I issued these 3 commands on my Linux host, assigned ntfs.vmdk to a Windows XP virtual machine and disk manager saw a NTFS formatted volume. I also was able to write files to it within XP.

Brian Atkinson | vExpert | VMTN Moderator | Author of "VCP5-DCV VMware Certified Professional-Data Center Virtualization on vSphere 5.5 Study Guide: VCP-550" | @vmroyale | http://vmroyale.com
Reply
0 Kudos
continuum
Immortal
Immortal

It is no problem at all to create a NTFS formatted partition - image.

Creating a blank vmdk from scratch and make it work as a real disk-image (including an MBR) is something very different

___________________________________

description of vmx-parameters:

VMware-liveCD:


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

Reply
0 Kudos
JohnPeterson
Contributor
Contributor

Can someone fix the commands below so that copy (and format) doesn't fail?

Thanks!

# Linux

touch disk.img
mkntfs -fF disk.img 100000
qemu-img convert disk.img -O vmdk disk.vmdk
dd if=/dev/zero of=file.10mb bs=10M count=1
# Windows
vmware-mount z: disk.vmdk
copy file.10mb z:\
A device attached to the system is not functioning.
        0 file(s) copied.
format z: /q Creating file system structures. The first NTFS boot sector is unwriteable. All NTFS boot sectors are unwriteable.  Cannot continue. Format failed.
mkntfs -V mkntfs v2012.1.15AR.1 (libntfs-3g) qemu-img qemu-img version 1.0, Copyright (c) 2004-2008 Fabrice Bellard
cat /etc/issue Ubuntu 12.04 LTS \n \l
vmware-mount /?
VMware DiskMount Utility version 4.2.0 build-321138
ver
Microsoft Windows [Version 6.1.7601]
Reply
0 Kudos