Adding a new disk to a VMWare Virtual Machine in Linux
I’ve been using VMWare for a while now and I always get asked some common questions about it. One of those is how to add a new virtual disk to a Linux virtual machine. So in response to that, here are the steps to adding a new SCSI based virtual disk to a CentOS Linux virtual machine. The steps for adding a disk to a Windows machine is very much the same except you would use the Disk Management utility from the Control Panel.
Step 1: Open virtual machine settings
Select your virtual machine, as you can see from the photo I selected the Infrastructure virtual machine. Next press the “Edit virtual machine settings’ to open the Virtual Machine Settings dialog.

Step 2: Add new hardware
From the “Virtual Machine Settings” dialog select the “Add…” button at the bottom of the screen. From this dialog you can also modify how much memory you dedicate to the machine when it boots.

Step 4: Select new hard disk
From this screen we can see the many types of hardware we can add to a virtual machine. You can emulate just about any piece of hardware that one can expect in a modern operating system. It definitely makes testing with different configurations and devices much easier. For our example we want to select “Hard Disk” and then select the “Next >” button.

Step 5: Create the virtual disk
In the next screen we see the three options for adding a new disk. We can “Create a new virtual disk”, this will create a brand new disk on the guest operating system. The second option, “Use an existing virtual disk”, allows you to mount a disk from another virtual machine. I like to do this with my “source” drive. I have one virtual disk that I’ve made that has all the Oracle and Linux CDs on it, that way I can just mount it to the machine I need when I have to do a new install instead of copying the binaries I need across disks, its definitely a big time saver. The last option is to “Use a physical disk”, this allows you to mount a local physical disk to the operating system. This option is akin to NFS mounting a drive to a virtual machine. To add a new disk we select the “Create a new virtual disk” option and select the “Next >” button.

Step 6: Select type of disk
Next we want to select the type of disk. I’ve been using VMWare for a long time and agree that the recommended Virtual Disk Type should be SCSI. I don’t know why, but I’ve had much better success with the SCSI virtual disks than the IDE ones. So in this step we want to select “SCSI (Recommended)” and the “Next >” button.

Step 7: Set disk size and options
Now we want to set the size of the disk we are creating. One of the nice features of VMWare is that you don’t have to allocate all of the disk when you create it. So if you create a 40 GB disk it doesn’t have to take it all right away, the disk will grow as your virtual machine needs it. I will say this is a big performance hit you take when the disk has to extend, but for most applications its OK. Also, I will warn that if the virtual disk grows and there is no physical disk left on the host operating system you will see a catastrophic failure and in most cases both the host and guest operating systems lock up and become unusable. (Don’t say I didn’t warn you) Lastly, you can split the files into 2GB sizes, while this isn’t necessary, it just makes all the disks much easier to manage and move around. For this step we want to set our disk size (12 GB in this case), I chose not to allocate the disk space right now (the machine has a 300 GB drive and has only 20 GB on it) and Split disk into 2 GB files.

Step 8: Name the disk file
This is actually pretty simple in that you decide what you want to physically call the disk and where to put it. .vmdk is the extension for VMWare virtual disks. After we name the disk we can select the “Finish” button which adds the disk to the virtual machine.

Step 9: Ensure new disk exists
So now we can see that the new disk has been added to the “Virtual Machine Settings” within the selected virtual machine. From here the disk acts just like it would if you added a new disk to a standalone server. So we select the “OK” button to continue.

Step 10: Boot the virtual machine
From here we just start the virtual machine like we would normally, either by selecting the button on the toolbar or selecting the “Start this virtual machine” link.

Step 11: Virtual machine start up
The machine boots normally as it would any other time.

Step 12: Create the Partition
After we’ve logged in and accessed a terminal window as root (or another user with root/sudo privs) we first want to run fdisk on the newly created drive. In Linux the first SCSI drive is sda, the second sdb, the third sdc, etc. since this was the second SCSI drive we added to the system, the device is known as /dev/sdb
The first command we want to run is fdisk /dev/sdb (NOTE: Thanks to everyone that caught my typo here) this utility works very much like the DOS utility of the old days and allows you to create and manage partitions. To create a new partition we enter the command n to create a new partition. This is going to be a primary partition p, and the first partition number 1. Because I want this disk to consume the full 12 GB I specified earlier we start at the first cylinder and end it at the last cylinder. We then want to write the partition table with the new partition we have just created so we enter the command w which writes the new table and exits fdisk.

Step 13: Format the partition
Now that we’ve create the partition, we now want to format the first with the new file system. I’ve decided to use ext3 filesystem for this disk, ext3 provides all the features of the classic ext2 file system plus journaling which helps to prevent disk corruption in the event of an improper shutdown and speeds up the recovery process. For a good overview of Linux standard file systems check out this article: http://linux.org.mt/article/filesystems So, to format the new partition we enter the command mkfs -t ext3 /dev/sdb1. This command makes a new files system with the type t ext3 on the /dev/sdb1 partition, this is the first partition on the sdb disk.

Step 14: Create the mount point
Determine where you want to add the new virtual disk you’ve created. I like to create a partition specifically for all the software I install after the basic Linux install called /software to do that we run mkdir /software, just a simple make directory command. Once that is complete we then want to mount the newly created partition. Because we haven’t added the partition to the /etc/fstab yet we have to mount it manually. To do that we run mount -t ext3 /dev/sdb1 /software. To break down this command we run mount with the ext3 filesystem type, the partition /dev/sdb1 to the directory /software. Pretty simple and straight forward. To check that the partition is properly mounted we run df -k which shows us the mounted partitions and the amount of available space.

Step 15: Open the fstab file
The fstab file holds all of the used disks and partitions, and determines how they are supposed to be used by the operating system. So we edit the file to add the newly created partition
http://www.matttopper.com/images/blog/adding_disk_to_vmware/15.jpg
Step 16: Modify the fstab for the new partition
After we open the fstab file in the previous step we add the following line:
/dev/sdb1 /software ext3 defaults 1 1
The first column is the partition name, the second is the default mount point, the third is the filesystem type. The fourth is the mount options, in this case I used default which mounts the drive rw, suid, dev, exec, auto, nouser and asynchronous. The 5th and 6th options are for the dump and fsck options. If dump is set to 1 the filesystem is marked to be backed up, if you are going to have sensitive material on the drive its a good idea to set it to 1. If fsck is set to greater than 1, then the operating system uses the number to determine in what order fsck should be run during start up. If it is set to 0 it will be ignored such as in the case of a cdrom drive since its a solid state disk. For more information on the fstab file check out this article: http://www.tuxfiles.org/linuxhelp/fstab.html
Lastly, we write and quit the file with the :wq command.

