Sunday, April 13, 2008

How to add a new virtual disk to a linux vmware machine.

1. Shutdown the virtual linux by: shutdown –h now
2. Click on "Edit virtual machine settings" in the "Commands" section of vmware for our virtual machine.
3. Click on "Add…" button of "Virtual Machine Settings" window.
4. Choose the "Hard Disk" and click "Next".
5. Choose the "Create a new virtual disk" option and click "Next".
6. In the "Virtual disk type" section choose SCSI and click "Next".
7. In the "Disk capacity" chose 20GB for the "Disk size" and mark "Split disk" into 2GB files. Then click "Next".
8. Click "Finish" in the next window.
9. Now we can see a new disk on the "Hardware" tab. Click "Ok".
10. Click on "Start this virtual machine" link.
11. Login and open a terminal window as root.
12. Execute: fdisk /dev/sdb
We run /dev/sdb because this is the second disk on our linux system (first one is /dev/sda).
In the fdisk utility complete the following commands:
12.1. Press "n" to add a new partition
12.2. Press "p" for a primary partition (1-4)
12.3. Enter "1" to set up the first partition.
12.4. Enter the default values for first and last cylinders.
12.5. Enter "w" for writing this information.
13. For formatting the new partition enter: mkfs -t ext3 /dev/sdb1
14. Create the /u01 directory for mounting the new disk: mkdir /u01
15. Mount this new disk to this directory: mount -t ext3 /dev/sdb1 /u01
16. Check by df –k that this disk is mounted.
[root@cent4 ~]# df -k /u01
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdb1 20635700 77888 19509576 1% /u01
17. In the /etc/fstab file add the following entry:
/dev/sdb1 /u01 ext3 defaults 1 1
I have chosen these parameters because I have the same ones for my root partition:
/dev/VolGroup00/LogVol00 / ext3 defaults 1 1
So probably it makes sense.
That’s it. Now, if we reboot our virtual machine the /u01 volume will be mounted automatically.
In the next article we will use this volume for our new oracle database.

Thanks,
Sergey.

No comments: