First, let's see what drives are showing up for the Linux guest. From the host we're going to check the /dev directory and see what drives are showing up.
#cd /dev
#ls
Here we can see that there is three drives, sda, sdb and sdc listed on the guest. Under these two drives is three partitions titled sda1 and sda2, plus sdb1. Notied that drive sdc does not have any partitions. This breaks down like this.
- SDA
- SDA1
- SDA2
- SDB
- SDB1
- SDC
- No partitions
From VMware Workstation, we're going to add the drive to the guest.
- Right click the guest, and click the "Settings"
- The Virtual Machine Settings window will open
- Click the "add" button
- The "Add Hardware Wizard" window will open
- Select "Hard Disk" then click the "Next" button
- Under the "Select a Disk" leave the default as "Create a new virtual disk", then click the "Next" button
- Under the "Select a Disk Type" leave the default as "SCSI", then click the "Next" button
- Under the "Specify Disk Capacity", change the value for "Maximum disk size (GB)" to the amount you want. For this example, I will be using 5GB. Then click the "Next" button
- Under the "Specify Disk File" leave the file name as default and then click the "Finish" button
- Back at the "Virtual Machine Settings" window, click the "OK" button to complete
- The new drive has been added to the guest
These commands were posted on another blog, Cyberciti's how to add a new VMware hard disk article.
First we're going to scan the system for the new drives. We need the host numbers on the guest machine first.
- First find the host number on your system
- Run the following command
- #ls /sys/class/scsi_host
- You should see the return of "host0" or more
- Force the system to scan the drives
- The host number you found in the previous step will be used here.
- Run the following command
- #echo "- - -" > /sys/class/scsi_host/host2/scan (note on my system it's "host2")
- After this you may see a message of the drive scanned on the machine
- To confirm, check the logs for messages of new drive
- Run the following command
- #tail /var/log/messages
- This will be sequential from the last drives. For example, if you see in /dev drives SDA, SDB, then you should see logs for drive SDC
- From fdisk we're going to also validate it's showing up
- Run the following command
- #fdisk -l
- You should see the drive showing up that matches the drive from step 3
- From /dev you should also see the new drive listed
- Run the following command
- #ls /dev
- You should see the drive showing up that you just added
- First find the drive has been discovered on the system
- Run the following command
- #fdisk -l | grep 'Disk'
- You should see the drive you added in the previous steps shown near the end of the list
- Save this information for the next steps.
- Run fdisk to create the partition on the new disk (if anytime you get lost on commands, type "m" for the command menu
- Run the following command
- #fdisk /dev/sdd (your drive may be different)
- In fdisk, type "n" to create a new partition
- Type "p" for a primary partition
- Type "1" for a partition number
- Type "1" for a first cylinder number
- Type "1G" for size (this can be adjusted for your needs)
- Type "w" to write and save the information
- This will automatically close fdisk
- Validate the partition is now showing up in /dev directory
- Run the following command
- #ls /dev
- You should see the new partition showing up under the drive you just created
- We're now going to format the partition with ext3 so that it's usable
- Run the following command
- #mkfs.ext3 /dev/sdd1
- You should see confirmation the command was successful
- Finally we are going to mount the drive
- Run the following commands
- #mkdir /disk1
- #mount /dev/sdd1 /disk1 (your drive may be different)
- Confirm the drive is showing up
- Run the following command
- #df -H
- You should see your new drive mounted
- Test the new mount
- Run the following commands
- #touch /disk1/testfile
- #ls /disk1
- You should see your file written to the new mount
- Now set the mount at boot
- Run the following command
- #vi /etc/fstab
- Add the following line to the fstab file (note, I'm not going to show basic Vi commands here, you can find them across the Internet)
- /dev/sdd1 /disk1 ext3 defaults 1 2
- Save the file
- Done!
2 comments:
Amazing tutorial - was a great help for me in creating a linux partition under vmware workstation - thx!
Thx for the great tutorial - was a big help for me in creating a linux partition under vmware workstation
Post a Comment