So now that the fstab has been written the drive will be mounted and unmounted when the machine is either started or shutdown. So there you have it, the quick and dirty process for adding a brand new disk to a virtual machine. Until next time…
Sunday, May 7th, 2006 @ 9:30 pm
June 16th, 2006 at 1:59 pm
Matt,
Thank you for this tutorial. Well done!
g
June 22nd, 2006 at 3:55 pm
Matt,
Thanks so much. I just got some vmware images and
needed to understand and add some space. Your notes are
great. They really helped!
E
June 23rd, 2006 at 9:01 am
Matt – this tutorial was exactly what I needed, right down to the tip about using the same virtual disk file in different machines for the software I have to install. Nice work!
Ben
July 8th, 2006 at 3:12 pm
Not too bad – did exactly what I expected and was welcome. Fonts and picture sizes and overall layout could be improved.
Thanks!
August 22nd, 2006 at 11:24 pm
Matt – Thanks a lot for the tutorial. It helped me a lot.
September 15th, 2006 at 7:38 pm
Great tutorial, I thought I would have issues mounting being in vmware but just like the typical linux install…and btw fonts and pics are great
September 28th, 2006 at 8:05 am
Hi Matt,
Excellent Guide!! One of the very few tutorials that actually are concise enough to be followed and accurate enough to work!!
Great job!
October 3rd, 2006 at 8:12 am
Like what you have to say. Your blog makes good since to me.
October 3rd, 2006 at 10:36 pm
Matt,
That was a wonderful and indeed a great tutorial. Hope more will come !!!
November 12th, 2006 at 1:35 pm
Thanks, the right answer at the right time. Thank you for the carefully created tutorial and references.
November 12th, 2006 at 10:31 pm
Amazing… !! 10/10 … great explaination… I manage to add the required space using this example.
December 20th, 2006 at 8:29 pm
Thank you so much! I’m new to linux and after I added the virtual disk via vmware it wasn’t showing up, and I just wasn’t understanding where the heck it was! Very helpful
December 28th, 2006 at 6:19 am
Hi Matt,
this guide was really helpful than anything else..
thanks:)
December 28th, 2006 at 1:41 pm
This is a great article. 11 out of 10
January 24th, 2007 at 7:19 am
What an awesome tutorial. Absolutely the walk-thru I needed.
One minor typo:
Step 12 states, “The first command we want to run is fdisk /dev/hdb …”
I had to run ‘fdisk /dev/sdb’ and the rest was perfectly golden!
Thanks so much!
AlanB
March 18th, 2007 at 12:51 pm
Thank you very much for the awesome tutorial! This is just what I was looking for!
June 24th, 2007 at 12:43 pm
Thanks for your instruction.
It’s really helpful!
July 3rd, 2007 at 11:45 pm
This is awesome. This is exactly what I was looking for. I really appreciate it.
July 11th, 2007 at 3:38 pm
Great work, it’s really help and same lots of time. Very appreciated.
thanks so much
Alec
July 19th, 2007 at 12:54 am
Thank you so much
August 1st, 2007 at 12:52 pm
Really nice, thank you very much.
I’m sure you wont mind if i post a spanish version of this tutorial in my blog (with the corresponding credits)
–>
Keep it simple
August 3rd, 2007 at 6:20 am
Thanks a lot for the great tutorial. This is exactly what I needed. I was glad to find very clear instructions on how to proceed AND some background info to learn what it is all about.
August 22nd, 2007 at 6:07 pm
Awsome tutorial! First time I have added a disk to a linux distro, and the process was painless following the steps described above. Your blog is definately being bookmarked for future reference
August 23rd, 2007 at 12:29 am
Hello Matt,
great article.
Is there a way to add a virtual disk,
without booting the VM ?
We are running a HA system with minimum downtime.
Thanks !
P.S.:
On HP-Ux, I think “ioscan” would work.
Best wishes
Ralf Steffler
September 2nd, 2007 at 8:16 am
HI Matt,
Thanks for the post. I have two questions for you.
1.On your step 12, you did “fdisk /dev/sdb”. My understanding is you have had “/dev/sda” as your “Hard Disk (SCSI: 0:0)”. Therefore, “/dev/sdb” is your “Hard Disk (SCSI: 0:1)” that you newly created. Is it right?
2.Still step 12, when you did “n” to add a new partition, the “First cylinder” is 1, but the “Last cylinder” is default 1566. I know you created 12GB second hard disk. Why the “Last cylinder = 1566 ” is related a 12GB hard drive?
Thanks for your attention.
I look forward to receiving your reply.
Dave
September 11th, 2007 at 6:22 am
Thank you very much, beats the pants off the official help with vmware server.
September 11th, 2007 at 2:39 pm
Matt,
Thanks for this tutorial Matt. This really helped me a lot.
September 18th, 2007 at 3:25 am
Hi Matt!
Many thanks for your clear tutorial!
Regards,
–
Alex
October 17th, 2007 at 9:37 pm
After all that searching I finally found what I was looking for. Thanks Heaps!!! Just what I wanted
November 5th, 2007 at 8:35 pm
Hi Matt!
Awesome ! Big help. Thanks!!!
November 15th, 2007 at 5:50 pm
Thanks very much for great tutorial.
Wim
November 15th, 2007 at 7:46 pm
Simply follow the steps and all done.
Excellent instruction.
Thanks,
Charles
November 21st, 2007 at 7:56 pm
Matt -Great!!! Thank you very much for this wonderful tutorial
Regards
-Suren
November 28th, 2007 at 10:58 am
B’H’
Hello,
I’m from Paris.
You know what ? Thank you very much. It’s very clear, and easy to realise. Congratulations !!!!
Many thanks for your help.
It works perfecty.
December 4th, 2007 at 8:14 am
Greate tutorial. After couple of weeks of skimming the internet, finally I got to know this site and my problem is solved now
December 28th, 2007 at 5:53 pm
Thank you very much.
January 11th, 2008 at 11:02 pm
Greate job. Thank you very much.
Best regards,
Fernando
January 18th, 2008 at 2:07 pm
Thanks Matt…This was exactly what i was looking for…Kudos to you
January 21st, 2008 at 2:50 am
Thanks for your tutorial, been a long time since I had to modify disks and never on a VMware machine, just the crash course I needed.
January 21st, 2008 at 3:47 pm
This was really helpful!
I have a virtual machine running OpenSuSE 10.2 and the procedure worked just fine!
Thanks from Colombia
January 23rd, 2008 at 12:40 am
Hello,
This is an awesome tutorial prepared by you. Thanks a ton… this was really helpful.
Regards,
Rashmi
January 28th, 2008 at 10:29 pm
Excellent tutorial! Your instructions are very accurate and to the point. This helps save a lot of time for me and other folks, I’m sure.
Thanks a lot.
Hoc
February 19th, 2008 at 4:18 pm
Hey, Just wanted to say thanks for the tutorial. Worked great.
February 27th, 2008 at 1:04 pm
I agree: Nice complete and very useful tutorial. I have found several sites previously, but none of them met my needs prior to this site. Thanks!
February 29th, 2008 at 9:45 am
Thanks Matt !! Great Tutorial , could It be possible to replace for example the /var partition and to add a new /var with more space and copy all the content to the new /var partition ? Thanks , Regards .
March 3rd, 2008 at 12:21 pm
Thanks Matt. I kinda knew what I had to do but couldn't see the /dev/sdb that I added. I rebooted the server and it showed up. It's always nice to find a howto for EXACTLY what you are doing.
March 5th, 2008 at 11:45 pm
Thanks Matt. It's exactly what I need.
March 6th, 2008 at 11:05 am
useful tutorial, thanks !
March 24th, 2008 at 12:37 am
Thanks for this Matt. It is very helpful. God bless!
April 20th, 2008 at 8:46 am
Thans very very much… Your tutorial very very helpful
April 21st, 2008 at 7:20 pm
THANKS!
April 22nd, 2008 at 4:53 am
Sweet! Easy to read and follow.
April 28th, 2008 at 5:43 am
Another thank-you, a clear and very useful tutorial.
May 2nd, 2008 at 8:06 am
Good job! Thanks mate!
June 5th, 2008 at 1:19 am
Thanks a lot for this guide!
June 19th, 2008 at 11:26 am
Dude, Matt, thanks so much! Fantastic tutorial, great screen shot help, breaking down the commands so that I could understand exactly what is happening and why is so helpful!
July 20th, 2008 at 6:51 am
Thanks! Worked like a charm!
August 2nd, 2008 at 4:48 am
Thanks a lot for your great tutorial
August 4th, 2008 at 7:06 pm
Hi webmaster!
August 21st, 2008 at 1:42 am
Hi Matt,
Excellent guide for the beginners! There is only one problem: the picture in Step 15 (http://www.matttopper.com/images/blog/adding_disk_to_vmware/15.jpg) is not displayed as the tag is missing from the HTML.
August 21st, 2008 at 4:41 pm
I stumbled on this while searching for “adding a second virtual drive to VMWare machine”. I am using VMWare player, and set up a Windows XP virtual machine using EasyVMX.com (thanks, EasyVMX!).
I decided I wanted more disk space, and so I looked at the .vmx file to see how disk drives are defined.
They seem to be identified by the *.vmdk filename. I copied the *.vmdk files from the virtual machine files that were produced by EasyVMX, from before I installed Windows on the virtual machine, and renamed them VMDK2*.vmdk
I then edited the VMDK2.vmdk file, which is a plain text definition file, and changed all references to the original file names to the new one.
I backed up my VM’s *.vmx file, then edited it to replicate the IDE0:0 section, except that I changed the reference to IDE0:1, and changed the .vmdk filename references to the VMDK2.vmdk filename references
Then, I crossed my fingers and ran the VMX.
Windows opened fine, and my original stuff is still there, but no second hard drive showed up. I realized that I needed to use Windows Disk Management to initialize the disk. Sure enough, it is listed as an unallocated volume or some such obscure name. I had Windows initialize it, created a partition and formatted it. Now it shows up fine.
So, no need for VMWare Server to do this, just some judicious text editing.
August 28th, 2008 at 8:03 am
Thanks so much!
Great tutorial!
Regards from Poland
September 10th, 2008 at 3:36 am
Simply Brilliant. Thanks
September 12th, 2008 at 5:49 am
Thank you! Exactly what i was looking for.
September 18th, 2008 at 11:21 am
HI
Could somebody explain me ideal way of installing Linux on Virtual Machine Workstation 6.
I will be installing Oracle Applications on Linux, which will occupy around 175 GB, so how much of space i need to allocate in the Virtual machine HDD.
I have about 200 GB in my D:/ drive, can i create my Virtual Machine on this D:\ so that when i install Linux on the Virtual Machine , i can allocate 200 GB to the Virtual HDD and install Oracle ora ny other program on Linux Later.
I am novice to Linux and Virtual machine, Please help me out. Thanks
September 19th, 2008 at 6:57 am
Matt
Two years on and it’s still helping people – just what I needed so many thanks
Simon
September 28th, 2008 at 12:56 pm
great and simple instruction. VMware should copy it to its own manual.
September 30th, 2008 at 10:32 pm
Awesome! Worked perfect!
October 1st, 2008 at 4:30 am
Thank you so much! It help me very much.
October 1st, 2008 at 9:18 am
Thanks Dude!!! pretty neat and simple explanation.
October 10th, 2008 at 11:37 am
Thanks man. Following your instructions was very straight forward and it worked as expected!
October 14th, 2008 at 1:24 pm
This is the best tutorial I’ve ever seen! Simple means genius. Thank you!
October 24th, 2008 at 9:24 am
Thanks for the tutorial very important i’m brazilian guy.
translation: Muito obrigado pelo tutorial muito importante
November 4th, 2008 at 9:24 am
nice one very helpfull
November 11th, 2008 at 11:18 am
Great document yet simple… very helpful, Thanks a Bunch.
Rahman Khaleel
December 2nd, 2008 at 4:49 am
great paper .. good job
December 4th, 2008 at 11:52 am
Great work: very clear and helpful.
Thanks Matt!
December 18th, 2008 at 11:25 pm
thank nhieu nha
January 1st, 2009 at 12:46 am
Really good, very helpful and clear explanation
January 13th, 2009 at 7:28 am
Thank You SOOOO much. Struggled with this for hours till I found this page….and pictures!! Great job. Thanks for sharing the knowledge.
(now I can look clever) ..
January 15th, 2009 at 7:52 am
thank you so much. It is what I exactly needed!!!
January 19th, 2009 at 3:45 pm
Great work man, this really helps.
January 27th, 2009 at 11:12 am
Clear step by step instructions. Very helpful. Thanks a lot.
January 28th, 2009 at 12:02 am
This article is very helpful. Appreciate your help. I have been looking for this for while.
February 8th, 2009 at 4:28 pm
Matt,
Wow. FINALLY, a linux tutorial that ACTUALLY WORKS AND MAKES SENSE for those of us who might not be Linux gurus!
This helped tremendously with a Virtual Appliance I needed to tweak to my own liking!
HDA (Hassle Free Download Appliance) vmware.com
February 24th, 2009 at 8:26 pm
Nice work. Thank you. I do have a question though, is it possible to have a running image see the newly assigned disk without rebooting?
Again, thank you.
February 25th, 2009 at 6:21 pm
gran trabajo!! well done!
March 4th, 2009 at 11:08 am
thank you very much !!It helps me alot !!
March 17th, 2009 at 7:28 am
how can i creat mail server by vmwar
March 24th, 2009 at 2:03 am
Good Information .It helped me a ton.Thanks alot.
March 24th, 2009 at 11:02 pm
Bravo!! Understandable and real work.
Thanks Matt
April 3rd, 2009 at 12:57 am
Well written, esp. when you explain WHY you used the commands that you did. Now all I have to do is add this new disk to LVM.
Thanks again.
April 29th, 2009 at 8:54 pm
Thanks. This was exactly what I needed
May 5th, 2009 at 9:01 pm
THANKS!!!, very helpful, just what I was looking for.
May 31st, 2009 at 9:18 am
Thanks a lot dude.
It helped me out in such a beautiful way.
Good work!!!
June 19th, 2009 at 2:49 am
Thanks a lot… the Doc was very helpful.
June 25th, 2009 at 7:07 pm
Thanks Matt,
saved me in a pinch, had to move /var/spool to a new drive.
June 30th, 2009 at 11:36 pm
Still working in ‘09 with redhat 5 and vmware workstation 6.5.2
July 6th, 2009 at 12:38 am
Thanks – This was v.helpful.
July 11th, 2009 at 6:03 am
It is simple and very very useful information.
July 11th, 2009 at 6:19 am
Hi Matt,
Just checked it and it worked fine.
Thanks,
Salih KM
July 30th, 2009 at 10:14 am
Thnx for this, saved me alot of time =)
August 17th, 2009 at 4:45 am
Good work. Buddy
August 17th, 2009 at 7:44 am
Good tutorial, I never knew that I can create an additional virtual hard disk for RAID configuration.
September 8th, 2009 at 6:43 am
Great tutorial!
September 15th, 2009 at 3:30 pm
Quick and Easy!
Nice description and document is easy to understand with screen shots. Before finding this reference I have spend my 1 hr to add new HD. But now, I have added new HD to my vmware without any problem.
Thanks a lot.
September 21st, 2009 at 5:10 am
Very useful tutorial, again saved a lot of time.
Thanks for posting.
September 23rd, 2009 at 5:31 pm
Thanks for the tutorial
Saved me a ton of time
October 7th, 2009 at 2:41 pm
Excellent Work Buddy
.
October 8th, 2009 at 5:36 pm
Thnaks a lot ,this tutorial is very nice and useful,i was able to create a new partition using this document
October 15th, 2009 at 7:10 am
Thank you!! Simple and perfect!
November 3rd, 2009 at 10:42 am
Thank you for the great tutorial!
November 6th, 2009 at 10:41 am
really usefull guide
November 12th, 2009 at 3:07 pm
you are the man…..thanks
December 9th, 2009 at 8:19 am
The tutorial is good but I couldn’t go through with the process. All the first 12 steps passed quite ok but I got stucked at step 13. Indeed, after I entered the following
“mkdir -t ext3 /sdb1″ I got the following error: /dev/sdb1: Invalid argument passed to ext2 library while setting up superblock.
Am using RHEL4. Any tips?
Thanks in advance.
December 9th, 2009 at 10:36 am
It worked fine. I was making a mistake in the mkfs command. Thanks again for the tuto.
December 14th, 2009 at 2:56 am
Thanks. Very useful.
December 17th, 2009 at 4:30 am
Good Tutorial. Well Explained and very detailed!!
December 23rd, 2009 at 1:24 am
3.5 years and it’s still helping us n00bs out.
Mr. Tumy pointed me this way as I was trying to add a second drive to VirtualBox. Worked like a charm. Thanks!
chet
December 25th, 2009 at 1:43 am
Oh. Very nice explaination article. Thanks for such a great knowledge sharing.
December 28th, 2009 at 7:58 am
It is very helpful and useful guide. Unfortunately, I did everything as mentioned and got virtual disk mounted but drive is not visible at all. I can see drive being mounted with mount command. There is also an entry in fstab file but still not visible. I have tried restarting couple of times.
Can you please help and tell me what I am missing here?
Cheers,
Angad
January 11th, 2010 at 1:49 pm
[...] Adding a new disk to a VMware virtual machine in Linux by Matt Topper provides an illustrated step-by-step how-to gude [...]
January 11th, 2010 at 1:58 pm
[...] Adding a new disk to a VMware virtual machine in Linux by Matt Topper provides an illustrated step-by-step how-to gude [...]
January 14th, 2010 at 7:52 am
Really helpful article – thanks
January 14th, 2010 at 8:48 pm
Comprehensive Survey of techniques to Extend / Expand virtual disks – VMWare, Fusion, VMware Server, VM Workstation, esx, including this post
http://blog.sharevm.com/2010/01/11/survey-extend-expand-vmware-virtual-disk/
January 15th, 2010 at 3:04 pm
Thanks for useful information , I wasn’t aware that you have already documented it in such nice way .
Other location
http://onlineappsdba.com/index.php/2009/12/30/how-to-add-disk-in-linuxoel-virtual-linux-on-vmware-server/